本文整理汇总了C++中QSplitter::setWindowTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ QSplitter::setWindowTitle方法的具体用法?C++ QSplitter::setWindowTitle怎么用?C++ QSplitter::setWindowTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSplitter
的用法示例。
在下文中一共展示了QSplitter::setWindowTitle方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QDirModel model;
QTreeView tree;
QListView list;
QTableView table;
tree.setModel(&model);
list.setModel(&model);
table.setModel(&model);
tree.setSelectionMode(QAbstractItemView::MultiSelection);
list.setSelectionModel(tree.selectionModel());
table.setSelectionModel(tree.selectionModel());
QObject::connect(&tree,SIGNAL(doubleClicked(QModelIndex)),&list,SLOT(setRootIndex(QModelIndex)));
QObject::connect(&tree,SIGNAL(doubleClicked(QModelIndex)),&table,SLOT(setRootIndex(QModelIndex)));
QSplitter *splitter = new QSplitter;
splitter->addWidget(&tree);
splitter->addWidget(&list);
splitter->addWidget(&table);
splitter->setWindowTitle(QObject::tr("Model/View"));
splitter->show();
return a.exec();
}
示例2: main
//! [0] //! [1]
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QSplitter *splitter = new QSplitter;
//! [2] //! [3]
QDirModel *model = new QDirModel;
//! [0] //! [2] //! [4] //! [5]
QTreeView *tree = new QTreeView(splitter);
//! [3] //! [6]
tree->setModel(model);
//! [4] //! [6] //! [7]
tree->setRootIndex(model->index(QDir::currentPath()));
//! [7]
QListView *list = new QListView(splitter);
list->setModel(model);
list->setRootIndex(model->index(QDir::currentPath()));
//! [5]
QItemSelectionModel *selection = new QItemSelectionModel(model);
tree->setSelectionModel(selection);
list->setSelectionModel(selection);
//! [8]
splitter->setWindowTitle("Two views onto the same directory model");
splitter->show();
return app.exec();
}
示例3: main
int main(int argc, char** argv)
{
QApplication application(argc,argv);
// Create Splitters
QSplitter *hSplit = new QSplitter(Qt::Vertical);
QSplitter *vSplit1 = new QSplitter(hSplit);
QSplitter *vSplit2 = new QSplitter(hSplit);
// Create the scene
Scene* s = new Scene();
// Instantiate the viewers.
Viewer side (s,0,vSplit1);
Viewer top (s,1,vSplit1, &side);
Viewer front (s,2,vSplit2, &side);
Viewer persp (s,3,vSplit2, &side);
hSplit->setWindowTitle("multiView");
// Set main QSplitter as the main widget.
hSplit->show();
return application.exec();
}
示例4: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QFont font("ZYSong18030",12);
a.setFont(font);
//主分割窗口
QSplitter *splitterMain =new QSplitter(Qt::Horizontal,0);
QTextEdit *textLeft =new QTextEdit(QObject::tr("Left Widget"),splitterMain);
textLeft->setAlignment(Qt::AlignCenter);
//右部分割窗口
QSplitter *splitterRight =new QSplitter(Qt::Vertical,splitterMain);
splitterRight->setOpaqueResize(false);
QTextEdit *textUp =new QTextEdit(QObject::tr("Top Widget"),splitterRight);
textUp->setAlignment(Qt::AlignCenter);
QTextEdit *textBottom =new QTextEdit(QObject::tr("Bottom Widget"),splitterRight);
textBottom->setAlignment(Qt::AlignCenter);
splitterMain->setStretchFactor(1,1);
splitterMain->setWindowTitle(QObject::tr("Splitter"));
splitterMain->show();
//MainWindow w;
//w.show();
return a.exec();
}
示例5: Test_TreeView_MVC
void Test_TreeView_MVC()
{
//mvc data
TA_Base_App::Node* pNodeRoot = NULL;
TA_Base_App::Node* pNodeRootRoot = NULL;
TA_Base_App::Node* pNodeOrExpression = NULL;
TA_Base_App::Node* pNodeAndExpression = NULL;
TA_Base_App::Node* pNodeNotExpression = NULL;
TA_Base_App::Node* pNodeOperator = NULL;
pNodeRoot = new TA_Base_App::Node(TA_Base_App::NodeData::Root, "root");
pNodeRootRoot = new TA_Base_App::Node(TA_Base_App::NodeData::Root, "rootroot");
pNodeOrExpression = new TA_Base_App::Node(TA_Base_App::NodeData::OrExpression, "A");
pNodeAndExpression = new TA_Base_App::Node(TA_Base_App::NodeData::AndExpression, "A_A");
pNodeNotExpression = new TA_Base_App::Node(TA_Base_App::NodeData::NotExpression, "A_A_A");
pNodeOperator = new TA_Base_App::Node(TA_Base_App::NodeData::Operator, "A_A_A_A");
pNodeRoot->m_pParentNode = NULL;
pNodeRoot->m_pChildrenNodeLst.push_back(pNodeRootRoot);
pNodeRootRoot->m_pParentNode = pNodeRoot;
pNodeRootRoot->m_pChildrenNodeLst.push_back(pNodeOrExpression);
pNodeOrExpression->m_pParentNode = pNodeRootRoot;
pNodeOrExpression->m_pChildrenNodeLst.push_back(pNodeAndExpression);
pNodeAndExpression->m_pParentNode = pNodeOrExpression;
pNodeAndExpression->m_pChildrenNodeLst.push_back(pNodeNotExpression);
pNodeNotExpression->m_pParentNode = pNodeAndExpression;
pNodeNotExpression->m_pChildrenNodeLst.push_back(pNodeOperator);
pNodeOperator->m_pParentNode = pNodeNotExpression;
pNodeOperator->m_pChildrenNodeLst.clear();
//model
TA_Base_App::BooleanModel* booleanModel = new TA_Base_App::BooleanModel();
booleanModel->setRootNode(pNodeRoot);
pNodeRoot = NULL;
//mvc view
QSplitter* splitter = new QSplitter();//two widget
QTreeView* treeViewTmp = new QTreeView(splitter);//
//mvc
treeViewTmp->setModel((QAbstractItemModel *)booleanModel);
//treeViewTmp->setAlternatingRowColors(true);
treeViewTmp->setRootIndex(booleanModel->index(0, 0, QModelIndex()));
splitter->setWindowTitle("mvc tree view test");
splitter->show();
}
示例6: main
int main(int argc, char** argv)
{
// Read command lines arguments.
QApplication application(argc,argv);
// Create Splitters
QSplitter *hSplit = new QSplitter(Qt::Horizontal);
QSplitter *vSplit1 = new QSplitter(Qt::Vertical,hSplit);
QSplitter *vSplit2 = new QSplitter(Qt::Vertical,vSplit1);
hSplit->resize(1280,720);
DataLive::tp_shared_ptr _pData( new DataLive() );
// Instantiate the viewers.
Viewer global_view(string("global_view"), _pData, vSplit1, NULL);
Viewer rgb_view(string("rgb_view"), _pData, vSplit1, &global_view);
Viewer camera_view(string("camera_view"), _pData, vSplit1, &global_view);
Viewer depth_view (string("depth_view"), _pData, vSplit1, &global_view);
hSplit->addWidget(&global_view);
hSplit->addWidget(vSplit1);
hSplit->setStretchFactor(0, 3);
hSplit->setStretchFactor(1, 1);
vSplit1->addWidget(&rgb_view);
vSplit1->addWidget(vSplit2);
vSplit2->addWidget(&depth_view);
vSplit2->addWidget(&camera_view);
#if QT_VERSION < 0x040000
// Set the viewer as the application main widget.
application.setMainWidget(&viewer);
#else
hSplit->setWindowTitle("Kinect Multi-view");
#endif
try{
// Make the viewer window visible on screen.
hSplit->show();
// Run main loop.
return application.exec();
}
catch ( btl::utility::CError& e ) {
if ( std::string const* mi = boost::get_error_info< btl::utility::CErrorInfo > ( e ) ) {
std::cerr << "Error Info: " << *mi << std::endl;
}
}
catch ( std::runtime_error& e ){
PRINTSTR( e.what() );
}
}
示例7: main
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(interview);
QApplication app(argc, argv);
QSplitter page;
QAbstractItemModel *data = new Model(1000, 10, &page);
QItemSelectionModel *selections = new QItemSelectionModel(data);
QTableView *table = new QTableView;
table->setModel(data);
table->setSelectionModel(selections);
table->horizontalHeader()->setMovable(true);
table->verticalHeader()->setMovable(true);
// Set StaticContents to enable minimal repaints on resizes.
table->viewport()->setAttribute(Qt::WA_StaticContents);
page.addWidget(table);
QTreeView *tree = new QTreeView;
tree->setModel(data);
tree->setSelectionModel(selections);
tree->setUniformRowHeights(true);
tree->header()->setStretchLastSection(false);
tree->viewport()->setAttribute(Qt::WA_StaticContents);
// Disable the focus rect to get minimal repaints when scrolling on Mac.
tree->setAttribute(Qt::WA_MacShowFocusRect, false);
page.addWidget(tree);
QListView *list = new QListView;
list->setModel(data);
list->setSelectionModel(selections);
list->setViewMode(QListView::IconMode);
list->setSelectionMode(QAbstractItemView::ExtendedSelection);
list->setAlternatingRowColors(false);
list->viewport()->setAttribute(Qt::WA_StaticContents);
list->setAttribute(Qt::WA_MacShowFocusRect, false);
page.addWidget(list);
page.setWindowIcon(QPixmap(":/images/interview.png"));
page.setWindowTitle("Interview");
page.show();
return app.exec();
}
示例8: Test_FileSystem_MVC
void Test_FileSystem_MVC()
{
QSplitter* splitter = new QSplitter;//two widget
QFileSystemModel* model = new QFileSystemModel;
QTreeView* tree = new QTreeView(splitter);//left tree view
QListView* list = new QListView(splitter);//right list view
splitter->setWindowTitle("Two vies onto the same file system model");
model->setRootPath(QDir::currentPath());
tree->setModel(model);//set model for view
tree->setRootIndex(model->index(QDir::currentPath()));
list->setModel(model);
list->setRootIndex(model->index(QDir::currentPath()));
list->setSelectionModel(tree->selectionModel());
splitter->show();
}
示例9: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
// cria um objeto "splitter" para compartilhar widgets:
QSplitter *splitter = new QSplitter(Qt::Horizontal); // horizontal e o default...
// cria um "model" usando o "QDirModel"
QDirModel *model = new QDirModel(&app); // será deletado
// na destrutora de QApplication (QObject)
// model->setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
// model->setNameFilters(QStringList() << "cursoQt");
// Neste exemplo,
// O "model" será configurado para pegar dados
// a partir de determinado(s) drive(s) ou diretório(s).
// E serão criadas três "views" (uma "tree", uma "table", e uma "list" )
// relacionadas ao mesmo "model";
// Cada "view" exibe os dados de uma determinada maneira;
// 1- ==== a primeira "view" é uma "tree":
QTreeView *tree = new QTreeView(splitter);
tree->setModel(model);
// O DirModel já oferece um "RootIndex" a partir do qual
// cada "view" exibe drives, diretórios e arquivos abaixo dele.
// No Windows o "RootIndex" default exibirá
// a relacão de todos os drives;
// para outros Sistemas apenas o root ('/').
// Mas podemos alterar o "RootIndex" de cada view.
// Um exemplo: partindo do diretório atual:
// tree->setRootIndex(model->index(QDir::currentPath()));
#ifdef Q_OS_WIN
QString rootNdx("C:/cursoQt");
#else
QString rootNdx("/home/user_name/cursoQt");
#endif
// tree->setRootIndex(model->index(rootNdx));
// MAS, temos a função que develve o root do SO:
// outro exemplo: partindo do diretorio "root" ( "/" ou "C:/"):
// tree->setRootIndex(model->index(QDir::rootPath()));
// ou ainda, um diretório específico:
// tree->setRootIndex(model->index("/cursoqt"));
// tree->setRootIndex(model->index("/cursoqt"));
/*
// outro exemplo: partindo de determinado drive:
QFileInfoList fiList = QDir::drives();
foreach( const QFileInfo & fi, fiList )
{
if ( fi.filePath()=="D:/" ) // apenas o drive "D:/"
{
tree->setRootIndex(model->index(fi.filePath()));
break;
}
}
*/
// 2- ==== a segunda "view" é uma "table"
QTableView *table = new QTableView(splitter);
table->setModel(model);
// table->setRootIndex(...); // idem
// 3- ==== a terceira "view" é uma "list":
QListView *list = new QListView(splitter);
list->setModel(model);
//list->setRootIndex(model->index(rootNdx)); // idem
// configura e exibe a "splitter"
splitter->setWindowTitle("00_dir - 3 'views' usando o mesmo 'model' (diretórios)");
int width=800;
splitter->resize(width,500);
// largura de cada "view"
QList< int > cols;
cols << int(width* 0.45) << int(width*0.45) << int(width*0.1);
splitter->setSizes(cols);
splitter->setChildrenCollapsible(false); // impede que cada banda colapse totalmente
splitter->show();
int ret = app.exec();
delete splitter; // porque não alocou o splitter na PILHA ????
return ret;
}