I have a main QWindow and a QFrame (mainF) on it, which contains some other gui elements. I maximize the QFrame as follows, if I click on a button on my QWindow:
mainF->setWindowFlags(Qt::Dialog);
mainF->setWindowState((mainF->windowState(), Qt::WindowFullScreen));
mainF->show();
To minimize the QFrame and place it in its previous position again, I have created a QDialog (m_MinimizeFullscreenGui) with a button on it, which appears immediately on the right top corner of my QFrame if I maximize it:
QRect windowRectangle= m_MinimizeFullscreenGui->geometry();
WindowRectangle.moveTopRight(QApplication::desktop()->availableGeometry().topRight());
m_MinimizeFullscreenGui->setGeometry(windowRectangle);
m_MinimizeFullscreenGui->setFixedSize(30, 30);
m_MinimizeFullscreenGui->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
m_MinimizeFullscreenGui->setWindowState(m_MinimizeFullscreenGui->windowState());
m_MinimizeFullscreenGui->show();
The problem is: I want to have my small dialog window always on the top-level of my maximized QFrame. But if I click at somewhere on my QFrame, the dialog window goes in the background, so the Qt::WindowStaysOnTopHint flag doesn't work.
Where can be my mistake?