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

background of ToolTip template is ignored

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.4.0
    • Quick: Controls 2
    • None
    • macOS, WebAssembly

    Description

      Under Qt 5.15, the following code:

       

      // file ToolTip.qml
      
      import QtQuick 2.15
      import QtQuick.Templates 2.15 as T
      
      T.ToolTip {
          id: control
      
          contentItem: Text {
              id: msg
              text: control.text
          }
      
          background: Rectangle {
              width: msg.implicitWidth
              height: msg.implicitHeight
              color: "red"
          }
      }
      
       // file main.qml
      
      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.15
      
      Window {
          width: 640
          height: 480
          visible: true
      
          Button {
              anchors.fill: parent
              ToolTip.text: "hello"
              ToolTip.visible: pressed
          }
      }
      

      shows, as expected, the tooltip "hello" on a red background.

      Under Qt 6.4, among other visual differences in placement and styling, the red background does not show.

      Removing the version numbers from the import statements does not change anything, nor does importing "QtQuick.Controls.Basic" instead of "QtQuick.Controls" in main.qml.

      How can the background of a ToolTip be set in the template under Qt 6.4?

       

      Attachments

        1. qtbug107684.zip
          2 kB
        2. qtbug107684-fixed.zip
          3 kB
        3. qtbug107684-fixed-v2.zip
          3 kB
        4. tooltip.zip
          7 kB

        Issue Links

          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
              linoleo Lino Schraudolph
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes