本文整理汇总了C++中QTabWidget::setTabEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabWidget::setTabEnabled方法的具体用法?C++ QTabWidget::setTabEnabled怎么用?C++ QTabWidget::setTabEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTabWidget
的用法示例。
在下文中一共展示了QTabWidget::setTabEnabled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KDialogBase
KWStatisticsDialog::KWStatisticsDialog( QWidget *parent, KWDocument *document )
: KDialogBase(parent, "statistics", true, i18n("Statistics"),KDialogBase::Ok, KDialogBase::Ok, false )
{
QWidget *page = new QWidget( this );
setMainWidget(page);
QVBoxLayout *topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() );
QTabWidget *tab = new QTabWidget( page );
QFrame *pageAll = 0;
QFrame *pageGeneral = 0;
QFrame *pageSelected = 0;
for (int i=0; i < 7; ++i) {
m_resultLabelAll[i] = 0;
m_resultLabelSelected[i] = 0;
if ( i < 6 )
m_resultGeneralLabel[i]=0;
}
m_doc = document;
m_parent = parent;
m_canceled = true;
// add Tab "General"
pageGeneral = new QFrame( this );
tab->addTab( pageGeneral, i18n( "General" ) );
addBoxGeneral( pageGeneral, m_resultGeneralLabel );
calcGeneral( m_resultGeneralLabel );
// add Tab "All"
pageAll = new QFrame( this );
tab->addTab( pageAll, i18n( "Text" ) );
addBox( pageAll, m_resultLabelAll, true );
m_canceled = true;
pageSelected = new QFrame( this );
tab->addTab( pageSelected, i18n( "Selected Text" ) );
// let's see if there's selected text
bool b = docHasSelection();
tab->setTabEnabled(pageSelected, b);
if ( b ) {
addBox( pageSelected, m_resultLabelSelected, false);
// assign results to 'selected' tab.
if ( !calcStats( m_resultLabelSelected, true,true ) )
return;
if ( !calcStats( m_resultLabelAll, false,false ) )
return;
showPage( 2 );
} else {
// assign results
if ( !calcStats( m_resultLabelAll, false, false ) )
return;
showPage( 1 );
}
topLayout->addWidget( tab );
m_canceled = false;
}
示例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);
}
示例3: setTabEnabled
int TabWidget::setTabEnabled( lua_State * L ) // ( int index, bool enable )void
{
QTabWidget* obj = ObjectHelper<QTabWidget>::check( L, 1 );
int index = 0;
if ( Util::isNum( L, 2 ) )
{
if ( Util::toInt( L, 2 )>=0 )
{
index = Util::toInt( L, 2 );
}
else
{
Util::error( L, "Invalid Index" );
}
}
obj->setTabEnabled( index, Util::toBool( L, 3 ) );
return 0;
}
示例4: managerLoginPage
//constructor
MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent)
{
managerLoginPage();
receptionPage();
cateringPage();
QTabWidget *tabWidget = new QTabWidget;
tabWidget->insertTab(0, receptionWidget,tr("&Reception"));
tabWidget->insertTab(1, managerLoginWidget, tr("Manager Login"));
tabWidget->insertTab(2, cateringWidget, tr("Catering Services"));
tabWidget->setTabEnabled(0, true);
setCentralWidget(tabWidget);
cateringServices = new CateringServices; //A universal catering service object. Reinitailise for new use.
manager = new Management;
updateVisit_MonthCount(); //update month count for token
}
示例5: tabSetTabEnabled
void ScriptToolbox::tabSetTabEnabled(QWidget * tab, int idx, bool enable)
{
QTabWidget *tw = qobject_cast<QTabWidget*>(tab);
if(tw)
tw->setTabEnabled(idx, enable);
}
示例6: setTabEnabled
void QTabWidgetProto::setTabEnabled(int index, bool enable)
{
QTabWidget *item = qscriptvalue_cast<QTabWidget*>(thisObject());
if (item)
item->setTabEnabled(index, enable);
}