How to make a label mouse selectable
Hi,
Is it possible to make a label mouse selectable? In other words what I want is be able to copy the text in a label.
If yes, can someone be so kind and show me how to do this, I read the QLable class reference but I cannot figure it out.
Thanks a lot
4 replies
See setTextInteractionFlags [qt-project.org], especially Qt::TextSelectableByMouse.
It worked.
ui->label_TotalParts->setTextInteractionFlags(Qt::TextSelectableByMouse);
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 must log in to post a reply. Not a member yet? Register here!


