我在主QMainWindow中使用一个QMainWindow作为子窗口,从而获得另一个可用于可停靠小部件(QDockWidget)的区域。根据以下帖子,这是可以的,并且对我来说也完美地运作。
现在我还想能够浮动此子
有什么解决办法吗?
相关链接:a,b。
- https://qt-project.org/forums/viewthread/17519
- http://www.qtcentre.org/threads/12569-QMainWindow-as-a-child-of-QMainWindow
QMainWindow
作为普通小部件进行设置,我取消了窗口标志,这个技巧在上面的帖子中提到过。现在我还想能够浮动此子
QMainWindow
和其所有停靠小部件。换句话说,我想撤销“将其设置为普通小部件”的步骤。不幸的是,这并不起作用。它已经从主窗口中消失,但根本看不见。有什么解决办法吗?
// this is the child QMainWindow
if (this->m_infoAreaFloating)
{
// this should give me a floating window besides the main window
this->setWindowFlags(Qt::Desktop);
this->show();
}
else
{
// make this compliant as QWidget
this->setWindowFlags(this->windowFlags() & ~Qt::Window);
}
相关链接:a,b。