Open MosGeo opened 2 years ago
Hi @MosGeo, I think this could be a nice addition.
I think it deserves a place in superqt as the default combobox:
superqt doesn't really have "defaults" per se, it's just a collection of things that libraries can use. It would be fine to add a new widget called QCheckComboBox
or CheckableComboBox
or something like that... but I probably wouldn't put it forth as the combobox to use.
I have to admit I also find the combo/dropdown UI to be a bit unusual. I think personally I would probably aim for a group of checkboxes (not in a dropdown combobox... though perhaps in a scroll area or your QCollapsible if there are a ton of options). But, as long as this is just a new widget that someone can use if they want to, I wouldn't mind having it in here!
I think it deserves a place in superqt as the default combobox:
ohhh sorry... on rereading now, I realize you were say "because the default combobox ..." :joy: Nevermind my comments about "defaults" ... second paragraph stands though :)
@tlambert03
I guess "Default" is confusing. Yes, I mean the standard Qt Combobox implementation with checkbox items added inside it instead of qlabel or string. Basically, adding a bunch of standard code and expecting it to work.
The use case for this: If you have a tens of items (e.g., sample 1, sample 2, sample 3) and you want the user to select the ones to run the analysis or something. This means that most of the time, the combobox would be filled dynamically based on the data. For selecting options for algorithms and such, I agree that that a group of checkboxes is the way to go.
I will clean up the code, write tests, and make a draft PR. I just wanted to make sure that it is of interest as every line of code is possible bug waiting to happen in a library, e.g., I see that you fixed quite a few items in QCollapsible :)
I just wanted to make sure that it is of interest as every line of code is possible bug waiting to happen in a library
one nice thing about this library is that the parts aren't terribly interconnected. So adding a new (relatively isolated) widget along with some tests is pretty low risk. If someone finds a bug, it at least means they're interested in the widget, and we can fix it as we go :)
I propose the inclusion of a custom widget for check combobox. This is useful in some scenarios (e.g., select multiple samples). If there is interest, I will clean up my current code, add tests and create an initial pull request for it.
I think it deserves a place in superqt as the default combobox:
additem
function.The above can be fixed by overriding some of the functions in combobox in qt. A good starting point is https://stackoverflow.com/questions/47575880/qcombobox-set-title-text-regardless-of-items. There is still things to add to it to make it more user friendly (e.g.,
additem
override, signal for item check state change, ...).Screenshots The top one is the default combobox. The bottom one is one possible implementation of CheckComboBox.