Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.4.0
-
None
-
-
a39c5321bd812e3ce820fabd6a97eaf8a6c3d01c
Description
If we set an menu active action (QMenu::setActiveAction) to an item which is a submenu and then call QMenu::show then the submenu will be shown in the wrong position.
It happens only on Mac.
here is an example or you can modify the tst_qmenu::activeSubMenuPosition to call show() instead of popup()
Test case main.cpp to reproduce
===============================
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel lab("test");
lab.show();
QAction *tmp = 0;
QMenu *sub = new QMenu("Submenu", &lab);
sub->addAction("Sub-Item1");
QAction *tmp2 = sub->addAction("Sub-Item2");
QMenu *main = new QMenu("Menu-Title", &lab);
(void)main->addAction("Item 1");
QAction *ac2 = main->addMenu(sub);
tmp = main->addAction("Item 3");
(void)main->addAction("Item 4");
tmp = ac2;
main->setActiveAction(tmp);
sub->setActiveAction(tmp2);
//main->move(QPoint(500,500)); // this fixes the problem.
main->show();
return app.exec();
}