Unsolved [QT 5.9.7][Linux X11]Different behavior QMenu on Debug and Release build.
-
I have simple code with QMenu class:
QMenu* menu = new QMenu( mainWindow_ ) menu->setSizePolicy( QSizePolicy::Preferred, menu->sizePolicy().verticalPolicy() ); menu->setFixedWidth( QWIDGETSIZE_MAX ); menu->clear(); QAction* action; action = menu->addAction( tr( "Send report" ) ); action->setObjectName( "sendReport" ); action = menu->addAction( tr( "Show in folder" ) ); action->setObjectName( "showInFolder" ); menu->setSizePolicy( QSizePolicy::Fixed, menu->sizePolicy().verticalPolicy() ); menu->setFixedWidth( rect["width"].toInt() ); QSize screenSize = QApplication::desktop()->screenGeometry().size(); QPoint pos = mapToGlobal( QPoint( rect["x"].toInt(), rect["y"].toInt() + rect["height"].toInt() ) ); menu->popup( pos ); if( pos.y() + menu->height() > screenSize.height() ) { menu->move( mapToGlobal( QPoint( rect["x"].toInt(), rect["y"].toInt() - menu->height() ) ) ); } action = menu->exec(); if( action ) { if( action->objectName() == "sendReport" ) { OnSendReportTriggered(); } else if( action->objectName() == "showInFolder" ) { OnShowInFolderTriggered(); } }
Qt 5.9.7 build from source with Debug and Release variant.
On Debug variant QMenu after call menu->exec() does show correct.
On Release variant QMenu after call menu->exec() always return 0 (menu don't show).Build system on Debian and Ubuntu, try compilers: gcc5, gcc6, gcc7, clang6, clang7.
Please help. What the problem? -
@kas_ru Please don't cross-post. Closing this one as duplicate of https://forum.qt.io/topic/99039/qt-5-9-7-linux-x11-different-behavior-qmenu-on-debug-and-release-build