本文整理汇总了C++中QTabWidget::removeTab方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabWidget::removeTab方法的具体用法?C++ QTabWidget::removeTab怎么用?C++ QTabWidget::removeTab使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTabWidget
的用法示例。
在下文中一共展示了QTabWidget::removeTab方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:
void GCF::Components::MainWindow::removeChildWidget(QWidget* parent, QWidget* child)
{
if(!parent || !child)
return;
if(parent == d->workspace)
{
d->workspace->removeTab(d->workspace->indexOf(child));
child->removeEventFilter(this);
}
else
{
QList<QDockWidget*> dockWidgets = d->dockWidgetMap.values();
QDockWidget* dw = qobject_cast<QDockWidget*>(parent);
if(dw && dockWidgets.contains(dw))
{
QTabWidget* tw = qobject_cast<QTabWidget*>(dw->widget());
tw->removeTab(tw->indexOf(child));
if(tw->count())
dw->show();
else
dw->hide();
}
}
}
示例3: 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;
}
}
}
示例4: removeTab
int TabWidget::removeTab ( lua_State * L )// const bool
{
QTabWidget* obj = ObjectHelper<QTabWidget>::check( L, 1 );
int index=0;
if( Util::isNum( L, 2 ) )
{
index = Util::toInt( L, 2 );
}
obj->removeTab(index);
return 0;
}
示例5: 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;
}
}
}
示例6: QActionGroup
EMainWindow::EMainWindow(QWidget *parent)
:QMainWindow(parent), _tabs()
{
_mainUi.setupUi(this);
_currentPainting = 0;
_currentView = 0;
// установка синонимов для объектов QAction. Необходимо для работы макроса SIGNAL
// группа элементов контроля
QAction *actionCreateLine = _mainUi.actionCreateLine;
QAction *actionCreateCircle = _mainUi.actionCreateCircle;
QAction *actionCreateRect = _mainUi.actionCreateRect;
QAction *selectAction = _mainUi.actionSelectTool;
_objCreateGroup = new QActionGroup(this); // пихаем действия в контейнер
_objCreateGroup->addAction(actionCreateLine);
_objCreateGroup->addAction(actionCreateCircle);
_objCreateGroup->addAction(actionCreateRect);
_objCreateGroup->addAction(selectAction);
_objCreateGroup->setEnabled(false);
// группа действий меню Файл
QAction *actionNew = _mainUi.actionNew;
QAction *actionExit = _mainUi.actionExit;
// группа действий меню Вид
QAction *actionAxis = _mainUi.actionAxis;
QTabWidget *tabWidget = _mainUi.tabWidget; // присоединяем действия к слотам
//createPainting();
tabWidget->removeTab(0);
Q_ASSERT(connect(actionExit, SIGNAL(triggered()), qApp, SLOT(quit())));
Q_ASSERT(connect(actionCreateLine, SIGNAL(triggered()), this, SLOT(setCreateLine())));
Q_ASSERT(connect(actionCreateCircle, SIGNAL(triggered()), this, SLOT(setCreateCircle())));
Q_ASSERT(connect(actionCreateRect, SIGNAL(triggered()), this, SLOT(setCreateRect())));
Q_ASSERT(connect(selectAction, SIGNAL(triggered()), this, SLOT(setSelectTool())));
Q_ASSERT(connect(actionNew, SIGNAL(triggered()), this, SLOT(createPainting())));
Q_ASSERT(connect(actionAxis, SIGNAL(triggered(bool)), this, SLOT(setDrawAxis(bool))));
Q_ASSERT(connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(changePainting(int))));
Q_ASSERT(connect(tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))));
}
示例7: contextMenuEvent
void CGraphicsBank::contextMenuEvent(QContextMenuEvent* event, QTreeView* parent)
{
const QString EXPORT_PNG_TEXT = "Export as PNG";
const QString DELETE_TEXT = "&Delete";
QMenu menu(parent);
menu.addAction(EXPORT_PNG_TEXT);
menu.addSeparator();
menu.addAction(DELETE_TEXT);
QAction* ret = menu.exec(event->globalPos());
if (ret)
{
if (ret->text() == DELETE_TEXT)
{
if (QMessageBox::question(parent, "Delete Source", "Are you sure you want to delete " + caption(),
QMessageBox::Yes, QMessageBox::No) != QMessageBox::Yes)
{
return;
}
if (m_editor)
{
QTabWidget* tabWidget = (QTabWidget*)this->m_editor->parentWidget()->parentWidget();
tabWidget->removeTab(tabWidget->indexOf(m_editor));
}
// TODO: Fix this logic so the memory doesn't get lost.
nesicideProject->getProject()->getGraphicsBanks()->removeChild(this);
nesicideProject->getProject()->getGraphicsBanks()->getGraphicsBanks().removeAll(this);
//((CProjectTreeViewModel*)parent->model())->layoutChangedEvent();
}
else if (ret->text() == EXPORT_PNG_TEXT)
{
exportAsPNG();
}
}
}
示例8: 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();
}
}
示例9: tabRemoveTab
void ScriptToolbox::tabRemoveTab(QWidget * tab, int idx)
{
QTabWidget *tw = qobject_cast<QTabWidget*>(tab);
if(tw)
tw->removeTab(idx);
}
示例10: RebuildEditView
void AvatarEditor::RebuildEditView()
{
if (!avatar_widget_)
return;
// Activate/deactivate export button based on whether export currently supported
QPushButton *button = avatar_widget_->findChild<QPushButton *>("but_export");
if (button)
button->setEnabled(rexlogicmodule_->GetAvatarHandler()->AvatarExportSupported());
QWidget* mat_panel = avatar_widget_->findChild<QWidget *>("panel_materials");
QWidget* attachment_panel = avatar_widget_->findChild<QWidget *>("panel_attachments");
if (!mat_panel || !attachment_panel)
return;
Scene::EntityPtr entity = rexlogicmodule_->GetAvatarHandler()->GetUserAvatar();
if (!entity)
return;
EC_AvatarAppearance* appearance = entity->GetComponent<EC_AvatarAppearance>().get();
if (!appearance)
return;
int width = 308-10;
int tab_width = 302-10;
int itemheight = 20;
// Materials
ClearPanel(mat_panel);
const AvatarMaterialVector& materials = appearance->GetMaterials();
mat_panel->resize(width, itemheight * (materials.size() + 1));
for (uint y = 0; y < materials.size(); ++y)
{
QPushButton* button = new QPushButton("Change", mat_panel);
button->setObjectName(QString::fromStdString(ToString<int>(y))); // Material index
button->resize(50, 20);
button->move(width - 50, y*itemheight);
button->show();
QObject::connect(button, SIGNAL(clicked()), this, SLOT(ChangeTexture()));
// If there's a texture name, use it, because it is probably more understandable than material name
std::string texname = materials[y].asset_.name_;
if (materials[y].textures_.size())
texname = materials[y].textures_[0].name_;
QLabel* label = new QLabel(QString::fromStdString(texname), mat_panel);
label->resize(200,20);
label->move(0, y*itemheight);
label->show();
}
// Attachments
ClearPanel(attachment_panel);
const AvatarAttachmentVector& attachments = appearance->GetAttachments();
attachment_panel->resize(width, itemheight * (attachments.size() + 1));
for (uint y = 0; y < attachments.size(); ++y)
{
QPushButton* button = new QPushButton("Remove", attachment_panel);
button->setObjectName(QString::fromStdString(ToString<int>(y))); // Attachment index
button->resize(50, 20);
button->move(width - 50, y*itemheight);
button->show();
QObject::connect(button, SIGNAL(clicked()), this, SLOT(RemoveAttachment()));
std::string attachment_name = attachments[y].name_;
// Strip away .xml from the attachment name for slightly nicer display
std::size_t pos = attachment_name.find(".xml");
if (pos != std::string::npos)
attachment_name = attachment_name.substr(0, pos);
QLabel* label = new QLabel(QString::fromStdString(attachment_name), attachment_panel);
label->resize(200,20);
label->move(0, y*itemheight);
label->show();
}
// Modifiers
QTabWidget* tabs = avatar_widget_->findChild<QTabWidget *>("tab_appearance");
if (!tabs)
return;
for (;;)
{
QWidget* tab = tabs->widget(0);
if (!tab)
break;
tabs->removeTab(0);
delete tab;
}
const MasterModifierVector& master_modifiers = appearance->GetMasterModifiers();
// If no master modifiers, show the individual morph/bone controls
if (!master_modifiers.size())
{
QWidget* morph_panel = GetOrCreateTabScrollArea(tabs, "Morphs");
QWidget* bone_panel = GetOrCreateTabScrollArea(tabs, "Bones");
if (!morph_panel || !bone_panel)
return;
//.........这里部分代码省略.........
示例11: removeTab
void QTabWidgetProto::removeTab(int index)
{
QTabWidget *item = qscriptvalue_cast<QTabWidget*>(thisObject());
if (item)
item->removeTab(index);
}
示例12: 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;
}