[Solved] Disable context menu for particular hyperlink in QMessageBox
-
Hello.
Thank you for answer. I got it. No easy solution here. Ok I will write here some information about my solution and mark thread as "[Solved]".The link which shouldn't work is internal link (link to window of the program), so it's textual representation doesn't have any sense for user.
-
If it doesn't have any sense for the user then why show it that way ?
-
Oops. Looks like I didn't explain it very well. In the code link looks like "<a href='specurl://window2'>window</a>". To make it work I use QDesktopServices::setUrlHandler. So the link itself is useful, but the text "specurl://window2" is useless, because it can't be used in the program or in any other program. This is the reason to disable ability to copy link to clipboard.
-
Didn't you create an url handler for "specurl"?
-
I did it. Url handler is the function, which name is passing to the function QDesktopServices::setUrlHandler. Right? Url handling works fine, I have no problem with it.
-
Ok, I see what misguided me.
Then again, I don't see any easy solution except making your own dialog
-
So be it :)
-
I managed to disable context menu using a trick. Message was splitted into paragraphs. 1st paragraph contains 1st hyperlink, 2nd paragraph contains 2nd hyperlink. Then I manually added 2nd paragraph into QMessageBox's layout as QLabel with disabled context menu.
-
I managed to disable context menu using a trick. Message was splitted into paragraphs. 1st paragraph contains 1st hyperlink, 2nd paragraph contains 2nd hyperlink. Then I manually added 2nd paragraph into QMessageBox's layout as QLabel with disabled context menu.
-
Sounds good, thanks for sharing your idea !
-
Sounds good, thanks for sharing your idea !