[Interest] QTableView - only trigger edit event in lower part of cell

Frank Rueter | OHUfx frank at ohufx.com
Tue May 1 10:21:17 CEST 2018


Hi,

I have spent several hours trying to get this right but seem to be failing:
I have a QTableView (which uses a QAbstractTableModel) and a custom 
delegate which takes care of the cell painting.
At the bottom of each cell I need a combo box which I want editable by a 
single click, so no clicking to select or focus the cell first. Here is 
the current state of a cell:

I tried this via the view's mousePressEvent, comparing 
self.visualRect(index) to the cursor position (after mapping both to the 
global coordinate system. But I can't get that right.

Another attempt was to do it via the delegate's createEditor() method 
and just return None if the cursor isn't in the required area.
That seemed to be more promising, but I didn't know how to close the 
editor again when the user clicks into the upper part of the cell.

I want to avoid persistent editors for performance reasons.

Does anybody have any tips how to best tackle this? It feels like it 
shouldn't be too hard and I have stared at it too long now to see any 
obvious solutions, so any help would be great.

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>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180501/77620747/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2018-05-01 at 8.13.58 PM.png
Type: image/png
Size: 45093 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180501/77620747/attachment.png>


More information about the Interest mailing list