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

QFont::resolve_mask doesn't get set properly on font returned by QFont::resolve()

    XMLWordPrintable

Details

    • Linux/X11, macOS, Windows
    • e823c351c6226765ccfe66e2ee93a2797dcc9721 (qt/qtbase/5.12)

    Description

      QFont QFont::resolve(const QFont &other) const

      The above method neglects to set the returned font's resolve_mask to QFont::AllPropertiesResolved despite having resolved the font.

      We found this while trying to work around an issue with font propagation down a widget hierarchy when one of the widgets in the middle of the hierarchy was set to use a stylesheet (and thus interrupted normal font propagation). We wrote a FontPropagator object event filter which maintains the propagation by trying to take the parent widget's font() and setting it to the child widget via QWidget::setFont. We discovered the parent font (which itself got set via normal propagation from its parent) had resolved_mask set to "0" due to this defect, which in turn cause an incorrect "resolve" attempt (and thus resolving to QApplication::font(), which is wrong) when calling QWidget::setFont() on the child.

      Suggested fix is to always set "font.resolve_mask = QFont::AllPropertiesResolved;" following the call to "font.d->resolve(resolve_mask, other.d.data());". This resolved the issue on our end.

      Attachments

        1. qtbug39560.zip
          0.8 kB
        2. qtbug39560-2.zip
          2 kB

        Issue Links

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

          Activity

            People

              allan.jensen Allan Sandfeld Jensen
              kkelly@tableausoftware.com Keith F. Kelly
              Votes:
              2 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes