Qlineedit: uneditable text + editable text
-
Hello guys,
I hope all of you are doing great.In qlineedit i need a way to keep a
static text in the beginning and after those characters i want to mention any text(editable text)example
above example is from qt designer
i disabled frames from lineedit and label
and placed it besides each otherBut i am assuming there must be some effective way as well
Thanks
-
Hello guys,
I hope all of you are doing great.In qlineedit i need a way to keep a
static text in the beginning and after those characters i want to mention any text(editable text)example
above example is from qt designer
i disabled frames from lineedit and label
and placed it besides each otherBut i am assuming there must be some effective way as well
Thanks
@blossomsg
If yourtext
is supposed to be a separate label at the left that would be easiest.If you really mean you want
text
to be inside theQLineEdit
and "stick" there, you would have to subclassQLineEdit
and do whatever to keep it there while the user edits, e.g. never let the cursor go left into it, or something similar. -
Hello @JonB
Thank you for the reply,
i have never tried subclassing specifically qlineedit, combobox or anything to modify
an example would be a great help, or if there is any page to go through, can you please share@blossomsg
Have you subclassed anything in C++? That is needed in much Qt stuff.A couple of the simplest examples I could spot are:
https://stackoverflow.com/questions/38958873/a-simple-subclass-of-qwidget-doesnt-work-as-a-qwidget
https://stackoverflow.com/questions/37454998/subclassing-widgets-in-qt-designerDon't worry about the problem the posters there are asking about, just look at the few lines in their code which do the subclassing.
But really you just need to know about C++ subclassing, and that's beyond the scope of a reply in this forum :)
-
@blossomsg
So you need to do subclassing in Python! It's the same principle, different syntax. You can Google for something likepython qt widget subclass
if you want to find Qt examples.