[Interest] Drawing on viewport

Konstantin Tokarev annulen at yandex.ru
Thu Mar 27 09:32:57 CET 2014


27.03.2014, 12:28, "igor.mironchik at gmail.com" <igor.mironchik at gmail.com>:
> Hi.
>
> I’m working on TextEdit widget for QtMWidgets library.
>
> TextEdit is a subclass of ScrollArea that derived from AbstractScrollArea. AbstractScrollArea is implemented like QAbstractScrollArea and has viewport as child widget.
>
> In TextEdit’s paintEvent I want to draw directly on viewport. And I initialize QPainter with:
>
> QPainter p( viewport() );
>
> But I receive folowing warning:
>
> QWidget::paintEngine: Should no longer be called
>
> QPainter::begin: Paint device returned engine == 0, type: 1
>
> QPainter::setPen: Painter not active
>
> and nothing draws.
>
> What am I doing wrong?

One does not simply paint on the other widget.


-- 
Regards,
Konstantin



More information about the Interest mailing list