[Interest] problems with drag event in QListView with delegate in edit mode
Frank Rueter | OHUfx
frank at ohufx.com
Wed Aug 8 11:57:51 CEST 2018
Same issue with the context menu. I have to right lick twice before it
opens.
I have been trying to set focus and various states on the view but still
can't get it right.
Any help would be very much appreciated.
Cheers,
frank
On 8/08/18 8:58 PM, Frank Rueter | OHUfx wrote:
>
> 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>
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180808/0242fb7b/attachment.html>
More information about the Interest
mailing list