Solved How to detect text is changed in label ?
-
ui->pLabelMaxLimit->setTextInteractionFlags(Qt::TextEditorInteraction);
Label is editable.How do I detect after text is changed.
-
QLabels are not meant to be editable, what you want is probably a QLineEdit
-
I want to use label.Is it not possible with the label?
Thanks. -
-
@asttekin
this is not possible.
The (internal) QTextControl is only connected with the 2 link signals. -
https://postimg.org/image/5n87ss101/
In normally I can set the label to use the line edit and push buttons.But buttons and linedit taking up places in the window.So I don't want to use them.
I want to change the value directly on the label.Thanks.
-
@asttekin What is the difference between label and line edit? Both need space.
-
@asttekin why not replacing the label with a line edit entirely?
-
@asttekin
Hi
When you use that flag with a Label it does allow to edit text.
However, no signals are emitted so its not possible to know when edit is finished.As the others points out, you should use a lineedit and maybe this signal
http://doc.qt.io/qt-5/qlineedit.html#editingFinishedUser must then press enter to end editing.
-
use textchage()..when you change the text it will shown in qlabel also
-
use textchage()..when you change the text it will shown in qlabel also.
http://doc.qt.io/qt-4.8/qlabel.html#text-prop If you are talking about this, its the slot . If some one connected the lineEdit / some other editable component to the QLabel, then this slot takes the takes the text from the lineEdit to display it on the label, But not from the Label to other component .
Any how, both label and line Edit takes place in the GUI and LineEdit more powerful than the Label in your case. So could you please let us know, what's stopping you to shift to lineEdit from the Label ? -