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

QTabBar: Setting a smaller font size on the widget makes the vertical alignment of the text a bit off

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • 5.0.0
    • 4.3.1
    • GUI: Look'n'Feel
    • None

    Description

      Setting the font of a QTabBar can make the text not appear perfectly vertically aligned on the QTabBar.

      Reproducible with the following example:

      • In the QTabBar with the reduced, when comparing the space in the label the font size above letter "S" in the Tab label it seems to be have about 1 pixel more in the space above the letter and the edge of the QTabBar compared to the space below the S letter and the edge of the QTabBar. It would be expected that the letters were perfectly vertically centered.

      #include <QtGui>
      #include <QDebug>
      #include <QMacStyle>

      int main(int argc, char *argv[])
      {
      QApplication app(argc, argv);

      QWidget widget;
      QVBoxLayout layout(&widget);

      QTabBar* tabBar = new QTabBar();
      tabBar->addTab("Sequence");
      tabBar->addTab("Map");
      tabBar->addTab("Restriction Sites");

      QFont smallerFont = app.font();
      smallerFont.setPixelSize(11);
      tabBar->setFont(smallerFont);

      tabBar->show();

      QTabBar* tabBar2 = new QTabBar();
      tabBar2->addTab("Sequence");
      tabBar2->addTab("Map");
      tabBar2->addTab("Restriction Sites");
      tabBar2->show();

      layout.addWidget(tabBar);
      layout.addWidget(tabBar2);
      widget.show();

      return app.exec();
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bachewii Jens
            admin Administrator
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes