[email protected]
[Top] [All Lists]

Re: rotate text help

Subject: Re: rotate text help
From: Jeff Lacki
Date: Mon, 27 Mar 2006 12:43:18 -0800 PST
Thank you for your suggestions Justin:

> I'm not sure what you mean by "My QCanvasRectangle contains a QCanvasText",
> but it cant be good.  QCanvasItems are have no parent child relationship and 
> you definatly cannot
> have a QCanvasRectangle with other items as class members.

Ill explain.  I have subclassed a QCanvasRectangle.  Inside this
class I create a label pointer (Q3CanvasText) and other text items.
I do this so that when the canvasview collision occurs, I call the
move method in my subclass which takes care of moving all the text items
as well as the Q3CanvasRectangle subclass itself.

> You could have added a call to QPainter::drawText to your posted code and be 
> almost there.

I see what you mean, however, it seems my biggest issue with
what I have is QPaintDevice as it relates to QPainter.begin()
which takes a QPaintDevice.  Since Ive been stuck in the canvas-only
world so far, Im trying to learn more about the painter stuff.
My understanding is that painter (and related stuff) is essentially
what canvas things are built on top of.  Thats just an aside to
my problem.

Anyhow I tried this bit of code, but dont understand QPixmap well
enough yet either.  Ill replace the 120 width/height later when
I can actually get this working:

in my Q3CanvasRectangle subclass:

QString test("Testing");
RotatedText *rt = new RotatedText(test,canvas);
QPainter p;

then draw method of RotatedText:

RotatedText::draw(QPainter &p)
    QPixmap res(120,120);
    p.translate(-x(), -y());
    p.translate(y(), -x());

    // Have the base class draw it


Thanks again,

To unsubscribe - send a mail to [email protected] 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>