Emit signal by clicking on the part of the text
Unsolved
QML and Qt Quick
-
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!
-
No need to calculate the position, use linkActivated signal handler https://doc.qt.io/qt-5/qml-qtquick-text.html#linkActivated-signal