1
我使用QMainWindow
作为子我的主QMainWindow
。通过这个,我得到了另一个可用于可停靠小部件的区域(QDockWidget
)。浮动子QMainWindow(QMainWindow作为主QMainWindow的子部件)
根据以下帖子,这是好的,它也适用于我。
- 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);
}