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

On Windows QPushButtons text gets truncated when an icon and menu are set

    XMLWordPrintable

    Details

    • Platform/s:
      All
    • Commits:
      f9cd8fef5e9062f6bd23d70693f4dfb7e32efc78 (qt/qtbase/5.14)

      Description

      On Windows 7/10, whenever a QPushButton has a QIcon and QMenu set, the text will get truncated. Running the following code example should demonstrate the issue:

       

      from PySide2.QtGui import QIcon
      from PySide2.QtWidgets import QApplication, QPushButton, QMenu, QHBoxLayout, QWidget, QStyle
      app = QApplication([])
      btn = QPushButton('Truncated Text')
      btn.setIcon(QIcon(app.style().standardIcon(QStyle.SP_ArrowUp)))
      btn.setMenu(QMenu(btn))
      lo = QHBoxLayout()
      lo.addStretch()
      lo.addWidget(btn)
      wid = QWidget()
      wid.setLayout(lo)
      wid.show()
      app.exec_()
      

       

       

       

        Attachments

        1. main.cpp
          0.7 kB
          Christian Ehrlicher
        For Gerrit Dashboard: QTBUG-81784
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            chehrlic Christian Ehrlicher
            Reporter:
            abi Abi Bia
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes