[PySide] QLIstView: how to make click in editor behave the same as click in item

Frank Rueter | OHUfx frank at ohufx.com
Mon Aug 15 05:14:35 CEST 2016


Hi all,

I have a custom delegate in a QListView and am trying to figure out how 
to make single click into the editor effect the view's selection model 
the same way as a click on an item that is not in editing mode.
I am currently trying this in the view's mousePressEvent():

     def mousePressEvent(self, event):
         index = self.indexAt(event.pos())
         self.selectionModel().select(index, 
QtGui.QItemSelectionModel.SelectCurrent)
         super(ElementView, self).mousePressEvent(event)


This selects the underlying index but it does not effect the selection 
according to the view's selectionMode, i.e. it does not extend the 
existing selection as expected.
I thought that's what the QtGui.QItemSelectionModel.SelectCurrent flag 
was for, but it doesn't seem to work that way.


Any ideas?

Cheers,
frank

-- 
ohufxLogo 50x50 <http://www.ohufx.com> 	*vfx compositing 
<http://ohufx.com/index.php/vfx-compositing> | *workflow customisation 
and consulting <http://ohufx.com/index.php/vfx-customising>* *

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20160815/ed6301c8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ohufxLogo_50x50.png
Type: image/png
Size: 2666 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20160815/ed6301c8/attachment.png>


More information about the PySide mailing list