Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Emit signal by clicking on the part of the text

Emit signal by clicking on the part of the text

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qml signalsslottextqml linkclick
2 Posts 2 Posters 625 Views
  • 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.
  • D Offline
    D Offline
    d.sukhomlinov
    wrote on last edited by
    #1

    I have an abstract in Text item and I need to emit the signal when I click on some phrase in this text:

    Text {
        id: textFirst
        Layout.fillWidth: true
        width: parent.width
        text: qsTr("Some long part of text and I need to emit signal by clicking on THIS")
        font.pointSize: 14
        wrapMode: Text.Wrap
    }
    

    So, the signal should be emitted when I click on "THIS". The window, where this Text located on is resizable, so I can't calculate the location of "THIS" beforehand. So, does it possible to do it?

    PS I found that it possible to add hyperlinks, but emitting signals is a bit different

    Thanks for your help!

    1 Reply Last reply
    0
    • johngodJ Offline
      johngodJ Offline
      johngod
      wrote on last edited by
      #2

      No need to calculate the position, use linkActivated signal handler https://doc.qt.io/qt-5/qml-qtquick-text.html#linkActivated-signal

      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