How to show hints in Qt

I am writing a program using Qt4.5 that displays a book in another language. Therefore, I have a large text and I want to display a different hint for each word (the tooltip will contain parsing information for the corresponding word).

What is the best way to do this?

I have a working browser solution using php and jquery, so I considered porting it somehow to C ++ and displaying it using QWebView, but I have a feeling that there is a better solution ...

[edit] Let me add that I output words from a database, so I have a database that looks like this:

| Id | Word | ParsingInfo                  |
--------------------------------------------
|  0 | The  | Article                      |
|  1 | fish | Noun, Subject etc.           |
|  2 | are  | Verb, 3rd Person Singular... |
|  3 | blue | Adjective...                 |

So, I need to find out what the identifier of a word means, and not just a word, because, for example, the word "this" can be used in different ways or the "wind" has a homograph (The language I work with is Greek, though) .

+3
source share
2 answers

If you use only plain HTML, you can switch to QTextBrowser . Then use the cursorForPosition method to get a QTextCursor from which you can get the text at the current location.

+3
source

From the QToolTip documentation:

QWidget:: setToolTip().

, QHelpEvent QEvent:: ToolTip. widget event() QToolTip:: showText() , . Tooltips .

, , . , , , - .

+5

Source: https://habr.com/ru/post/1724629/


All Articles