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

QToolTip does not correctly resize if a CSS style sheet is used and the font size is changed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 4.8.2, 5.6.0
    • GUI: Painting
    • None
    • All platforms.
    • daa39f84996700d2459d8e570ac1b3f2f2cdffd0

      If a widget uses a CSS style sheet (via setStyleSheet) which changes the font size of QToolTip (or of a basse class, e.g. QWidget),
      then a QToolTip shown on that widget will calculate a wrong size, so that the text does not fit.

      The QToolTip code resizes to a wrong size because it uses the QApplication::font("QToolTip") method to detect the font
      instead of using the CSS style. The rendering takes the style sheet into account and thus the text does not fit in the QToolTip anymore.

      The reason for this is that the CSS style is taken over too late, it has to be set on QToolTip label BEFORE resizing, otherwise the style sheet does not affect the resizing.

      I attached a patch which fixes the problem.

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

            kleint Friedemann Kleint
            florianlink Florian Link
            Votes:
            6 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes