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

QML ToolTip overrides given x/y

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.4.3, 6.5.0
    • Quick: Controls 2
    • None
    • Windows 11 22H2 (Build 22621.1555)
    • Windows

    Description

      I use a ToolTip on an Item which can change its content based on its position.
      If the Item with the ToolTip is offset and the tooltip reaches the right/bottom edge, it flips to the left/top.
      I would try to fix it myself, but it seems even values bound to the ToolTip x/y are overriden.

      This can be observed in this example:

      Example code:

      import QtQuick
      import QtQuick.Controls
      
      Window {
          width: 400
          height: 400
          visible: true
          title: qsTr("Example")
      
          MouseArea{
              id: mouseArea
              x: 100
              y: 100
              height: 300
              width: 300
              hoverEnabled: true
              acceptedButtons: Qt.LeftButton
      
              ToolTip{
                  id: toolTip
                  x: mouseArea.mouseX
                  y: mouseArea.mouseY
                  visible: true
                  text:   "ToolTip: " + Math.round( x ) + " / " + Math.round( y ) + "<br>"
                      +   "Mouse: " + Math.round( mouseArea.mouseX ) + " / " + Math.round( mouseArea.mouseY ) + "<br>"
                      +   "____________________"
              }
              Rectangle{
                  anchors.fill: parent
                  color: "lightgreen"
              }
          }
      }
      

      Fun extra fact: This example freezes the app with Qt 6.4.3 if you reach the edges. This was no problem in my actual application or Qt 6.5.0.

      Attachments

        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
              Marscho Marscho
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes