[PySide] how to drawing pixmap into header view
Frank Rueter | OHUfx
frank at ohufx.com
Sun May 13 11:00:40 CEST 2018
hold the line... you were right!
The base call to painter kills the state of the painter, so I needed to
save the painter before the base call, then restore it afterwards, then
draw my pixmap. I did in the wrong order before.
Thanks!
frank
On 13/05/18 8:58 PM, Frank Rueter | OHUfx wrote:
> 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
>>>
>
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
More information about the PySide
mailing list