1.1 --- a/headingobj.cpp Thu Nov 23 16:18:26 2006 +0000
1.2 +++ b/headingobj.cpp Fri Dec 08 20:18:56 2006 +0000
1.3 @@ -10,9 +10,9 @@
1.4 init ();
1.5 }
1.6
1.7 -HeadingObj::HeadingObj(Q3Canvas* c) :MapObj(c)
1.8 +HeadingObj::HeadingObj(QGraphicsScene *s) :MapObj(s)
1.9 {
1.10 -// cout << "Const HeadingObj\n";
1.11 +// cout << "Const HeadingObj (s)\n";
1.12 init ();
1.13 }
1.14
1.15 @@ -44,8 +44,8 @@
1.16 {
1.17 MapObj::move(x,y);
1.18
1.19 - int h; // height of a textline
1.20 - int ho; // offset of height while drawing all lines
1.21 + qreal h; // height of a textline
1.22 + qreal ho; // offset of height while drawing all lines
1.23
1.24 if (!textline.isEmpty() )
1.25 h=textline.first()->boundingRect().height();
1.26 @@ -54,7 +54,7 @@
1.27 ho=0;
1.28 for (int i=0; i<textline.size(); ++i)
1.29 {
1.30 - textline.at(i)->move(x,y+ho);
1.31 + textline.at(i)->setPos(x,y+ho);
1.32 ho=ho+h;
1.33 }
1.34 }
1.35 @@ -73,8 +73,8 @@
1.36
1.37 void HeadingObj::calcBBoxSize()
1.38 {
1.39 - int w=0;
1.40 - int h=0;
1.41 + qreal w=0;
1.42 + qreal h=0;
1.43 // Using Backspace an empty heading might easily be created, then there
1.44 // would be textline.first()==NULL This can be worked around by the following, but
1.45 // then no selection would be visible, thus we prevent it in ::setText()
1.46 @@ -87,18 +87,17 @@
1.47 w=textline.at(i)->boundingRect().width();
1.48 }
1.49 }
1.50 - bbox.setSize (QSize(w,h));
1.51 + bbox.setSize (QSizeF(w,h));
1.52 }
1.53
1.54 -Q3CanvasText* HeadingObj::newLine(QString s)
1.55 +QGraphicsTextItem* HeadingObj::newLine(QString s)
1.56 {
1.57 - Q3CanvasText *t;
1.58 - t = new Q3CanvasText(canvas);
1.59 + QGraphicsTextItem *t=scene->addText("");
1.60 t->setFont (font);
1.61 - t->setColor (color);
1.62 - t->setZ(Z_TEXT);
1.63 - t->setText(s);
1.64 - t->setTextFlags(Qt::AlignLeft);
1.65 + t->setZValue(Z_TEXT);
1.66 + t->setDefaultTextColor(color);
1.67 + t->setPlainText(s);
1.68 + //t->setTextFlags(Qt::AlignLeft);
1.69 t->show();
1.70 return t;
1.71 }
1.72 @@ -221,7 +220,7 @@
1.73 {
1.74 color=c;
1.75 for (int i=0; i<textline.size(); ++i)
1.76 - textline.at(i)->setColor(c);
1.77 + textline.at(i)->setDefaultTextColor(c);
1.78 }
1.79 }
1.80
1.81 @@ -240,12 +239,12 @@
1.82 textline.at(i)->hide();
1.83 }
1.84
1.85 -int HeadingObj::getHeight ()
1.86 +qreal HeadingObj::getHeight ()
1.87 {
1.88 return bbox.height();
1.89 }
1.90
1.91 -int HeadingObj::getWidth()
1.92 +qreal HeadingObj::getWidth()
1.93 {
1.94 return bbox.width();
1.95 }