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

Text.StyledText doesn't handle onLinkActivated correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.4.0
    • None

      The following piece of code doesn't work properly:

      import QtQuick 2.6
      import QtQuick.Window 2.2
      
      Window {
          width: 600
          height: 400
          visible: true
      
          Text {
              // Doesn't work
              width: parent.width
              // Works (with any hard-coded number)
      //        width: 800
              text: "<a href=\"http://qt.io\">qt.io</a>"
              horizontalAlignment: Text.AlignHCenter
              onLinkActivated: print("activated")
          }
      }
      

      Text object emit linkActivated signal only if you click on place where text should be with left alignment. With central and right alignment you should click on left of Text item, but not on link itself to activate it.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            mitch_curtis Mitch Curtis
            occash Artyom Shal
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes