[Interest] Drawing on viewport
Tony Rietwyk
tony at rightsoft.com.au
Thu Mar 27 10:34:36 CET 2014
I think that works because QScrollArea's events are actually remapped for the viewport anyway.
Tony
> -----Original Message-----
> From: interest-bounces+tony=rightsoft.com.au at qt-project.org
> [mailto:interest-bounces+tony=rightsoft.com.au at qt-project.org] On Behalf
> Of igor.mironchik at gmail.com
> Sent: Thursday, 27 March 2014 8:35 PM
> To: Konstantin Tokarev; interest at qt-project.org
> Subject: Re: [Interest] Drawing on viewport
>
> Ok.
>
> But it works in QTextEdit.
>
> Look:
>
> void QTextEdit::paintEvent(QPaintEvent *e) {
> Q_D(QTextEdit);
> QPainter p(d->viewport);
> d->paint(&p, e);
> }
>
> -----Original Message-----
> From: Konstantin Tokarev
> Sent: Thursday, March 27, 2014 10:32 AM
> To: igor.mironchik at gmail.com ; interest at qt-project.org
> Subject: Re: [Interest] Drawing on viewport
>
>
> 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
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list