[Interest] QTableView - only trigger edit event in lower part of cell
Frank Rueter | OHUfx
frank at ohufx.com
Wed May 2 00:58:34 CEST 2018
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 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/20180502/3598625d/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/20180502/3598625d/attachment.png>
More information about the Interest
mailing list