The problem seems to be specifically with using a QSlider as an editor, as opposed to something like a QSpinBox, because of the way the events are handled for that kind of widget. The focus events are being mishandled, which makes the widget hide when you click on it.
A solution would be to implement an eventFilter and correct the handling to suit our needs. First you can make the FocusOut event not get handled in the default manner. With this alone, you would be able to use the slider, and then click to another cell to end the editor.
If you want to extend the behavior, you could have it close simply by leaving the cell.
class ShipDelegate(QItemDelegate):
...
def eventFilter(self, obj, event):
typ = event.type()
# Don't let the delegate handle the FocusOut
# causing a click to hide the slider
if typ == event.FocusOut:
return False
# Optionally allow a mouse leave event to hide
# the slider editor. Otherwise you must click
# another cell.
elif typ == event.Leave:
self.closeEditor.emit(obj, self.NoHint)
return super(ShipDelegate, self).eventFilter(obj, event)
...
That should give you something functional. Also, you can probably remove the blocking of the signals. I am not sure they are needed.
-- justin
> --
> You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
python_inside_m...@googlegroups.com.
> To post to this group, send email to
python_in...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.