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

It's not possible to use href links in a text element which is also selectable

    XMLWordPrintable

Details

    • 8b45ca46095020c495b44d764bb439018a87d22a

    Description

      Considering the use-case of being able to show e.g. a dialog with some text content including a URL, there are no combination of element and property setting / signal which allows this. E.g. a Text element is not selectable, while it does have the linkActivated() signal - while a TextEdit can be read only and selectable, but clicking the link has no effect

      import QtQuick 1.0
      
      Rectangle {
          property string textWithLink: "hello link <a href='http://qt.nokia.com'>to Qt</a>"
          width: 200; height: 200
          Column {
              anchors.fill: parent
      
              Text {
                  text: textWithLink
                  onLinkActivated: {
                      console.log("You pressed "+link)
                  }
              }
              TextInput {
                  text: textWithLink
                  readOnly: true
              }
              TextEdit {
                  text: textWithLink
                  readOnly: true
                  selectByMouse: true
              }
          }
      }
      

      Attachments

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

        Activity

          People

            aalpert-nokia Alan Alpert (closed Nokia identity) (Inactive)
            hhartz Henrik Hartz (closed Nokia identity) (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes