QCombobox intercept selection
-
All,
This should be simple, but I've been digging through the code and it looks nearly impossible to do without completely rewriting QCombobox.
What needs to happen: When user selects entry from list in combo box that index needs to be captured and stopped from updating. An interprocess message (not a signal) needs to go out with the value associated with the index. If the external process deems it is ok to use that value at the moment it will send some other interprocess message back at some point and the application will update the QCombobox display from that.
So far the documentation and examples have been quite useless in solving this problem. I dug through the QCombobox code and it "looks" like this is burried in QComboboxprivate.
The closest thing I can think of is to create a custom QAbstractItemView, assign it to the combobox, then override the mousePressEvent(QMouseEvent *event) but I'm having trouble finding examples on-line.
Can someone point me to an example of a creating a custom QAbstractitemView and using it with QCombobox?
I usually try to avoid going this deep into dismembering built in functionality but cannot avoid it this time.
Thanks in advance.
Roland -
Why don't you filter the combo to only show valid options?
@QSortFilterProxyModel@ -
All of them are valid. It's a display requirement to only show the values after they have taken effect. Some have quite a bit of work, others do not.