[PySide] how to drawing pixmap into header view

Christian Gagneraud chgans at gmail.com
Sun May 13 10:43:15 CEST 2018


On 13 May 2018 at 17:53, Frank Rueter | OHUfx <frank at ohufx.com> wrote:
>
> Hi all,
>
> I am trying to paint a simple icon into a header view without losing it’s default look.
>
> I thought this would do it:
>
> class SequenceHeaderView(QtWidgets.QHeaderView):
>     def paintSection(self, painter, rect, logicalIndex):
>         super(SequenceHeaderView, self).paintSection(painter, rect, logicalIndex)
>         painter.drawPixmap(rect.topLeft(), QtGui.QPixmap(pixmap_path)

I'm no expert, but maybe it has to do with the painter state, or
something along these lines.
Maybe you need to call saveState/restoreState?

My 2 cents.

Chris


>
> However, this will not draw the pixmap.
>
> If I do NOT call super(...).paintSection(...) it will draw the icon but obviously lose all it’s default look.
> What am I missing?
>
> Cheers,
> frank
>
> --
>
>
> vfx compositing | workflow customisation and consulting
>
>
> Your gateway to over 1,000 free tools... right inside of Nuke
>
>
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
>



More information about the PySide mailing list