Hi,
Is there an easy way to disable some of the items(or row data or whatever) in the combobox's menu when one of them is selected?
Regards
Hi,
Is there an easy way to disable some of the items(or row data or whatever) in the combobox's menu when one of them is selected?
Regards
I don't understand what 'disabling' in this context means... the item is in the list, so what would "disabling" it do exactly?
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
You can create a custom item delegate and react on some user data to paint some items in lighter grey (or wathever) and make it so you can't select them.
How this will work with editable comboboxes... I don't know.
You probably want to subclass QComboBox too to alter the behaviour of the signals and slots with respect to those disabled items.
A better way would be to just remove those items from the list.
@high_flyer: it means they can be seen in the menu when the combobox clicked but somehow can't be selected by users. I wonder the somehow part..ok now?
@tbscope: I wish I could remove them, but it won't work for me. I think they should be seperate classes so that they can be modified in an agile way just like QListWidget item.
Maybe css solve the problem which I don't think so.
I too think that the proper way is through a custom delegate.
CSS or style sheets will only change the look and feel but not the behaviour.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Bookmarks