本文整理汇总了C++中QTabWidget::tabText方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabWidget::tabText方法的具体用法?C++ QTabWidget::tabText怎么用?C++ QTabWidget::tabText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTabWidget
的用法示例。
在下文中一共展示了QTabWidget::tabText方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: closeFileRequest
void PluginTextEditor::closeFileRequest(QString file)
{
QTabWidget *tabwidget = IPlatform::getInstance()->getWindowManager()->getWindow()->getTabWidget();
for(int i = 0; i < tabwidget->count(); i++)
{
if(file.compare(tabwidget->tabText(i)) == 0)
{
if(tabwidget->tabText(i).compare(QString(tr("Welcome"))) == 0)
{
QWidget *widget = tabwidget->widget(i);
tabwidget->removeTab(i);
delete widget;
}
else
{
ProjectManager * projectmanager = IPlatform::getInstance()->getProjectManager();
if(projectmanager->getProject())
{
projectmanager->closeFile(file);
}
}
break;
}
}
}
示例2: tabText
QString QTabWidgetProto::tabText(int index) const
{
QTabWidget *item = qscriptvalue_cast<QTabWidget*>(thisObject());
if (item)
return item->tabText(index);
return QString();
}
示例3: tabtabText
QString ScriptToolbox::tabtabText(QWidget * tab, int idx)
{
QTabWidget *tw = qobject_cast<QTabWidget*>(tab);
QString str;
if(tw)
str = tw->tabText(idx);
return str;
}
示例4: closeFile
void PluginTextEditor::closeFile(QString file)
{
QTabWidget *tabwidget = IPlatform::getInstance()->getWindowManager()->getWindow()->getTabWidget();
for(int i = 0; i < tabwidget->count(); i++)
{
if(file.compare(tabwidget->tabText(i)) == 0)
{
QWidget *widget = tabwidget->widget(i);
tabwidget->removeTab(i);
delete widget;
}
}
}
示例5: WriteToLog
QWidget *TilesetItemBox::findTabWidget(const QString &categoryItem)
{
#ifdef _DEBUG_
WriteToLog(QtDebugMsg, "TilesetBox -> find Tab");
#endif
QTabWidget *cat = ui->TileSetsCategories;
for(int i = 0; i < cat->count(); ++i)
{
if(cat->tabText(i) == categoryItem)
return cat->widget(i);
}
return 0;
}
示例6: tabText
int TabWidget::tabText( lua_State * L ) //( int index ) const QString
{
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" );
}
}
//QString* res = ValueInstaller2<QString>::create( L );
//*res = *obj->tabText( index );
Util::push( L, obj->tabText( index ) );
return 1;
}
示例7: clearTilesetGroups
void TilesetItemBox::clearTilesetGroups()
{
if(lockTilesetBox) return;
QTabWidget *cat = ui->TileSetsCategories;
int i = 0;
int f = cat->count();
while(f > i)
{
//include custom tab
if(cat->tabText(i) == "Custom")
{
++i;
continue;
}
QWidget *acCat = cat->widget(i);
cat->removeTab(i);
delete acCat;
f = cat->count();
}
}
示例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: 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;
}
}