[PySide] adding buttons to table view in an efficient manner
Frank Rueter | OHUfx
frank at ohufx.com
Mon Jul 2 05:43:54 CEST 2018
Hi all,
this seems to come up a lot but I still don't have a routine for the
solution so I wanted to see what other thinks:
Task: write a table view for an unknown amount of rows, and each row
needs to have a progressbar and two buttons.
The progressbar is covered by a super simple custom paint method that
just fills the option rectangle (I found using
/QtGui.QApplication.style().drawControl /was too slow for a large amount
of rows and causes jerky resizing behaviour).
As for the buttons I am having the view's viewportEvent (event
type=QtCore.QEvent.Type.Paint) loop over the model's rows, checking each
row's visualRect() against the viewport.
If the row is currently visible I open a persistent editor for it,
otherwise I close the persistent editor.
The delegate's createEditor() method takes care of the required
signal/slot connections.
This seems to work ok, but still seems a bit jerky when resizing a large
window with lots o rows.
The other approach I am contemplating is to draw rendered buttons as
pixmaps into the cells and only swap them out for actual buttons on
mouse over.
I'm sure the latter will make things a lot snappier, so should be worth
the re-write?!
Does anybody have any input on this?
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/pyside/attachments/20180702/44688a8b/attachment.html>
More information about the PySide
mailing list