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. QLabel signal linkHovered
Forum Updated to NodeBB v4.3 + New Features

QLabel signal linkHovered

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 2 Posters 811 Views 1 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 SPlatten
    #1

    I'm connecting to both linkActivated and linkHovered. When I move the mouse over a label that has a link I see the debug output from the slot connected to the linkHovered signal once and once only, if I move out of the label and away, then hover over the label again I do not see any further signals raised or at least I don't see any debug output from the linkHovered slot.

    My slot is very simple it only contains a single debug output message. Is this behaviour a bug or is this how it currently works?

    I would expect there to be another signal to fire when moving out of the label but it appears not.

    This is my code which connects both linkActivated and linkHovered signals to slots in script:

            if ( strSignal.compare(clsQtLabel::mscszQtSignalLinkActivated) == 0 ) {
                cnSignal = QObject::connect(this
                                ,&clsQtLabel::linkActivated
                                ,[pobjScriptEng, strCall, strFile, strScript]() {
                                    QString strScriptWithCall = static_cast<QString>(strScript)
                                                              + static_cast<QString>(strCall) + "();";
                                    pobjScriptEng->evaluate(strScriptWithCall);
                                });
            } else if ( strSignal.compare(clsQtLabel::mscszQtSignalLinkHovered) == 0 ) {
                cnSignal = QObject::connect(this
                                ,&clsQtLabel::linkHovered
                                ,[pobjScriptEng, strCall, strFile, strScript]() {
                                    QString strScriptWithCall = static_cast<QString>(strScript)
                                                              + static_cast<QString>(strCall) + "();";
                                    pobjScriptEng->evaluate(strScriptWithCall);
                                });
            }
    

    I have break points in handlers on lines:

        pobjScriptEng->evaluate(strScriptWithCall);
    

    The parameter strScriptWithCall contains the full script ending with a call to the slot, I've verified that its content is correct.

    Another stranger problem is that although the "linkActivated" signal launches an instance of a browser with the link address correct and showing in the browser, the slot I've attached to the signal is not being called.

    Kind Regards,
    Sy

    J.HilkJ 1 Reply Last reply
    0
    • SPlattenS SPlatten

      I'm connecting to both linkActivated and linkHovered. When I move the mouse over a label that has a link I see the debug output from the slot connected to the linkHovered signal once and once only, if I move out of the label and away, then hover over the label again I do not see any further signals raised or at least I don't see any debug output from the linkHovered slot.

      My slot is very simple it only contains a single debug output message. Is this behaviour a bug or is this how it currently works?

      I would expect there to be another signal to fire when moving out of the label but it appears not.

      This is my code which connects both linkActivated and linkHovered signals to slots in script:

              if ( strSignal.compare(clsQtLabel::mscszQtSignalLinkActivated) == 0 ) {
                  cnSignal = QObject::connect(this
                                  ,&clsQtLabel::linkActivated
                                  ,[pobjScriptEng, strCall, strFile, strScript]() {
                                      QString strScriptWithCall = static_cast<QString>(strScript)
                                                                + static_cast<QString>(strCall) + "();";
                                      pobjScriptEng->evaluate(strScriptWithCall);
                                  });
              } else if ( strSignal.compare(clsQtLabel::mscszQtSignalLinkHovered) == 0 ) {
                  cnSignal = QObject::connect(this
                                  ,&clsQtLabel::linkHovered
                                  ,[pobjScriptEng, strCall, strFile, strScript]() {
                                      QString strScriptWithCall = static_cast<QString>(strScript)
                                                                + static_cast<QString>(strCall) + "();";
                                      pobjScriptEng->evaluate(strScriptWithCall);
                                  });
              }
      

      I have break points in handlers on lines:

          pobjScriptEng->evaluate(strScriptWithCall);
      

      The parameter strScriptWithCall contains the full script ending with a call to the slot, I've verified that its content is correct.

      Another stranger problem is that although the "linkActivated" signal launches an instance of a browser with the link address correct and showing in the browser, the slot I've attached to the signal is not being called.

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #2

      @SPlatten well looking at the source code

              if (interactionFlags & Qt::LinksAccessibleByMouse) {
      	        QString anchor = q->anchorAt(mousePos);
      	        if (anchor != highlightedAnchor) {
      	                highlightedAnchor = anchor;
                              emit q->linkHovered(anchor);
                      }
              }
      

      seems like the signal will fire again, when you hover over an other link but not when you hover again over the same link.

      Looks like intended behavior


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

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

        @J-Hilk , Thank you, but surely if this is intended behaviour then its wrong, as this isn't how events like hover work in other environments including browsers. When the mouse moves over an element the hover should fire, when it moves out it should be cleared and then moving onto it again should trigger another signal.

        Is there anyway for me to trigger some kind of reset that will allow it to trigger again?

        Kind Regards,
        Sy

        J.HilkJ 1 Reply Last reply
        0
        • SPlattenS SPlatten

          @J-Hilk , Thank you, but surely if this is intended behaviour then its wrong, as this isn't how events like hover work in other environments including browsers. When the mouse moves over an element the hover should fire, when it moves out it should be cleared and then moving onto it again should trigger another signal.

          Is there anyway for me to trigger some kind of reset that will allow it to trigger again?

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by J.Hilk
          #4

          @SPlatten will this is part of the QWidgetTextControlPrivate class, therefore not accessible from outside.

          You can change the source code and compile the widgets module, that should work.

          Also reporting this to https://bugreports.qt.io is probably a good idea too


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

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

            @J-Hilk , Thanks again, I'll raise it now.

            Kind Regards,
            Sy

            J.HilkJ 1 Reply Last reply
            0
            • SPlattenS SPlatten

              @J-Hilk , Thanks again, I'll raise it now.

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #6

              @SPlatten When you do, post a link here so we/others can follow the ticket as well


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

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

                @J-Hilk , done, I'm not sure if what I've supplied is adequate?

                https://bugreports.qt.io/browse/QTBUG-85246

                Kind Regards,
                Sy

                J.HilkJ 1 Reply Last reply
                0
                • SPlattenS SPlatten

                  @J-Hilk , done, I'm not sure if what I've supplied is adequate?

                  https://bugreports.qt.io/browse/QTBUG-85246

                  J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #8

                  @SPlatten sounds good enough,

                  If you have/can, supply a minimal example, usually gets a long way and can speed up the process :D


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

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

                    @J-Hilk , done.

                    Kind Regards,
                    Sy

                    1 Reply Last reply
                    1

                    • Login

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