/* ・ウィンドウ表示を行う ・既に DockWidget に登録済みの場合は、一旦削除を行い表示を行う */ void FormNodeEditorImpl::_showForm(QWidget* pWidget, const QString& rqStr, Qt::DockWidgetAreas allowedDockArea, Qt::DockWidgetArea initDockArea) { int nDockCnt = listDockWidgets.size(); for (int i = 0; i < nDockCnt; i++) { QWidget* pWidgetTmp = listDockWidgets[i]->widget(); if (pWidgetTmp == pWidget) { this->removeDockWidget(listDockWidgets[i]); listDockWidgets[i]->setWidget(NULL); /* [NOTE] 一度、DockWidget化した widget を show() しても表示されない問題が発生した。 その対処として、setParent(NULL) を明示的に行ったところ、show()にて表示できるようになった。 現在の状態が、pWidgetTmp->isVisibleTo(listDockWidgets[i]) にて true の状態であるため、 親値を外す必要があると思われる。 */ pWidgetTmp->setParent(NULL); listDockWidgets.removeAt(i); break; } } if (_isEnableFormDockable) { QDockWidget* pDock = new QDockWidget(rqStr, this); pDock->setWidget(pWidget); pDock->setAllowedAreas(allowedDockArea); addDockWidget(initDockArea, pDock, Qt::Horizontal); pDock->show(); listDockWidgets.push_back(pDock); } else { pWidget->show(); } }
void tst_QDockWidget::task237438_setFloatingCrash() { //should not crash QDockWidget pqdwDock; pqdwDock.setFloating(false); pqdwDock.show(); }
/** * Constructs a DlgDisplayPropertiesImp which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ DlgDisplayPropertiesImp::DlgDisplayPropertiesImp( QWidget* parent, Qt::WindowFlags fl ) : QDialog( parent, fl ) { this->setupUi(this); textLabel1_3->hide(); changePlot->hide(); buttonLineColor->setModal(false); buttonColor->setModal(false); std::vector<Gui::ViewProvider*> views = getSelection(); setDisplayModes(views); fillupMaterials(); setMaterial(views); setColorPlot(views); setShapeColor(views); setLineColor(views); setPointSize(views); setLineWidth(views); setTransparency(views); setLineTransparency(views); // embed this dialog into a dockable widget container Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance(); QDockWidget* dw = pDockMgr->addDockWindow("Display properties", this, Qt::AllDockWidgetAreas); dw->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); dw->setFloating(true); dw->show(); Gui::Selection().Attach(this); this->connectChangedObject = Gui::Application::Instance->signalChangedObject.connect(boost::bind (&DlgDisplayPropertiesImp::slotChangedObject, this, _1, _2)); }
DownloadManager::DownloadManager(QWidget *parent) : QDialog(parent) , m_autoSaver(new AutoSaver(this)) , m_manager(new NetworkAccessManager(this)) , m_iconProvider(0) , m_removePolicy(Never) , ui(new Ui_DownloadManager()) { ui->setupUi(this); ui->downloadsView->setShowGrid(false); ui->downloadsView->verticalHeader()->hide(); ui->downloadsView->horizontalHeader()->hide(); ui->downloadsView->setAlternatingRowColors(true); ui->downloadsView->horizontalHeader()->setStretchLastSection(true); m_model = new DownloadModel(this); ui->downloadsView->setModel(m_model); connect(ui->cleanupButton, SIGNAL(clicked()), this, SLOT(cleanup())); load(); Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance(); QDockWidget* dw = pDockMgr->addDockWindow(QT_TR_NOOP("Download Manager"), this, Qt::BottomDockWidgetArea); dw->setFeatures(QDockWidget::DockWidgetMovable| QDockWidget::DockWidgetFloatable| QDockWidget::DockWidgetClosable); dw->setAttribute(Qt::WA_DeleteOnClose); dw->show(); }
void ExecutingPietLibraries::MakeGLView (std::vector<PietTree> & pt){ if(pt.size() == 0 )return; if(pt[0].isLeaf()) return; pt = pt[0].Nodes(); if(pt.size() < 3) return; int w = pt[0].Val(); int h = pt[1].Val(); QString title = pt[2].toString(); for(int i:range(3)) pt.pop_back(); GLGameWidget* glgw = GLGameWidget::MakeUniqueGLWidget(nullptr); if(glgw == nullptr) return ; glgw->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); glgw->setSize(w,h); QDockWidget* dw = new QDockWidget(nullptr); dw->setFloating(true); dw->setAllowedAreas(Qt::NoDockWidgetArea); dw->connect(dw,&QDockWidget::dockLocationChanged,[=](){ dw->setFloating(true);}); dw->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); dw->setWidget(glgw); dw->setAttribute(Qt::WA_DeleteOnClose); dw->setWindowTitle(title); dw->show(); }
void GCF::Components::MainWindow::addChildWidget(QWidget* parent, QWidget* child) { if(!parent || !child) return; if(parent == d->workspace) { d->workspace->addTab(child, child->windowTitle()); child->installEventFilter(this); child->setAutoFillBackground(true); emit workspaceWidgetActivated(d->workspace->currentWidget()); } 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->addTab(child, child->windowTitle()); child->setAutoFillBackground(true); if(tw->count()) dw->show(); else dw->hide(); } } }
void tst_QDockWidget::setTitleBarWidget() { //test the successive usage of setTitleBarWidget QDockWidget dock; QWidget w, w2; dock.show(); qApp->processEvents(); dock.setTitleBarWidget(&w); qApp->processEvents(); QCOMPARE(w.isVisible(), true); //set another widget as the titlebar widget dock.setTitleBarWidget(&w2); // this used to crash (task 184668) qApp->processEvents(); QCOMPARE(w.isVisible(), false); QCOMPARE(w2.isVisible(), true); //tries to reset the titlebarwidget to none dock.setTitleBarWidget(0); qApp->processEvents(); QCOMPARE(w.isVisible(), false); QCOMPARE(w2.isVisible(), false); }
DockablePlacement::DockablePlacement(QWidget* parent, Qt::WFlags fl) : Placement(parent, fl) { Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance(); QDockWidget* dw = pDockMgr->addDockWindow(QT_TR_NOOP("Placement"), this, Qt::BottomDockWidgetArea); dw->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); dw->show(); }
/** * Constructs a DockEvaluateMeshImp which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ DockEvaluateMeshImp::DockEvaluateMeshImp( QWidget* parent, Qt::WFlags fl ) : DlgEvaluateMeshImp( parent, fl ) { // embed this dialog into a dockable widget container Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance(); // use Qt macro for preparing for translation stuff (but not translating yet) QDockWidget* dw = pDockMgr->addDockWindow("Evaluate & Repair Mesh", this, Qt::RightDockWidgetArea); //dw->setAttribute(Qt::WA_DeleteOnClose); dw->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); dw->show(); }
void BaseWidget::addDock(QWidget *w) { QDockWidget *dock = new QDockWidget(w->windowTitle(),this); dock->setObjectName(w->windowTitle()); addDockWidget(Qt::LeftDockWidgetArea, dock); dock->setWidget(w); dock->setAttribute(Qt::WA_DeleteOnClose); dock->show(); docks.append(dock); connect(dock, SIGNAL(destroyed(QObject*)), this, SLOT(dock_destroyed_cb(QObject *))); }
void XletAgentStatusDashboard::updateQueueConfig(const QString & queue_id) { QDockWidget * dock; FilteredAgentList * filtered_agent_list; if (m_filtered_agent_lists.contains(queue_id)) { dock = this->m_window->findChild<QDockWidget *>(queue_id); filtered_agent_list = this->m_filtered_agent_lists.value(queue_id); } else { dock = this->createDock(queue_id); filtered_agent_list = this->createFilteredAgentList(queue_id); QWidget * agent_list_view = dynamic_cast<QWidget *>(filtered_agent_list->getView()); dock->setWidget(agent_list_view); dock->show(); } dock->setWindowTitle(filtered_agent_list->getQueueName()); }
void tst_QDockWidget::taskQTBUG_1665_closableChanged() { QDockWidget dock; dock.show(); QVERIFY(QTest::qWaitForWindowExposed(&dock)); QDockWidgetLayout *l = qobject_cast<QDockWidgetLayout*>(dock.layout()); if (l && !l->nativeWindowDeco()) QSKIP("this machine doesn't support native dock widget"); QVERIFY(dock.windowFlags() & Qt::WindowCloseButtonHint); //now let's remove the closable attribute dock.setFeatures(dock.features() ^ QDockWidget::DockWidgetClosable); QVERIFY(!(dock.windowFlags() & Qt::WindowCloseButtonHint)); }
void ControlSingleton::showDialog(Gui::TaskView::TaskDialog *dlg) { // only one dialog at a time assert(!ActiveDialog || ActiveDialog==dlg); Gui::DockWnd::CombiView* pcCombiView = qobject_cast<Gui::DockWnd::CombiView*> (Gui::DockWindowManager::instance()->getDockWindow("Combo View")); // should return the pointer to combo view if (pcCombiView) { pcCombiView->showDialog(dlg); // make sure that the combo view is shown QDockWidget* dw = qobject_cast<QDockWidget*>(pcCombiView->parentWidget()); if (dw) { dw->setVisible(true); dw->toggleViewAction()->setVisible(true); dw->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); } if (ActiveDialog == dlg) return; // dialog is already defined ActiveDialog = dlg; connect(dlg, SIGNAL(destroyed()), this, SLOT(closedDialog())); } // not all workbenches have the combo view enabled else if (!_taskPanel) { QDockWidget* dw = new QDockWidget(); dw->setWindowTitle(tr("Task panel")); dw->setFeatures(QDockWidget::DockWidgetMovable); _taskPanel = new Gui::TaskView::TaskView(dw); dw->setWidget(_taskPanel); _taskPanel->showDialog(dlg); getMainWindow()->addDockWidget(Qt::LeftDockWidgetArea, dw); connect(dlg, SIGNAL(destroyed()), dw, SLOT(deleteLater())); // if we have the normal tree view available then just tabify with it QWidget* treeView = Gui::DockWindowManager::instance()->getDockWindow("Tree view"); QDockWidget* par = treeView ? qobject_cast<QDockWidget*>(treeView->parent()) : 0; if (par && par->isVisible()) { getMainWindow()->tabifyDockWidget(par, dw); qApp->processEvents(); // make sure that the task panel is tabified now dw->show(); dw->raise(); } } }
bool ExtendingFrameAttachmentPoint::attach(AttachableFrame* frame) { int index = 0; if ((int)mAttachedFrames.size() >= mMaxAttachmentCount) { LOG_ERROR() << "FrameAttachmentPoint::attach(): cannot attach more than " << mMaxAttachmentCount << " Frame" << (mMaxAttachmentCount > 1 ? "s" : "") << " to Attachment Point " << mName << "."; return false; } //Attach the frame in a way depending on its type if (mType == ATTACHMENT_DOCKWIDGET_CREATOR) { //Create new dockwidget and attach frame to it QDockWidget* newWidget = new QDockWidget(mName, mAttachmentPoint, Qt::WindowMinMaxButtonsHint); mWidgetMap.insert(frame, newWidget); //QLayout* layout = WindowManager::createNeutralLayout(); //newWidget->setLayout(layout); //WindowManager::changeToNeutralLayout(newWidget->layout()); newWidget->setWidget(frame); //newWidget->layout()->addWidget(frame); newWidget->show(); frame->show(); } else { LOG_ERROR() << "ExtendingFrameAttachmentPoint::attach(): unknown Attachment Point."; return false; } //Store the attachment pointer mAttachedFrames.insert(frame->getPluginId(), frame); return true; }
bool FrameAttachmentPoint::attach(AttachableFrame* frame) { QLayout* layout; QWidget* attWidget; QFrame* attFrame; QDockWidget* attDockWidget; QTabWidget* attTabWidget; QMainWindow* attMainWindow; int index = 0; if ((int)mAttachedFrames.size() >= mMaxAttachmentCount) { LOG_ERROR() << "FrameAttachmentPoint::attach(): cannot attach more than " << mMaxAttachmentCount << " Frame" << (mMaxAttachmentCount > 1 ? "s" : "") << " to Attachment Point " << mName << "."; return false; } //Attach the frame in a way depending on its type switch (mType) { case ATTACHMENT_NONE: LOG_ERROR() << "FrameAttachmentPoint::attach(): cannot attach to illegal Attachment Point."; return false; break; case ATTACHMENT_WIDGET: //Attach to Widget with adding a new layout layout = WindowManager::createNeutralLayout(); layout->addWidget(&*frame); frame->show(); attWidget = (dynamic_cast<QWidget*>(mAttachmentPoint)); attWidget->setLayout(layout); attWidget->show(); break; case ATTACHMENT_FRAME: //Attach to Frame with adding a new layout layout = WindowManager::createNeutralLayout(); layout->addWidget(&*frame); frame->show(); attFrame = (dynamic_cast<QFrame*>(mAttachmentPoint)); attFrame->setLayout(layout); attFrame->show(); break; case ATTACHMENT_TABWIDGET: //Attach to TabWidget with adding a new page and (automatically) a layout attTabWidget = (dynamic_cast<QTabWidget*>(mAttachmentPoint)); index = attTabWidget->addTab(&*frame, frame->getCaption()); WindowManager::changeToNeutralLayout(attTabWidget->widget(index)->layout()); break; case ATTACHMENT_DOCKWIDGET: //Attach to DockWidget with adding a new layout layout = WindowManager::createNeutralLayout(); layout->addWidget(&*frame); frame->show(); attDockWidget = (dynamic_cast<QDockWidget*>(mAttachmentPoint)); attDockWidget->setLayout(layout); attDockWidget->show(); break; case ATTACHMENT_MAINWINDOW: //Attach to MainWindow with adding a new layout layout = WindowManager::createNeutralLayout(); layout->addWidget(&*frame); frame->show(); attMainWindow = (dynamic_cast<QMainWindow*>(mAttachmentPoint)); attMainWindow->setLayout(layout); attMainWindow->show(); break; default: LOG_ERROR() << "FrameAttachmentPoint::attach(): unknown Attachment Point."; return false; break; } //Store the attachment pointer mAttachedFrames.insert(frame->getPluginId(), frame); return true; }
void tst_QDockWidget::visibilityChanged() { QMainWindow mw; QDockWidget dw; QSignalSpy spy(&dw, SIGNAL(visibilityChanged(bool))); mw.addDockWidget(Qt::LeftDockWidgetArea, &dw); mw.show(); QCOMPARE(spy.count(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); spy.clear(); dw.hide(); QCOMPARE(spy.count(), 1); QCOMPARE(spy.at(0).at(0).toBool(), false); spy.clear(); dw.hide(); QCOMPARE(spy.count(), 0); dw.show(); QCOMPARE(spy.count(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); spy.clear(); dw.show(); QCOMPARE(spy.count(), 0); QDockWidget dw2; mw.tabifyDockWidget(&dw, &dw2); dw2.show(); dw2.raise(); QCOMPARE(spy.count(), 1); QCOMPARE(spy.at(0).at(0).toBool(), false); spy.clear(); dw2.hide(); qApp->processEvents(); QCOMPARE(spy.count(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); spy.clear(); dw2.show(); dw2.raise(); qApp->processEvents(); QCOMPARE(spy.count(), 1); QCOMPARE(spy.at(0).at(0).toBool(), false); spy.clear(); dw.raise(); QCOMPARE(spy.count(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); spy.clear(); dw.raise(); QCOMPARE(spy.count(), 0); dw2.raise(); QCOMPARE(spy.count(), 1); QCOMPARE(spy.at(0).at(0).toBool(), false); spy.clear(); dw2.raise(); QCOMPARE(spy.count(), 0); mw.addDockWidget(Qt::RightDockWidgetArea, &dw2); QTest::qWait(200); QCOMPARE(spy.count(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); }
void SearchResultWidget::setupUi(QMainWindow *qmw, const QString &iconThemePath) { QDockWidget *searchResultWidget = 0; QString dockTitle = sectionName+":"+phrase; dockTitle.replace("==", tr("Radifs that contain: ")); dockTitle.replace("=", tr("Rhymed by: ")); searchResultWidget = new QDockWidget(dockTitle, qmw); searchResultWidget->setObjectName(QString::fromUtf8("searchResultWidget_new"));//object name for created instance, it renames to 'searchResultWidget_old' //searchResultWidget->setLayoutDirection(Qt::RightToLeft); searchResultWidget->setFeatures(QDockWidget::AllDockWidgetFeatures); searchResultWidget->setAttribute(Qt::WA_DeleteOnClose, true); QGridLayout *searchGridLayout = new QGridLayout(searchResultContents); searchGridLayout->setSpacing(6); searchGridLayout->setContentsMargins(11, 11, 11, 11); searchGridLayout->setObjectName(QString::fromUtf8("searchGridLayout")); QHBoxLayout *horizontalLayout = new QHBoxLayout(); horizontalLayout->setSpacing(6); horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); QGridLayout *searchTableGridLayout = new QGridLayout(); searchTableGridLayout->setSpacing(6); searchTableGridLayout->setObjectName(QString::fromUtf8("gridLayout_3")); //create filter lable and lineEdit and layout QHBoxLayout *filterHorizontalLayout = new QHBoxLayout(); filterHorizontalLayout->setSpacing(6); filterHorizontalLayout->setObjectName(QString::fromUtf8("filterHorizontalLayout")); QLabel *filterLabel = new QLabel(searchResultContents); filterLabel->setObjectName(QString::fromUtf8("filterLabel")); filterLabel->setText(tr("Filter:")); filterHorizontalLayout->addWidget(filterLabel, 0, Qt::AlignRight|Qt::AlignCenter); QString clearIconPath = iconThemePath+"/clear-left.png"; if (searchResultContents->layoutDirection() == Qt::RightToLeft) clearIconPath = iconThemePath+"/clear-right.png"; filterLineEdit = new QSearchLineEdit(searchResultContents, clearIconPath, iconThemePath+"/filter.png"); filterLineEdit->setObjectName(QString::fromUtf8("filterLineEdit")); #if QT_VERSION > 0x040700 filterLineEdit->setPlaceholderText(tr("Filter")); #endif connect(filterLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterResults(const QString &))); filterHorizontalLayout->addWidget(filterLineEdit); QSpacerItem *filterHorizSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); filterHorizontalLayout->addItem(filterHorizSpacer); pageLabel = new QLabel(searchResultContents); pageLabel->setObjectName(QString::fromUtf8("pageLabel")); // filterHorizontalLayout->addWidget(pageLabel, 0, Qt::AlignRight|Qt::AlignCenter); //searchTableGridLayout->addLayout(filterHorizontalLayout, 1, 0, 1, 1); //create QTableWidget searchTable = new QTableWidget(searchResultContents); searchTable->setObjectName(QString::fromUtf8("searchTable")); searchTable->setColumnCount(3); searchTable->setLayoutDirection(Qt::RightToLeft); searchTable->setAlternatingRowColors(true); searchTable->setSelectionMode(QAbstractItemView::NoSelection); searchTable->setSelectionBehavior(QAbstractItemView::SelectRows); searchTable->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); searchTable->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); searchTable->verticalHeader()->setVisible(false); //searchTable->horizontalHeader()->setVisible(false); searchTable->horizontalHeader()->setHighlightSections(false); searchTable->horizontalHeader()->setStretchLastSection(true); //install delagate on third column SaagharItemDelegate *searchDelegate = new SaagharItemDelegate(searchTable, searchTable->style(), phrase); searchTable->setItemDelegateForColumn(2, searchDelegate); connect(this, SIGNAL(searchFiltered(const QString &)), searchDelegate, SLOT(keywordChanged(const QString &)) ); //searchTable->setItemDelegateForColumn(2, new SaagharItemDelegate(searchTable, searchTable->style(), phrase)); searchTableGridLayout->addWidget(searchTable, 0, 0, 1, 1); // QVBoxLayout *searchNavVerticalLayout = new QVBoxLayout(); // searchNavVerticalLayout->setSpacing(6); // searchNavVerticalLayout->setObjectName(QString::fromUtf8("searchNavVerticalLayout")); searchNextPage = new QToolButton(searchResultContents); searchNextPage->setObjectName(QString::fromUtf8("searchNextPage")); searchNextPage->setStyleSheet("QToolButton { border: none; padding: 0px; }"); actSearchNextPage = new QAction(searchResultContents); searchNextPage->setDefaultAction(actSearchNextPage); connect(searchNextPage, SIGNAL(triggered(QAction *)), this, SLOT(searchPageNavigationClicked(QAction *))); searchNextPage->setEnabled(false); searchNextPage->hide(); //searchNavVerticalLayout->addWidget(searchNextPage); searchPreviousPage = new QToolButton(searchResultContents); searchPreviousPage->setObjectName(QString::fromUtf8("searchPreviousPage")); searchPreviousPage->setStyleSheet("QToolButton { border: none; padding: 0px; }"); actSearchPreviousPage = new QAction(searchResultContents); searchPreviousPage->setDefaultAction(actSearchPreviousPage); if (qmw->layoutDirection() == Qt::LeftToRight) { actSearchPreviousPage->setIcon(QIcon(iconThemePath+"/previous.png")); actSearchNextPage->setIcon(QIcon(iconThemePath+"/next.png")); } else { actSearchPreviousPage->setIcon(QIcon(iconThemePath+"/next.png")); actSearchNextPage->setIcon(QIcon(iconThemePath+"/previous.png")); } connect(searchPreviousPage, SIGNAL(triggered(QAction *)), this, SLOT(searchPageNavigationClicked(QAction *))); searchPreviousPage->setEnabled(false); searchPreviousPage->hide(); // searchNavVerticalLayout->addWidget(searchPreviousPage); //QSpacerItem *searchNavVerticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); //searchNavVerticalLayout->addItem(searchNavVerticalSpacer); // if (moreThanOnePage) // horizontalLayout->addLayout(searchNavVerticalLayout); filterHorizontalLayout->addWidget(searchPreviousPage); filterHorizontalLayout->addWidget(searchNextPage); filterHorizontalLayout->addWidget(pageLabel, 0, Qt::AlignRight|Qt::AlignCenter); searchTableGridLayout->addLayout(filterHorizontalLayout, 1, 0, 1, 1); horizontalLayout->addLayout(searchTableGridLayout); searchGridLayout->addLayout(horizontalLayout, 0, 0, 1, 1); /****************************/ QDockWidget *tmpDockWidget = 0; QObjectList mainWindowChildren = qmw->children(); for (int i=0; i < mainWindowChildren.size(); ++i) { tmpDockWidget = qobject_cast<QDockWidget *>(mainWindowChildren.at(i)); if (tmpDockWidget) { if (mainWindowChildren.at(i)->objectName() == "searchResultWidget_old") break; } } /****************************************/ searchResultWidget->setWidget(searchResultContents); qmw->addDockWidget(Qt::LeftDockWidgetArea, searchResultWidget); if (tmpDockWidget && tmpDockWidget->objectName() == "searchResultWidget_old") //there is another search results dock-widget present qmw->tabifyDockWidget(tmpDockWidget, searchResultWidget); searchResultWidget->setObjectName("searchResultWidget_old"); searchResultWidget->show(); searchResultWidget->raise(); }
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(); } } }