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

QPushButton's text is clipped when adding an icon and set a QMenu to it

    XMLWordPrintable

Details

    • All, Windows
    • b002c21087e8bfafbcf967d43253bf861e94e6c8 (qt/qtbase/dev)

    Description

      Just as the title says, when a push-button has both icon and menu the end of it's text is clipped (not visible). and the auto-hide of menu indicator is not working.

      Following code:

       

      #include <QtWidgets>
      
      int main(int argc, char *argv[]) 
      { 
        QApplication a(argc, argv); 
        auto popupButton = new QPushButton(); 
        popupButton->setText("Popup Button With Menu and Icon"); 
        popupButton->setIcon(QPixmap(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png"))); 
        auto menu = new QMenu(); 
        menu->addAction("&First Item"); 
        menu->addAction("&Second Item"); 
        popupButton->setMenu(menu); 
        auto popupButton2 = new QPushButton();
        popupButton2->setText("Popup Button With Menu and Icon");
        popupButton2->setIcon(QPixmap(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png")));
        auto dlg = new QDialog;
        auto *layout = new QHBoxLayout(dlg);
        layout->addWidget(popupButton);
        layout->addWidget(popupButton2);
        layout->addSpacerItem(new QSpacerItem(20,20,QSizePolicy::Expanding, QSizePolicy::Preferred)) ; 
        dlg->show() ;
        return a.exec();
      }

       

      Attachments

        1. designer-view.png
          designer-view.png
          7 kB
        2. qtbug_89619_linux.png
          qtbug_89619_linux.png
          30 kB
        3. qtbug_89619_windows_fixed.png
          qtbug_89619_windows_fixed.png
          5 kB
        4. qtbug_89619_windows_without_fix.png
          qtbug_89619_windows_without_fix.png
          4 kB
        5. qtbug89619.zip
          1 kB
        6. runtime view.png
          runtime view.png
          7 kB
        7. runtime-view-2.png
          runtime-view-2.png
          7 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            chehrlic Christian Ehrlicher
            anbu Ahmed Bedeer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes