|
|
Amend that last post. Since you are in QCanvasRectangle you should be given an
already setup painter pointer via the drawShape() method. That will be called
anytime your item needs drawing. Much like paintEvent.
--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/
|
|