Ah, looks like my approach was correct but I had not turned off edit triggers properly, so those were interfering with the expected behaviour.

On 1/05/18 8:21 PM, Frank Rueter | OHUfx wrote:
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>



_______________________________________________
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

Reply via email to