[Interest] Odd focus behavior with multi-widget item delegate?

Matthew Woehlke mwoehlke.floss at gmail.com
Fri Nov 27 16:48:40 CET 2020

I have a QTreeView with a complex (consists of multiple widgets) item 
delegate for some columns.

This behaves strangely. For example, the enter key seems to "finish" 
editing, but causes the cell to render in inactive colors (gray bg), 
while the rest of the row renders in active colors (blue bg). Clicking 
away from the editor causes it to lose focus but not go away.

How do I fix this?

The delegate creates a custom widget type that is basically a QWidget 
containing a QDoubleSpinBox and a QComboBox. (It is a value picker that 
allows the user to also specify units via the combo box. No, I do *not* 
want to mess with trying to subclass QDoubleSpinBox to allow the units 
to be typed, both because of the code complexity, and because typing 
units will be more obtuse for users.)


More information about the Interest mailing list