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

QSpinBox, QComboBox visual Clipping / incorrect Size Hint

    XMLWordPrintable

Details

    • Windows

    Description

      QSpinBox seems to calculate an incorrect sizeHint, which can cause visual clipping.

      The problem is especially bad with large font sizes in Windows Vista style.
      It looks like the spin-box sub-control width scales 1:1 with text height and this is not taken into account when calculating the total width. This makes the problem worse the larger the font size.
      Fusion style does not suffer from this problem because the sub-controls are constant width.

      Interestingly, QComboBox seems to suffer from the opposite problem:
      The sub-control is fixed-width but the widget reserves a space proportional to font size. This, in turn, causes clipping with small fonts.

      I attached a small demo form and 2 screenshots in Windows 10 native and fusion style.
      Highlighted in green means no clipping problems; yellow means no visual clipping but insufficient space for the editing cursor (text shifts to the left when editing); red means visual clipping even when not focused.

      One could argue, that the fusion style displays excessive white space. But that's of course much less of a problem than clipping.

      Attachments

        1. fusion.png
          fusion.png
          16 kB
        2. qspinbox_qcombobox_clipping.ui
          5 kB
        3. win10_native.png
          win10_native.png
          16 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tpochep Timur Pocheptsov
            maxxpower Markus Fleischhacker
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes