Make a label editable after clicking on it. How?
-
Another solution would be to use a QStackedWidget with a label and a QLIneEdit. Clicking on the label changes the visible widget and ending editing also. You could create a custom widget out of this.
But for me, it also seams strange for a UI, I would normally never click on a label...
-
Thank you guys for all your answers! I will try multiple solutions to see what fits best (and if I can actually implement them :P).
@ZapB: I have a OpenGL application with a dock widget. On the dock widget I have a QListWidget called state list. Each item of the list represents a state of the application. I can add,remove and modify states. So, I want to have a Title for the state list and be able to change/edit it.
Thanks again! -
Thanks for the replies guys. I am sorry I didn't describe my problem very good. This editable label i want to create is for the entire list. (it is the title of the list) Of course when I want to rename a single state I edit the QListWidgetItems. The editable label I want is for the whole thing.
-
Sorry for the delayed response. Oh yeah. I see your point and you are indeed right. Unfortunately, I can not do that at the moment because I will need to change a lot of stuff and I am not the only one working on this project. But I will consider this on the next update of our application. For now, as Andre suggested, I inherit from QLineEdit my own class and I do some stylesheet "magic". It actually works fine. But yet, I find the QTreeWidget solution a better idea. I will give it a go soon!
Thank you all guys!
Cheers!