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

[Mac OS X] Can't change font for QHeaderView or QHeaderView::section on Mac OSX 10.9

    XMLWordPrintable

Details

    • macOS

    Description

      Cannot set the font for QHeaderView or QHeaderView::section on Mac OSX 10.9 with Qt 5.2.1

      Suggested fix ...
      In file qmacstyle_mac.mm, near line 3398, comment out the line beginning with p->setFont(...

      Current 5.2.1 code:

      p->setFont(qt_app_fonts_hash()->value("QSmallFont", QFont()));   
      proxy()->drawItemText(p, textr, header->textAlignment | Qt::AlignVCenter,    header->palette, header->state & State_Enabled, header->text, QPalette::ButtonText);
      p->restore();
      

      Fixed code:

      //p->setFont(qt_app_fonts_hash()->value("QSmallFont", QFont()));   
      proxy()->drawItemText(p, textr, header->textAlignment | Qt::AlignVCenter, header->palette, header->state & State_Enabled, header->text, QPalette::ButtonText);
      p->restore();
      

      In qstylesheet.cpp, near line 3734, Add || subRule.hasFont to if condition

      Current 5.2.1 code:

      if (!subRule.hasNativeBorder() || !subRule.baseStyleCanDraw() || subRule.hasBackground() || subRule.hasPalette()) {
      ParentStyle::drawControl(ce, opt, p, w);
      return;
      

      Fixed code:

      if (!subRule.hasNativeBorder() || !subRule.baseStyleCanDraw() || subRule.hasBackground() || subRule.hasPalette() || subRule.hasFont) {
      ParentStyle::drawControl(ce, opt, p, w);
      return;
      

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-37153
          # Subject Branch Project Status CR V

          Activity

            People

              dedietri Gabriel de Dietrich (drgvond)
              qmark Mark Elrod
              Votes:
              1 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes