Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. incorrect contextmenu display
Forum Update on Monday, May 27th 2025

incorrect contextmenu display

Scheduled Pinned Locked Moved Unsolved Qt 6
4 Posts 2 Posters 422 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • johnson54J Offline
    johnson54J Offline
    johnson54
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Please provide a minimal compilable example that shows that behaviour.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • johnson54J Offline
        johnson54J Offline
        johnson54
        wrote on last edited by
        #3

        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)

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved