First off, I'm using a QStackedWidget and a QTabBar, and not a QTabWidget. I'm not familiar with QTabWidget, but I'm assuming you can use the same idea. Here's how I am doing it:
int indexTab; // the index into the QTabBar you want to remove
QWidget* pWidget;
// the widget in the QStackedWidget that corresponds to indexTab QPoint posGlobal;
// where you want the detached widget's new window to go
m_pStackedWidget->removeWidget(pWidget);
m_pTabBar->removeTab(indexTab);
pWidget->setParent(NULL, Qt::Tool);
pWidget->move(posGlobal);
pWidget->show();
int indexTab; // the index into the QTabBar you want to remove
QWidget* pWidget; // the widget in the QStackedWidget that corresponds to indexTab
QPoint posGlobal; // where you want the detached widget's new window to go
m_pStackedWidget->removeWidget(pWidget);
m_pTabBar->removeTab(indexTab);
pWidget->setParent(NULL, Qt::Tool);
pWidget->move(posGlobal);
pWidget->show();
To copy to clipboard, switch view to plain text mode
Bookmarks