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

[REG 6.9.1->6.9.2] Wrong menu icons size with Windows Vista style

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.9.2, 6.9.3, 6.10.0 RC
    • QPA: Windows
    • None
    • Windows

      Menu icons size is too large with Windows Vista style since Qt 6.9.2. PM_SmallIconSize is 16, but icons rendered in 22x22. Bisect showed that behavior has been changed in commit a8d72fe9de8febb381c061de4849b6d03662b2ce in qtbase.

      Small example to demonstrate issue:

      #include <QAction>
      #include <QApplication>
      #include <QFont>
      #include <QIcon>
      #include <QMainWindow>
      #include <QMenu>
      #include <QMenuBar>
      #include <QPainter>
      #include <QPixmap>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QMainWindow w;
          QMenuBar *menuBar = new QMenuBar(&w);
          w.setMenuBar(menuBar);
          QMenu *menu = new QMenu("Menu", menuBar);
          menuBar->addMenu(menu);
      
          QIcon icon;
          for (int i = 16; i <= 48; ++i) {
              QPixmap pixmap(i, i);
              QPainter p(&pixmap);
              p.fillRect(QRect(0, 0, i, i), Qt::black);
              QFont font = p.font();
              font.setPixelSize(i * 2 / 3);
              font.setBold(true);
              p.setFont(font);
              p.setPen(Qt::white);
              p.drawText(QRect(0, 0, i, i), QString::number(i));
              p.end();
              icon.addPixmap(pixmap);
          }
      
          for (int i = 1; i <= 3; ++i) {
              QAction *action = new QAction(QString("Action %1").arg(i), menu);
              action->setIcon(icon);
              menu->addAction(action);
          }
      
          w.show();
          return a.exec();
      }
      

        1. 6.8.3.png
          6.8.3.png
          3 kB
        2. 6.10.0-rc.png
          6.10.0-rc.png
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            wladimir.leuschner Wladimir Leuschner
            p.zhigalov Peter Zhigalov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes