diff -r 5db8dfd30ea2 -r c2a05fa925a1 headingobj.cpp --- a/headingobj.cpp Thu Nov 23 16:18:26 2006 +0000 +++ b/headingobj.cpp Fri Dec 08 20:18:56 2006 +0000 @@ -10,9 +10,9 @@ init (); } -HeadingObj::HeadingObj(Q3Canvas* c) :MapObj(c) +HeadingObj::HeadingObj(QGraphicsScene *s) :MapObj(s) { -// cout << "Const HeadingObj\n"; +// cout << "Const HeadingObj (s)\n"; init (); } @@ -44,8 +44,8 @@ { MapObj::move(x,y); - int h; // height of a textline - int ho; // offset of height while drawing all lines + qreal h; // height of a textline + qreal ho; // offset of height while drawing all lines if (!textline.isEmpty() ) h=textline.first()->boundingRect().height(); @@ -54,7 +54,7 @@ ho=0; for (int i=0; imove(x,y+ho); + textline.at(i)->setPos(x,y+ho); ho=ho+h; } } @@ -73,8 +73,8 @@ void HeadingObj::calcBBoxSize() { - int w=0; - int h=0; + qreal w=0; + qreal h=0; // Using Backspace an empty heading might easily be created, then there // would be textline.first()==NULL This can be worked around by the following, but // then no selection would be visible, thus we prevent it in ::setText() @@ -87,18 +87,17 @@ w=textline.at(i)->boundingRect().width(); } } - bbox.setSize (QSize(w,h)); + bbox.setSize (QSizeF(w,h)); } -Q3CanvasText* HeadingObj::newLine(QString s) +QGraphicsTextItem* HeadingObj::newLine(QString s) { - Q3CanvasText *t; - t = new Q3CanvasText(canvas); + QGraphicsTextItem *t=scene->addText(""); t->setFont (font); - t->setColor (color); - t->setZ(Z_TEXT); - t->setText(s); - t->setTextFlags(Qt::AlignLeft); + t->setZValue(Z_TEXT); + t->setDefaultTextColor(color); + t->setPlainText(s); + //t->setTextFlags(Qt::AlignLeft); t->show(); return t; } @@ -221,7 +220,7 @@ { color=c; for (int i=0; isetColor(c); + textline.at(i)->setDefaultTextColor(c); } } @@ -240,12 +239,12 @@ textline.at(i)->hide(); } -int HeadingObj::getHeight () +qreal HeadingObj::getHeight () { return bbox.height(); } -int HeadingObj::getWidth() +qreal HeadingObj::getWidth() { return bbox.width(); }