How to make a label mouse selectable
-
-
See "setTextInteractionFlags":http://qt-project.org/doc/qt-4.8/qlabel.html#textInteractionFlags-prop, especially Qt::TextSelectableByMouse.
-
It worked.
ui->label_TotalParts->setTextInteractionFlags(Qt::TextSelectableByMouse);bq. Or, you use a QLineEdit, and set it to read only. If you want, you can also remove the box so it looks like any QLabel.
I tried this but I didn't like the fact that it looked like an input field, since I couldn't removed the box only the outline (border).
How do you remove the actual box?
Thank you all for your help
-
You can call:
@
theLineEdit->setFrame(false);
@
Then, you could also make it disabled. However, that will make the text look greyed out too, so you'd have to eiter set the palette or a style sheet. All in all, I think the QLabel::setTextInteractionFlags() is an easier and better solution.