本文整理汇总了C++中QTabWidget::setMaximumWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabWidget::setMaximumWidth方法的具体用法?C++ QTabWidget::setMaximumWidth怎么用?C++ QTabWidget::setMaximumWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTabWidget
的用法示例。
在下文中一共展示了QTabWidget::setMaximumWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setHelpEngine
void HelpWindow::setHelpEngine(QHelpEngine* engine)
{
mpHelpEngine = engine;
mpSearchEngine = engine->searchEngine();
ui->textBrowser->setHelpEngine(engine);
QTabWidget* tWidget = new QTabWidget;
tWidget->setMaximumWidth(200);
QWidget *widget = new QWidget(this);
QVBoxLayout *vLayout = new QVBoxLayout(widget);
QHelpSearchQueryWidget* queryWidget = mpSearchEngine->queryWidget();
QHelpSearchResultWidget* resultWidget = mpSearchEngine->resultWidget();
QHelpContentWidget * contentWidget = engine->contentWidget();
vLayout->addWidget(queryWidget);
vLayout->addWidget(resultWidget);
widget->setLayout(vLayout);
widget->setFocusProxy(queryWidget);
mpSearchEngine->reindexDocumentation();
tWidget->addTab(contentWidget, "Contents");
tWidget->addTab(widget, "Search");
// no use in displaying the index for now as we don't
// have one specified yet
//tWidget->addTab(engine->indexWidget(), "Index");
ui->dockWidget->setWidget(tWidget);
connect(queryWidget, SIGNAL(search()), this, SLOT(search()));
connect(resultWidget, SIGNAL(requestShowLink(QUrl)), ui->textBrowser, SLOT(setSource(QUrl)));
connect(contentWidget,
SIGNAL(linkActivated(QUrl)),
ui->textBrowser, SLOT(setSource(QUrl)));
connect(engine->indexWidget(),
SIGNAL(linkActivated(QUrl, QString)),
ui->textBrowser, SLOT(setSource(QUrl)));
contentWidget->setItemsExpandable(true);
ui->textBrowser->setSource(QUrl("qthelp://org.sphinx.deviser.1.0/doc/deviser.html"));
// expanding the content for whatever reason does not work
// right away, so we delay it for a bit.
QTimer::singleShot(100, contentWidget, SLOT(expandAll()));
}
示例2: QString
GameSelectionWindow::GameSelectionWindow(QWidget* parent) :
QWidget(parent), m_selectedGameWidget(NULL) {
this->setWindowTitle(QString(ms_gameControllerInstance->m_applicationTitle.c_str()));
this->setMinimumWidth(900);
this->setMinimumHeight(600);
this->move(200, 200);
// set text based on logged in/offline status
QString greetingLabelText;
QString logoutButtonText;
if (ms_gameControllerInstance->inOnlineMode()) {
greetingLabelText = "Welcome, "
+ QString(ms_gameControllerInstance->m_username.c_str());
logoutButtonText = QString(ms_onlineLogoutText.c_str());
} else {
greetingLabelText = QString(ms_offlineModeGreeting.c_str());
logoutButtonText = QString(ms_offlineLogoutText.c_str());
}
// layout for entire window
QVBoxLayout* windowLayout = new QVBoxLayout();
// construct greeting label (upper rh corner)
QLabel* greetingLabel = new QLabel(greetingLabelText);
windowLayout->addWidget(greetingLabel, 0, Qt::AlignRight);
// create tabbed pane, to hold main contents
QTabWidget* tabbedPane = new QTabWidget();
tabbedPane->setMaximumWidth(16777215);
QWidget* gamesTab = constructGameSelectionTab();
tabbedPane->addTab(gamesTab, QString(ms_gamesTabTitle.c_str()));
if (ms_gameControllerInstance->inOnlineMode()) {
QWidget* statsTab = constructStatisticsTab();
tabbedPane->addTab(statsTab, QString(ms_statsTabTitle.c_str()));
} else {
int statTabId = tabbedPane->addTab(new QWidget(),
QString(ms_statsTabTitle.c_str()));
tabbedPane->setTabEnabled(statTabId, false);
}
windowLayout->addWidget(tabbedPane, 100);
// logout button (bottom lh corner)
QPushButton* logoutReturnButton = new QPushButton(logoutButtonText);
QObject::connect(logoutReturnButton, SIGNAL(clicked()), this,
SLOT(logoutAndReturn()));
windowLayout->addWidget(logoutReturnButton, 0, Qt::AlignLeft);
// set layout
this->setLayout(windowLayout);
}