Re: [Interest] problems with drag event in QListView with delegate in edit mode

2018-08-08 Thread Frank Rueter | OHUfx
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 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 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 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 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 





___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] problems with drag event in QListView with delegate in edit mode

2018-08-08 Thread Frank Rueter | OHUfx

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 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 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 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 
	*vfx compositing  | *workflow 
customisation and consulting * *

**
   


Your gateway to over 1,000 free tools... right inside of Nuke 



___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest