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

Icon alignment on QTabWidget - I believe it's supposed to be centered

    XMLWordPrintable

Details

    • 844044f37b84b1700d356e2fe27b5c6a445f88ea

    Description

      If I set an 8x8 pixel icon on a tab in a QTabWidget via QTabWidget::setTabIcon(), it is drawn top left. There doesn't seem to be a way to change this, and I traced the code right through to
      QCommonStyle::drawControl and then QCommonStylePrivate::tabLayout where it has the code:
      *iconRect = QRect(tr.left(), tr.center().y() - tabIconSize.height() / 2,
      tabIconSize.width(), tabIconSize .height());

      Which I believe is trying to draw the icon centered within tr. So I am raising a ticket as I believe that the intention was that it is center aligned but for some reason that is not what's happening.

      This is easily re-creatable using just designer. Create a form, drop on a QTabWidget, put an 8x8 icon on a tab and you'll see it doesn't line up. This seems like it should be configurable from somewhere.

      Attachments

        1. alignment.png
          alignment.png
          7 kB
        2. qtbug_38108.tgz
          8 kB
        3. screen.png
          screen.png
          7 kB
        4. square10.png
          square10.png
          0.3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            chehrlic Christian Ehrlicher
            gemmell Simon Gemmell
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes