本文整理汇总了C++中QTabWidget::currentIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabWidget::currentIndex方法的具体用法?C++ QTabWidget::currentIndex怎么用?C++ QTabWidget::currentIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTabWidget
的用法示例。
在下文中一共展示了QTabWidget::currentIndex方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTabLogDiffVisible
void RevsView::setTabLogDiffVisible(bool b) {
QStackedWidget* s = tab()->stackedPanes;
QTabWidget* t = tab()->tabLogDiff;
bool isTabPage = (s->currentIndex() == 0);
int idx = (isTabPage ? t->currentIndex() : s->currentIndex());
container->setUpdatesEnabled(false);
if (b && !isTabPage) {
t->addTab(tab()->textBrowserDesc, "Log");
t->addTab(tab()->textEditDiff, "Diff");
t->setCurrentIndex(idx - 1);
s->setCurrentIndex(0);
}
if (!b && isTabPage) {
s->addWidget(tab()->textBrowserDesc);
s->addWidget(tab()->textEditDiff);
// manually remove the two remaining empty pages
t->removeTab(0); t->removeTab(0);
s->setCurrentIndex(idx + 1);
}
container->setUpdatesEnabled(true);
}
示例2: currentIndex
int QTabWidgetProto::currentIndex() const
{
QTabWidget *item = qscriptvalue_cast<QTabWidget*>(thisObject());
if (item)
return item->currentIndex();
return 0;
}
示例3: QMainWindow
CMainWindow::CMainWindow(QWidget* parent)
: QMainWindow(parent)
{
setMinimumSize(900, 825);
QTabWidget* tabs = new QTabWidget();
CBlockEditorTab* block_editor;
tabs->addTab(new CMapEditorTab(this), "Map Editor");
tabs->addTab(block_editor = new CBlockEditorTab(this), "Sprite/Tile Editor");
//tabs->addTab(new CPaletteEditorTab(this), "Manual Palette Editor");
//tabs->setCurrentIndex(1);
setStatusBar(new QStatusBar());
setCentralWidget(tabs);
//setCentralWidget(block_editor = new CBlockEditorTab(this));
connect(block_editor, SIGNAL(statusMessage(QString, int)), statusBar(), SLOT(showMessage(QString, int)));
m_undo = new QAction(this);
m_redo = new QAction(this);
addAction(m_undo);
addAction(m_redo);
m_undo->setShortcut(QKeySequence::Undo);
m_redo->setShortcut(QKeySequence::Redo);
connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(changedTabs(int)));
for(int i = 0; i < tabs->count(); ++i)
GData::getUndoStack(i)->clear();
changedTabs(tabs->currentIndex()); // init tab
QMenuBar* menubar = new QMenuBar();
QMenu* file_menu = menubar->addMenu("&File");
QAction* save_action = file_menu->addAction("&Save");
save_action->setEnabled(false);
setMenuBar(menubar);
connect(save_action, SIGNAL(triggered()), this, SLOT(saveFile()));
}
示例4: toggleDiffView
void RevsView::toggleDiffView() {
QStackedWidget* s = tab()->stackedPanes;
QTabWidget* t = tab()->tabLogDiff;
bool isTabPage = (s->currentIndex() == 0);
int idx = (isTabPage ? t->currentIndex() : s->currentIndex());
bool old = container->updatesEnabled();
container->setUpdatesEnabled(false);
if (isTabPage)
t->setCurrentIndex(1 - idx);
else
s->setCurrentIndex(3 - idx);
container->setUpdatesEnabled(old);
}
示例5: currentTab
GTUtilsWorkflowDesigner::tab GTUtilsWorkflowDesigner::currentTab(HI::GUITestOpStatus &os) {
QTabWidget *tabs = qobject_cast<QTabWidget*>(GTWidget::findWidget(os, "tabs"));
GT_CHECK_RESULT(NULL != tabs, "tabs widget is not found", algoriths);
return tab(tabs->currentIndex());
}
示例6: QMainWindow
//.........这里部分代码省略.........
toolbar->addSeparator();
toolbar->addWidget(new QLabel(" Leagues: ", this));
toolbar->addActions(QList<QAction*>{filterAL, filterNL, filterFA});
toolbar->addSeparator();
toolbar->addWidget(new QLabel(" Positions: ", this));
toolbar->addActions(QList<QAction*>{filterStarter, filterRelief});
toolbar->addActions(QList<QAction*>{filterC, filter1B, filter2B, filterSS, filter3B, filterOF, filterCI, filterMI, filterDH, filterU});
toolbar->addWidget(spacer);
toolbar->addWidget(new QLabel("Player Search: ", this));
toolbar->addWidget(playerSearch);
toolbar->setFloatable(false);
toolbar->setMovable(false);
QMainWindow::addToolBar(toolbar);
// Helper to adjust filters
auto ToggleFilterGroups = [=](int index)
{
switch (index)
{
case uint32_t(PlayerTableTabs::Hitters):
pitchingFilters->setVisible(false);
hittingFilters->setVisible(true);
break;
case uint32_t(PlayerTableTabs::Pitchers):
pitchingFilters->setVisible(true);
hittingFilters->setVisible(false);
break;
default:
break;
}
};
// Set default filter group
ToggleFilterGroups(hitterPitcherTabs->currentIndex());
//---------------------------------------------------------------------
// Bottom Section
//---------------------------------------------------------------------
// Owner widget
QHBoxLayout* ownersLayout = new QHBoxLayout(this);
ownersLayout->setSizeConstraint(QLayout::SetNoConstraint);
// Owner models
std::vector<OwnerSortFilterProxyModel*> vecOwnerSortFilterProxyModels;
// Owner labels
QList<QLabel*>* pVecOwnerLabels;
pVecOwnerLabels = new QList<QLabel*>();
pVecOwnerLabels->append(new QLabel("--"));
for (auto i = 1u; i <= DraftSettings::Get().OwnerCount; i++) {
pVecOwnerLabels->append(new QLabel(DraftSettings::Get().OwnerNames[i]));
}
// Update label helper
auto UpdateOwnerLabels = [=]() {
for (auto i = 1u; i <= DraftSettings::Get().OwnerCount; i++) {
pVecOwnerLabels->at(i)->setText(DraftSettings::Get().OwnerNames[i]);
}
};
// Initialize
UpdateOwnerLabels();
// Loop owners
for (uint32_t ownerId = 1; ownerId <= DraftSettings::Get().OwnerCount; ownerId++) {
示例7: getCurrentTab
int Tabs::getCurrentTab()
{
QTabWidget *qtabwidget = static_cast<QTabWidget*>(getQWidget());
return qtabwidget->currentIndex();
}
示例8: drv_tabwidget
int drv_tabwidget(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
handle_head* head = (handle_head*)a0;
QTabWidget *self = (QTabWidget*)head->native;
switch (drvid) {
case TABWIDGET_INIT: {
drvNewObj(a0,new QTabWidget);
break;
}
case TABWIDGET_ADDTAB: {
self->addTab(drvGetWidget(a1),drvGetString(a2));
break;
}
case TABWIDGET_CLEAR: {
self->clear();
break;
}
case TABWIDGET_COUNT: {
drvSetInt(a1,self->count());
break;
}
case TABWIDGET_CURRENTINDEX: {
drvSetInt(a1,self->currentIndex());
break;
}
case TABWIDGET_CURRENTWIDGET: {
drvSetHandle(a1,self->currentWidget());
break;
}
case TABWIDGET_SETCURRENTINDEX: {
self->setCurrentIndex(drvGetInt(a1));
break;
}
case TABWIDGET_SETCURRENTWIDGET: {
self->setCurrentWidget(drvGetWidget(a1));
break;
}
case TABWIDGET_INDEXOF: {
drvSetInt(a2,self->indexOf(drvGetWidget(a1)));
break;
}
case TABWIDGET_INSERTTAB: {
self->insertTab(drvGetInt(a1),drvGetWidget(a2),drvGetString(a3));
break;
}
case TABWIDGET_REMOVETAB: {
self->removeTab(drvGetInt(a1));
break;
}
case TABWIDGET_SETTABTEXT: {
self->setTabText(drvGetInt(a1),drvGetString(a2));
break;
}
case TABWIDGET_SETTABTOOLTIP: {
self->setTabToolTip(drvGetInt(a1),drvGetString(a2));
break;
}
case TABWIDGET_TABTEXT: {
drvSetString(a2,self->tabText(drvGetInt(a1)));
break;
}
case TABWIDGET_TABTOOLTIP: {
drvSetString(a2,self->tabToolTip(drvGetInt(a1)));
break;
}
case TABWIDGET_WIDGETOF: {
drvSetHandle(a2,self->widget(drvGetInt(a1)));
break;
}
case TABWIDGET_ONCURRENTCHANGED: {
QObject::connect(self,SIGNAL(currentChanged(int)),drvNewSignal(self,a1,a2),SLOT(call(int)));
break;
}
default:
return 0;
}
return 1;
}
示例9: currentIndex
int TabWidget::currentIndex ( lua_State * L )// const int
{
QTabWidget* obj = ObjectHelper<QTabWidget>::check( L, 1 );
Util::push( L, obj->currentIndex() );
return 1;
}
示例10: makeSelectedTileset
void TilesetItemBox::makeSelectedTileset(int tabIndex)
{
if(lockTilesetBox)
return;
QGraphicsScene *scene = NULL;
LevelEdit *lvlEdit = mw()->activeLvlEditWin();
WorldEdit *wldEdit = mw()->activeWldEditWin();
if((lvlEdit) && (lvlEdit->sceneCreated))
scene = lvlEdit->scene;
else if((wldEdit) && (wldEdit->sceneCreated))
scene = wldEdit->scene;
QTabWidget *cat = ui->TileSetsCategories;
if(!(cat->tabText(tabIndex) == "Custom"))
{
QWidget *current = cat->widget(tabIndex);
if(!current)
return;
QString category = cat->tabText(tabIndex);
#ifdef _DEBUG_
DevConsole::log(QString("Category %1").arg(cat->tabText(cat->currentIndex())), "Debug");
#endif
QScrollArea *currentFrame = getFrameTilesetOfTab(current);
QComboBox *currentCombo = getGroupComboboxOfTab(current);
if(!currentFrame || !currentCombo)
return;
QWidget *scrollWid = currentFrame->widget();
if(!scrollWid)
return;
qDeleteAll(scrollWid->findChildren<QGroupBox *>());
if(scrollWid->layout() == 0)
scrollWid->setLayout(new FlowLayout());
currentFrame->setWidgetResizable(true);
#ifdef _DEBUG_
DevConsole::log(QString("size %1 %2")
.arg(scrollWid->layout()->geometry().width())
.arg(scrollWid->layout()->geometry().height())
, "Debug");
#endif
QString currentGroup = currentCombo->currentText();
for(int i = 0; i < mw()->configs.main_tilesets_grp.size(); i++)
{
if((mw()->configs.main_tilesets_grp[i].groupCat == category)
&& (mw()->configs.main_tilesets_grp[i].groupName == currentGroup)) //category
{
#ifdef _DEBUG_
DevConsole::log(QString("Group %1").arg(configs.main_tilesets_grp[i].groupName), "Debug");
DevConsole::log(QString("Tilesets %1").arg(configs.main_tilesets_grp[i].tilesets.size()), "Debug");
#endif
QStringList l = mw()->configs.main_tilesets_grp[i].tilesets;
foreach(QString s, l)
{
for(int j = 0; j < mw()->configs.main_tilesets.size(); j++)
{
if(s == mw()->configs.main_tilesets[j].fileName)
{
SimpleTileset &s = mw()->configs.main_tilesets[j];
QGroupBox *tilesetNameWrapper = new QGroupBox(s.tileSetName, scrollWid);
((FlowLayout *)scrollWid->layout())->addWidget(tilesetNameWrapper);
QGridLayout *l = new QGridLayout(tilesetNameWrapper);
l->setContentsMargins(4, 4, 4, 4);
l->setSpacing(2);
for(int k = 0; k < s.items.size(); k++)
{
SimpleTilesetItem &item = s.items[k];
TilesetItemButton *tbutton = new TilesetItemButton(&mw()->configs, scene, tilesetNameWrapper);
tbutton->applySize(32, 32);
tbutton->applyItem(s.type, item.id);
l->addWidget(tbutton, item.row, item.col);
connect(tbutton, SIGNAL(clicked(int, ulong)), mw(), SLOT(SwitchPlacingItem(int, ulong)));
}
break;
}
}
}
break;
}
}
示例11: updateCLI
// Update associated CLI widget based on QWidget / QObject data
void QtWidgetObject::updateCLI()
{
// Check treeGuiWidget_ pointer first
if (treeGuiWidget_ == NULL)
{
printf("Internal Error: treeGuiWidget_ pointer is NULL in updateCLI().\n");
return;
}
// Now, check widget type to see what we do
if (treeGuiWidget_->type() == TreeGuiWidget::RadioGroupWidget)
{
QButtonGroup *butgroup = static_cast<QButtonGroup*>(qObject_);
if (!butgroup) printf("Critical Error: Couldn't cast stored qObject_ pointer into QButtonGroup.\n");
else treeGuiWidget_->setProperty(TreeGuiWidgetEvent::ValueProperty, butgroup->checkedId());
}
else if (treeGuiWidget_->type() == TreeGuiWidget::CheckWidget)
{
QCheckBox *check = static_cast<QCheckBox*>(qWidget_);
if (!check) printf("Critical Error: Couldn't cast stored qWidget_ pointer into QCheckBox.\n");
else treeGuiWidget_->setProperty(TreeGuiWidgetEvent::ValueProperty, check->isChecked());
}
else if (treeGuiWidget_->type() == TreeGuiWidget::ComboWidget)
{
QComboBox* combo = static_cast<QComboBox*>(qWidget_);
if (!combo) printf("Critical Error: Couldn't cast stored qWidget_ pointer into QComboBox.\n");
else treeGuiWidget_->setProperty(TreeGuiWidgetEvent::ValueProperty, combo->currentIndex()+1);
}
else if (treeGuiWidget_->type() == TreeGuiWidget::DoubleSpinWidget)
{
QDoubleSpinBox* spin = static_cast<QDoubleSpinBox*>(qWidget_);
if (!spin) printf("Critical Error: Couldn't cast stored qWidget_ pointer into QDoubleSpinBox.\n");
else treeGuiWidget_->setProperty(TreeGuiWidgetEvent::ValueProperty, spin->value());
}
else if (treeGuiWidget_->type() == TreeGuiWidget::EditWidget)
{
QLineEdit *edit = static_cast<QLineEdit*>(qWidget_);
if (!edit) printf("Critical Error: Couldn't cast stored qWidget_ pointer into QTextEdit.\n");
else treeGuiWidget_->setProperty(TreeGuiWidgetEvent::ValueProperty, qPrintable(edit->text()));
}
else if (treeGuiWidget_->type() == TreeGuiWidget::IntegerSpinWidget)
{
QSpinBox *spin = static_cast<QSpinBox*>(qWidget_);
if (!spin) printf("Critical Error: Couldn't cast stored qWidget_ pointer into QSpinBox.\n");
else treeGuiWidget_->setProperty(TreeGuiWidgetEvent::ValueProperty, spin->value());
}
else if (treeGuiWidget_->type() == TreeGuiWidget::LabelWidget)
{
QLabel *label = static_cast<QLabel*>(qWidget_);
if (!label) printf("Critical Error: Couldn't cast stored qWidget_ pointer into QLabel.\n");
}
else if (treeGuiWidget_->type() == TreeGuiWidget::RadioButtonWidget)
{
QRadioButton *button = static_cast<QRadioButton*>(qWidget_);
if (!button) printf("Critical Error: Couldn't cast stored qWidget_ pointer into QRadioButton.\n");
else treeGuiWidget_->setProperty(TreeGuiWidgetEvent::ValueProperty, button->isChecked());
}
else if (treeGuiWidget_->type() == TreeGuiWidget::TabWidget)
{
QTabWidget *tabs = static_cast<QTabWidget*>(qWidget_);
if (!tabs) printf("Critical Error: Couldn't cast stored qWidget_ pointer into QTabWidget.\n");
else treeGuiWidget_->setProperty(TreeGuiWidgetEvent::ValueProperty, tabs->currentIndex()+1);
}
else if (treeGuiWidget_->type() == TreeGuiWidget::StackWidget)
{
QStackedWidget *stack = static_cast<QStackedWidget*>(qWidget_);
if (!stack) printf("Critical Error: Couldn't cast stored qWidget_ pointer into QStackedWidget.\n");
else treeGuiWidget_->setProperty(TreeGuiWidgetEvent::ValueProperty, stack->currentIndex()+1);
}
else printf("Internal Error: No handler written to update CLI controls of this type (%s).\n", TreeGuiWidget::widgetType(treeGuiWidget_->type()));
}