qt-interest@trolltech.com
[Top] [All Lists]

Re: rotate text help

Subject: Re: rotate text help
From: Justin Noel
Date: Sun, 26 Mar 2006 11:54:00 -0500
Jeff,

Your painter reqires a device to operate on.  See the begin(QPaintDevice*) 
method or the contructor that takes QPaintDevice*.

--Justin 


-----Original Message-----

From:  jeep@xxxxxxxxx (Jeff Lacki)
Subj:  Re: rotate text help
Date:  Sun Mar 26, 2006 11:21 am
Size:  1K
To:  bradh@xxxxxxxxxxxxx, qt-interest@xxxxxxxxxxxxx

Thanks for that insights :)

Yes, I created the painter in a subclass of Q3CanvasRectangle:

    QString text("Testing");
    RotatedText *rt = new RotatedText(text,canvas);
    QPainter p;
    rt->draw(p);

And the draw method:

void
RotatedText::draw(QPainter &p)
{
    p.save();
    p.rotate(90);
    p.translate(-x(), -y());
    p.translate(y(), -x());

    // Have the base class draw it
    Q3CanvasText::draw(p);
    p.restore();
}

Produces the following:

QPainter::save(), painter not active
QPainter::setMatrix(), painter not active 
QPainter::setMatrix(), painter not active 
QPainter::setMatrix(), painter not active 
Segmentation fault

I forgot to ask how to fix the 'painter not active' message?
I looked at the source code and couldnt find where IsActive()
actually gets set to active, though I didnt do a strong search.

Jeff

--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/

--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>