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

rotate text help

Subject: rotate text help
From: Jeff Lacki
Date: Sat, 25 Mar 2006 17:50:39 -0800 PST
Hello-

I hunted through the docs and found an example of how to
rotate text, however it seg faults.  Ive read the docs
trying to understand QPainter and Q3Painter but dont
understand which one to use, more less why the code 
doesnt work (which is probably simple to those of you who
know QPainter well).  This is my code (modified from an
example I found):

#include "RotatedText.h"

RotatedText::RotatedText(QString &text, Q3Canvas *canvas) :
    Q3CanvasText(text, canvas),
    _text(text)
{
}

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();
}

I get a segv on the:
Q3CanvasText::draw(p);

line.

So my questions/comment:

1. Whats the diff between QPainter and Q3Painter and
   which should I be using?

2. Why am I seg faulting on the call to my base's method?

3. An assumption here...that it would probably take someone
   at trolltech about a day or less to implement a rotate()
   method in Q3CanvasText() for all the people who seem to 
   need this function :)

Thank you for your help,
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/

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