Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

incorrect contextmenu display



  • When porting to Qt6.2 in Windows 10, if two monitors have different scaling (eg. one is 100% and the other is 150%) , is cannot show full size of contextmenu in 100% scaling monitor. The contextmenu is constructed by "setContextMenuPolicy(Qt::ActionsContextMenu)". This not happens in Qt 5.15.


  • Lifetime Qt Champion

    Hi,

    Please provide a minimal compilable example that shows that behaviour.



  • Qt 6.2.0 Windows 10 21H1, MSVC 2019 64bit.
    In the center is a QMdiArea, and use BuildContextMenu() to build the contextmenu. My laptop monitor is 150% scaling, and the external monitor is 100% scaling. It is OK in my laptop, but it cannot show full size of the contextmenu in the external monitor(As shown below). If the laptop monitor and the external monitor have same scaling( both are 100% or 150%), It will be all right. But If they are not the same, the one with smaller scaling will go wrong.
    void Demo::BuildContextMenu()
    {
    auto reset_layout_action = new QAction(tr("AutoLayout"));
    auto cascade_action = new QAction(tr("CascadeWindows"));
    auto close_custom_action = new QAction(tr("CloseAllCustomPlots"));
    auto close_all_action = new QAction(tr("CloseAllWindows"));
    ui->mdiArea->addAction(reset_layout_action);
    ui->mdiArea->addAction(cascade_action);
    ui->mdiArea->addAction(close_custom_action);
    ui->mdiArea->addAction(close_all_action);
    ui->mdiArea->setContextMenuPolicy(Qt::ActionsContextMenu);
    }
    ![alt text](b82d494d-8e38-46ae-b166-acd0c416b471-image.png image url)


  • Lifetime Qt Champion

    Looks like a bug in Qt 6.

    You should check the bug report to see if it's something known. If not, then please open a new report providing a minimal compilable example and the information about your setup.


Log in to reply