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

QToolTip QSS style rule doesn't clip background color as per border-radius property setting

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8, 6.9
    • Widgets: Style Sheets
    • None
    • All

    Description

      Is it by design that a QToolTip widget can only be rendered with a background color as a rectangular box with pointy edges, even if one sets the border-radius property for the widget to, say, 4px?

      I have this QSS style rule, which renders the border with a 4px radius just fine, but the background color (which is inherited from its parent QLineEdit widget) does not clip to the border radius, so there appear triangle-like artifacts at the 4 edges of the tooltip widget, which as a whole looks really ugly.

      QToolTip {
        border: 1px solid #386b6b;
        border-radius: 4px;
        font-size: 15px;
        font-weight: bold;
      }
      

      However, the QLineEdit widget looks sleek with its rounded corners, and its QSS style rule is defined like this:

      QLineEdit {
        background-color: #223a3a;
        border: 1px solid #386b6b;
        border-radius: 4px;
        color: #c5e0e0;
        font-size: 15px;
        font-weight: bold;
        max-width: 600px;
        min-width: 600px;
        qproperty-alignment: AlignCenter;
      }
      

      I tried many things, like adding background-clip and many other possible solutions. I've asked ChatGPT and also Claude AI to help me, but no solution worked. It is strange that setting the border-radius property for the QToolTip QSS style rule is not respected at all.

      So, I gather, this must be a bug (or a deliberate design?) of Qt. I am using PySide6, but this stems from Qt itself, so I am writing a bug report for Qt.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            pedantichacker BoĊĦtjan Mejak
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes