Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-106349

QMenu wrong position in system tray when switching from small to large screen

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.3.1
    • GUI: High-DPI
    • None
    • Windows

    Description

      Hello,

      I have noticed that when switching from a small laptop screen to an external monitor with higher resolution the QMenu position on a QSystemTrayIcon is not respected.

      This only happens if I launch it on the small laptop screen and then switch, launching it on the monitor will result in the QMenu having the correct position even after switching between screens.

       

      There was one previously reported problem around this in Qt 5.9, that has since been marked as resolved: QTBUG-63006

       

      Please see below code example that causes the problem on my laptop.

      #include <QtWidgets/QApplication>
      #include <QtGui/QIcon>
      #include <QtWidgets/QSystemTrayIcon>
      #include <QtWidgets/QMenu>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
          
          QMenu* menu1 = new QMenu();    
          QIcon trayIconIcon("iconPath");
          QSystemTrayIcon *trayIcon = new QSystemTrayIcon(trayIconIcon);
          
          menu1->addAction("Test");
          trayIcon->setContextMenu(menu1);
          trayIcon->setVisible(true);
      
          return app.exec();
      }

      Attachments

        1. hlFkWtN3G0.png
          hlFkWtN3G0.png
          1 kB
        2. Qtdiag_output.txt
          7 kB
        3. yVy46LX3Sk.png
          yVy46LX3Sk.png
          16 kB

        Activity

          People

            sorvig Morten Sørvig
            andreas_ Andreas Johnsson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: