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

    • All
    • 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
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            chehrlic Christian Ehrlicher
            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