Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QML ToolTip placement
Qt 6.11 is out! See what's new in the release blog

QML ToolTip placement

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 3.9k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #1

    I'm adding tool tips to the QML:

      Text {
        id:hdgValue
          text: heading ? setPrecision (rad2Deg (heading), 4) : "N/A"
          verticalAlignment: Text.AlignTop
          horizontalAlignment: Text.AlignLeft
          font.pointSize: parent.width < 150 ? 16 : 22
          width: parent.width
          color: heading ? theme.accent : theme.caution
          ToolTip.visible: ma.containsMouse
          ToolTip.text: "Heading Tooltip"
          MouseArea {
               id: ma
               anchors.fill: parent
               hoverEnabled: true
           }
      }
    

    The tool tip appears approximately 200 pixels to the right of the data item, why? Can I specify that the tool tip should appear directly under the data item it relates too ?

    Kind Regards,
    Sy

    A 1 Reply Last reply
    0
    • SPlattenS SPlatten

      I'm adding tool tips to the QML:

        Text {
          id:hdgValue
            text: heading ? setPrecision (rad2Deg (heading), 4) : "N/A"
            verticalAlignment: Text.AlignTop
            horizontalAlignment: Text.AlignLeft
            font.pointSize: parent.width < 150 ? 16 : 22
            width: parent.width
            color: heading ? theme.accent : theme.caution
            ToolTip.visible: ma.containsMouse
            ToolTip.text: "Heading Tooltip"
            MouseArea {
                 id: ma
                 anchors.fill: parent
                 hoverEnabled: true
             }
        }
      

      The tool tip appears approximately 200 pixels to the right of the data item, why? Can I specify that the tool tip should appear directly under the data item it relates too ?

      A Offline
      A Offline
      Asperamanca
      wrote on last edited by
      #2

      @SPlatten
      I think you should be able to use the mechanisms described under popup positioning for tooltips also.

      SPlattenS 1 Reply Last reply
      0
      • A Asperamanca

        @SPlatten
        I think you should be able to use the mechanisms described under popup positioning for tooltips also.

        SPlattenS Offline
        SPlattenS Offline
        SPlatten
        wrote on last edited by
        #3

        @Asperamanca , thank you, surely I can't be the only one experiencing this, isn't there a way to do this correctly with tooltips ?

        Kind Regards,
        Sy

        1 Reply Last reply
        0
        • SPlattenS Offline
          SPlattenS Offline
          SPlatten
          wrote on last edited by
          #4

          Can anyone offer any assistance on this as the tooltip seems to be quite off the required position?

          Kind Regards,
          Sy

          1 Reply Last reply
          0
          • JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by
            #5

            As Asperamanca pointed out, ToolTip is a subclass of Popup. Maybe try to create an instance of tooltip and set x and y to it.

            SPlattenS 1 Reply Last reply
            1
            • JoeCFDJ JoeCFD

              As Asperamanca pointed out, ToolTip is a subclass of Popup. Maybe try to create an instance of tooltip and set x and y to it.

              SPlattenS Offline
              SPlattenS Offline
              SPlatten
              wrote on last edited by
              #6

              @JoeCFD , thank you, actually I don't see any mention in his post of it being a sub-class, however now I know that I will take another look.

              Kind Regards,
              Sy

              jsulmJ 1 Reply Last reply
              0
              • SPlattenS SPlatten

                @JoeCFD , thank you, actually I don't see any mention in his post of it being a sub-class, however now I know that I will take another look.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @SPlatten https://doc.qt.io/qt-6/qml-qtquick-controls2-tooltip.html : "Inherits: Popup"

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved