Frank Rueter | OHUfx
2018-08-08 08:56:11 UTC
Hi all,
I have QListView with an item delegate that is animated when the mouse
overs over it.
This is done via a delegate using a custom widget and popping the index
under the cursor into edit mode like so:
|def mouseMoveEvent(self, event): if index.isValid(): # start playing
playing under cursor self.edit(index) |
This works fine and I have a mechanism for closing the editor as well to
ensure only one item is ever playing as the mouse moves around the list
view.
The issue now is that the custom drag&drop behaviour has suffered - but
only under windows and linux, it works fine on OSX.
In order to close the editor when the left mouse button is clicked I do
this in the QListViewâs mousePressEvent():
|def mousePressEvent(self, event): if self.currentEditor: try: # clean up
open editor self.currentEditor.setFocusPolicy(QtCore.Qt.NoFocus)
self.closeEditor(self.currentEditor, QtGui.QAbstractItemDelegate.NoHint)
self.commitData(self.currentEditor) self.setFocus() except RuntimeError:
# no current editor. click happened outside the thumbnails pass
super(ElementView, self).mousePressEvent(event) |
On OSX, this enables the QListViewâs default drag&drop behaviour when I
click and drag one of the items.
On windows however I need to click twice and only on the second click
the drag event kicks in.
If I comment out the above self.edit(index), drag&drop works fine on all
platforms, but of course Iâm not getting the animation.
I also tried using persistent editors to no avail (same result).
Does anybody have an idea what I need to do to make this work ion
windows as well?
I have been trying to figure this out for hours now and am getting nowhere.
Cheers,
frank
â
--
ohufxLogo 50x50 <http://www.ohufx.com>
*vfx compositing <http://ohufx.com/compositing.html> | *workflow
customisation and consulting <http://ohufx.com/customising.html>* *
*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>
Your gateway to over 1,000 free tools... right inside of Nuke
<http://www.nukepedia.com/nubridge>
I have QListView with an item delegate that is animated when the mouse
overs over it.
This is done via a delegate using a custom widget and popping the index
under the cursor into edit mode like so:
|def mouseMoveEvent(self, event): if index.isValid(): # start playing
playing under cursor self.edit(index) |
This works fine and I have a mechanism for closing the editor as well to
ensure only one item is ever playing as the mouse moves around the list
view.
The issue now is that the custom drag&drop behaviour has suffered - but
only under windows and linux, it works fine on OSX.
In order to close the editor when the left mouse button is clicked I do
this in the QListViewâs mousePressEvent():
|def mousePressEvent(self, event): if self.currentEditor: try: # clean up
open editor self.currentEditor.setFocusPolicy(QtCore.Qt.NoFocus)
self.closeEditor(self.currentEditor, QtGui.QAbstractItemDelegate.NoHint)
self.commitData(self.currentEditor) self.setFocus() except RuntimeError:
# no current editor. click happened outside the thumbnails pass
super(ElementView, self).mousePressEvent(event) |
On OSX, this enables the QListViewâs default drag&drop behaviour when I
click and drag one of the items.
On windows however I need to click twice and only on the second click
the drag event kicks in.
If I comment out the above self.edit(index), drag&drop works fine on all
platforms, but of course Iâm not getting the animation.
I also tried using persistent editors to no avail (same result).
Does anybody have an idea what I need to do to make this work ion
windows as well?
I have been trying to figure this out for hours now and am getting nowhere.
Cheers,
frank
â
--
ohufxLogo 50x50 <http://www.ohufx.com>
*vfx compositing <http://ohufx.com/compositing.html> | *workflow
customisation and consulting <http://ohufx.com/customising.html>* *
*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>
Your gateway to over 1,000 free tools... right inside of Nuke
<http://www.nukepedia.com/nubridge>