Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
6.8.2, 6.8.3
-
None
Description
Menus which have the tearOffEnabled flag have no titlebar anymore when the menu got torn off. There is no way to close the torn off menu or to move it around.
This worked in 6.5.3, but migrating our code to 6.8.2 or 6.8.3 shows the weird behavior.
It looks like somehow the window flags get messed up, see attached flag comparison between 6.5 and 6.8.
Repro code sample:
int main( int argc, char *argv[] ) { QApplication app( argc, argv ); app.setQuitOnLastWindowClosed(true); // Create Top Level MainWindow auto mainWindow = new QMainWindow(); mainWindow->setAttribute(Qt::WA_DeleteOnClose); mainWindow->setWindowTitle(QString("Tear-Off Menu Test - Qt%1.%2.%3").arg(QT_VERSION_MAJOR).arg(QT_VERSION_MINOR).arg(QT_VERSION_PATCH)); // Add menu to main menubar auto testMenu = mainWindow->menuBar()->addMenu("Test Menu"); testMenu->setTearOffEnabled(true); testMenu->addAction("Action 1"); testMenu->addAction("Action 2"); mainWindow->resize(800, 600); mainWindow->show(); /* The issue can also be reproduced by mimicking what QMenu internally does for creating the QTornOffMenu. */ /* auto menuWithTitlebar = new QMenu(); menuWithTitlebar->addAction("Action 1"); menuWithTitlebar->setWindowTitle("Tear-Off Menu"); menuWithTitlebar->setParent(mainWindow, Qt::Window | Qt::Tool); // <- this call doesn't seem to work as in the past menuWithTitlebar->setAttribute(Qt::WA_DeleteOnClose, true); menuWithTitlebar->show(); */ // Run Qt message loop return app.exec(); }