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

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 395 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 15 May 2020, 11:55 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
    • J Offline
      J Offline
      johngod
      wrote on 15 May 2020, 12:27 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

      2/2

      15 May 2020, 12:27

      • Login

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