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

background of ToolTip template is ignored

XMLWordPrintable

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

      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?

       

        1. qtbug107684.zip
          2 kB
          Mitch Curtis
        2. qtbug107684-fixed.zip
          3 kB
          Mitch Curtis
        3. tooltip.zip
          7 kB
          Lino Schraudolph
        4. qtbug107684-fixed-v2.zip
          3 kB
          Mitch Curtis
        For Gerrit Dashboard: QTBUG-107684
        # Subject Branch Project Status CR V

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            linoleo Lino Schraudolph
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes