How can I access the modified QLabel?

I create an editable QLabel like this:

QLabel foo("some text"); foo.setTextInteractionFlags(Qt::TextEditorInteraction); 

I can click the text and change it, and the changed text should be somewhere in the buffer, but even after examining the data fields in Qt Creator, I don’t see where it is:

 QString notmodified = foo.text(); // only returns the original text 

Is this a modified text somewhere that I can access?

EDIT: I think using something else is really easier, but I'm still interested in knowing the answer to my question.

EDIT: OK, that was a week. "Answered".

+4
source share
2 answers

I would say that even if you can set this flag to QLabel ( Qt::TextInteractionFlag used by other widgets than QLabel ), it is not intended for editing.

Why don't you use QLineEdit ?

+5
source

For an editable text field, you have a good choice: QLineEdit or QTextEdit. Use one of these widgets. QLabel is for marking purposes only.

0
source

All Articles