[PySide] how to drawing pixmap into header view

Frank Rueter | OHUfx frank at ohufx.com
Sun May 13 10:58:04 CEST 2018


Thanks Chris,

tried painter.save() and painter.restore() before and after my painting 
the pixmap but to no avail.

frank

On 13/05/18 8:43 PM, Christian Gagneraud wrote:
> 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