View Full Version : how to set QLineEdit as not selectable?

21st July 2010, 12:44
I'm using Qt Designer to create some forms and i have one QLineEdit field whiche i would like it to be not selectable.
could anyone help me??
thanks so much

21st July 2010, 12:56
What do you mean by not selectable?

Maybe you need some other widget (i saw in another topic, that you want a not editable QLineEdit) if you tell us what you are trying to achieve, maybe we can give better advices.

21st July 2010, 13:30
If you mean text selection: reimp mouse press/move event and ignore it.

21st July 2010, 13:52
yeah, i wanted to mean, disabling to select the text inside with the mouse. i should reimplement press/move events.
thanks everybody

6th July 2018, 19:50
I know that the thread is old but it still appears in Google.

So, I used

self.lineEdit.selectionChanged.connect(lambda: self.lineEdit.setSelection(0, 0))

Uwe Yashwanth
9th July 2018, 09:31
You can use a QLabel if you don't want people to edit your text. A line edit is used for taking input.
If you want to it to be editable only at certain times, you can just update the label .