Line edit for QListWidgetItem?
-
@Pl45m4 Thanks! No, you got it right.
The item itself is the "display" for QVariant data...
Can I somehow get the display of QVariant data? I just want to monitor as the user updates the text and change the color to red in case the user inputs a text that already exists. I cannot do that by changing the foreground of the item itself when the user is updating the text.
@CJha said in Line edit for QListWidgetItem?:
Can I somehow get the display of QVariant data?
OK, found out that it actually does show a
QLineEdit
widget, but only for editing...
You could try a custom (QLineEdit
style) itemDelegate and set your wanted behavior there. Dunno if it will work.Edit:
Yeah, that's probably it.
Set a itemDelegate and use aQLineEdit
with someQValidator
or whatever you need, to validate your input... -
Hi, is there a way I could get the
QLineEdit
forQListWidgetItem
when it is being edited?
For example, for aQComboBox
I can get theQLineEdit
(if theQComboBox
is editable) like this:ui.comboBox->lineEdit()
. -
I dont think
QListWidgetItem
"includes" aQLineEdit
. The item itself is the "display" forQVariant
data...
Or did I get your question wrong?!@Pl45m4 Thanks! No, you got it right.
The item itself is the "display" for QVariant data...
Can I somehow get the display of QVariant data? I just want to monitor as the user updates the text and change the color to red in case the user inputs a text that already exists. I cannot do that by changing the foreground of the item itself when the user is updating the text.
-
@Pl45m4 Thanks! No, you got it right.
The item itself is the "display" for QVariant data...
Can I somehow get the display of QVariant data? I just want to monitor as the user updates the text and change the color to red in case the user inputs a text that already exists. I cannot do that by changing the foreground of the item itself when the user is updating the text.
@CJha said in Line edit for QListWidgetItem?:
Can I somehow get the display of QVariant data?
OK, found out that it actually does show a
QLineEdit
widget, but only for editing...
You could try a custom (QLineEdit
style) itemDelegate and set your wanted behavior there. Dunno if it will work.Edit:
Yeah, that's probably it.
Set a itemDelegate and use aQLineEdit
with someQValidator
or whatever you need, to validate your input... -
@CJha said in Line edit for QListWidgetItem?:
Can I somehow get the display of QVariant data?
OK, found out that it actually does show a
QLineEdit
widget, but only for editing...
You could try a custom (QLineEdit
style) itemDelegate and set your wanted behavior there. Dunno if it will work.Edit:
Yeah, that's probably it.
Set a itemDelegate and use aQLineEdit
with someQValidator
or whatever you need, to validate your input... -
@Pl45m4 Thanks! I thought it would be as easy as accessing the
QLineEdit
for editableQComboBox
. I will have a look atQItemDeligate
.