If you're interested in trying some experimental code out, attached is a partial patch. There are a few issues that need to be addressed before this goes in the ParaView repo.
Utkarsh On Tue, Jan 21, 2014 at 11:23 AM, Utkarsh Ayachit <utkarsh.ayac...@kitware.com> wrote: > Sorry, but that's not supported currently. It may not be too > complicated to move a pqTabbedMultiView into a separate Window > however. Feel free to add a feature request to the bug tracker > (http://paraview.org/Bug) > > Utkarsh > > On Mon, Dec 23, 2013 at 9:49 AM, <mathieu.westp...@gmail.com> wrote: >> Hello >> I am looking for a way to display a renderView or a whole pqTabbedMultiView >> into another windows so it can be put in another window >> I still need to be able to see other renderView on the main window. >> >> Is it possible ? >> >> Mathieu >> _______________________________________________ >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Please keep messages on-topic and check the ParaView Wiki at: >> http://paraview.org/Wiki/ParaView >> >> Follow this link to subscribe/unsubscribe: >> http://www.paraview.org/mailman/listinfo/paraview
From 647a867c16809f88bb64efaa45fbf45ea6434f7c Mon Sep 17 00:00:00 2001 From: Utkarsh Ayachit <utkarsh.ayac...@kitware.com> Date: Tue, 21 Jan 2014 11:47:47 -0500 Subject: [PATCH] WIP: Adding logic to popup out a tab widget. Works for the most part except with mutlple layouts are poped out, we cannot determine which is the "active" layout, hence new views always gets assigned to a fixed layout. Change-Id: I93139faffffd1190628ab43c1fc7a1d512cdf06f --- Qt/Components/pqTabbedMultiViewWidget.cxx | 87 ++++++++++++++++++++++------- 1 file changed, 67 insertions(+), 20 deletions(-) diff --git a/Qt/Components/pqTabbedMultiViewWidget.cxx b/Qt/Components/pqTabbedMultiViewWidget.cxx index 9b81672..6f6d2b9 100644 --- a/Qt/Components/pqTabbedMultiViewWidget.cxx +++ b/Qt/Components/pqTabbedMultiViewWidget.cxx @@ -79,6 +79,31 @@ public: { this->tabBar()->setTabButton(index, position, wdg); } + + int addAsTab(pqMultiViewWidget* widget, pqTabbedMultiViewWidget* self) + { + int count = this->count(); + int tab_index = this->insertTab(count-1, widget, QString("Layout #%1").arg(count)); + + QLabel* label = new QLabel(this); + label->setObjectName("popout"); + label->setToolTip("Pop out layout in separate window"); + label->setStatusTip("Pop out layout in separate window"); + label->setPixmap( + this->style()->standardPixmap(QStyle::SP_TitleBarMaxButton)); + this->setTabButton(tab_index, QTabBar::LeftSide, label); + label->installEventFilter(self); + + label = new QLabel(this); + label->setObjectName("close"); + label->setToolTip("Close layout"); + label->setStatusTip("Close layout"); + label->setPixmap( + this->style()->standardPixmap(QStyle::SP_TitleBarCloseButton)); + this->setTabButton(tab_index, QTabBar::RightSide, label); + label->installEventFilter(self); + return tab_index; + } }; } @@ -382,29 +407,12 @@ void pqTabbedMultiViewWidget::createTab(vtkSMViewLayoutProxy* vlayout) SLOT(frameActivated())); int count = this->Internals->TabWidget->count(); - widget->setObjectName(QString("MultiViewWidget%1").arg(count)); widget->setLayoutManager(vlayout); + widget->installEventFilter(this); - int tab_index = this->Internals->TabWidget->insertTab(count-1, widget, - QString("Layout #%1").arg(count)); + int tab_index = this->Internals->TabWidget->addAsTab(widget, this); this->Internals->TabWidget->setCurrentIndex(tab_index); - - //set the close button for all tabs that are closeable. - //if (tab_index != 0 || true) - // initially, we wanted to not allow closing the first tab. However, that - // becomes cumbersome with mutliple servers. So let's experiment with all - // tabs closeable. - { - QLabel* label = new QLabel(this); - label->setObjectName("close"); - label->setPixmap( - this->style()->standardPixmap(QStyle::SP_TitleBarCloseButton)); - this->Internals->TabWidget->setTabButton(tab_index, - QTabBar::RightSide, label); - label->installEventFilter(this); - } - pqServer* server = pqApplicationCore::instance()->getServerManagerModel()->findServer( vlayout->GetSession()); @@ -416,7 +424,8 @@ bool pqTabbedMultiViewWidget::eventFilter(QObject *obj, QEvent *evt) { // filtering events on the QLabel added as the tabButton to the tabbar to // close the tabs. If clicked, we close the tab. - if (evt->type() == QEvent::MouseButtonRelease) + if (evt->type() == QEvent::MouseButtonRelease && + qobject_cast<QLabel*>(obj)) { int index = this->Internals->TabWidget->tabButtonIndex( qobject_cast<QWidget*>(obj), QTabBar::RightSide); @@ -431,6 +440,44 @@ bool pqTabbedMultiViewWidget::eventFilter(QObject *obj, QEvent *evt) END_UNDO_SET(); return true; } + + index = this->Internals->TabWidget->tabButtonIndex( + qobject_cast<QWidget*>(obj), QTabBar::LeftSide); + if (index != -1) + { + // Pop out tab in a separate window. + QWidget* tabPage = this->Internals->TabWidget->widget(index); + if (tabPage) + { + tabPage->hide(); + if (index > 0) + { + // show the previous layout. + this->Internals->TabWidget->setCurrentIndex(index-1); + } + this->Internals->TabWidget->removeTab(index); + tabPage->setWindowFlags(Qt::Widget| + Qt::CustomizeWindowHint| + Qt::WindowTitleHint| + Qt::WindowMaximizeButtonHint| + Qt::WindowCloseButtonHint); + tabPage->setParent(NULL); + tabPage->show(); + } + return true; + } + } + else if (evt->type() == QEvent::Close) + { + // a poped-up widget is being closed, bring it back into the tabbed widget. + pqMultiViewWidget* widget = qobject_cast<pqMultiViewWidget*>(obj); + if (widget) + { + int tab_index = this->Internals->TabWidget->addAsTab(widget, this); + this->Internals->TabWidget->setCurrentIndex(tab_index); + evt->ignore(); + return true; + } } return this->Superclass::eventFilter(obj, evt); -- 1.7.10.4
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview