I have modified combobox to hold colors, using QtColorCombo (http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Widgets/qtcolorcombobox) as howto for the 'more...' button implementation details. It works fine in C++ and in PyQt on linux, but I get 'underlying C++ object was destroyed' when use this control in PyQt on Windows. It seels like the error happens when:
...
# in constructor:
self.activated.connect(self._emitActivatedColor)
...
def _emitActivatedColor(self, index):
if self._colorDialogEnabled and index == self.colorCount():
print '!!!!!!!!! QtGui.QColorDialog.getColor()'
c = QtGui.QColorDialog.getColor() # <----- :( delegate fires 'closeEditor'
print '!!!!!!!!! ' + c.name()
if c.isValid():
self._numUserColors += 1
#at the next line currentColor() tries to access C++ layer and fails
self.addColor(c, self.currentColor().name())
self.setCurrentIndex(index)
...
Maybe console output will help. I've overridden event() in editor and got:
- MouseButtonRelease
- FocusOut
- Leave
- Paint
- Enter
- Leave
- FocusIn
- !!!!!!!!! QtGui.QColorDialog.getColor()
- WindowBlocked
- Paint
- WindowDeactivate
- !!!!!!!!! 'CloseEditor' fires!
- Hide
- HideToParent
- FocUsOut
- DeferredDelete
- !!!!!!!!! #6e6eff
Can someone explain, why there is such a different behaviour in the different environments, and maybe give a workaround to fix this. Here is the minimal example: http://docs.google.com/Doc?docid=0Aa0otNVdbWrrZDdxYnF3NV80Y20yam1nZHM&hl=en