1.1 --- a/headingobj.cpp Mon Nov 20 12:12:05 2006 +0000
1.2 +++ b/headingobj.cpp Thu Nov 23 13:53:08 2006 +0000
1.3 @@ -18,12 +18,13 @@
1.4
1.5 HeadingObj::~HeadingObj()
1.6 {
1.7 - textline.clear();
1.8 +// cout << "Destr. HeadingObj "<<heading.ascii()<<endl;
1.9 + while (!textline.isEmpty())
1.10 + delete textline.takeFirst();
1.11 }
1.12
1.13 void HeadingObj::init()
1.14 {
1.15 - textline.setAutoDelete (TRUE);
1.16 textwidth=40;
1.17 color=QColor ("black");
1.18 font=QFont();
1.19 @@ -46,15 +47,14 @@
1.20 int h; // height of a textline
1.21 int ho; // offset of height while drawing all lines
1.22
1.23 - if (textline.first() )
1.24 + if (!textline.isEmpty() )
1.25 h=textline.first()->boundingRect().height();
1.26 else
1.27 h=2;
1.28 - Q3CanvasText *t;
1.29 ho=0;
1.30 - for (t=textline.first(); t; t=textline.next() )
1.31 + for (int i=0; i<textline.size(); ++i)
1.32 {
1.33 - t->move(x,y+ho);
1.34 + textline.at(i)->move(x,y+ho);
1.35 ho=ho+h;
1.36 }
1.37 }
1.38 @@ -80,12 +80,11 @@
1.39 // then no selection would be visible, thus we prevent it in ::setText()
1.40 if (!textline.isEmpty() )
1.41 {
1.42 - Q3CanvasText *t;
1.43 - for (t=textline.first(); t; t=textline.next() )
1.44 + for (int i=0; i<textline.size(); ++i)
1.45 {
1.46 - h+=t->boundingRect().height();
1.47 - if (w<t->boundingRect().width() )
1.48 - w=t->boundingRect().width();
1.49 + h+=textline.at(i)->boundingRect().height();
1.50 + if (w<textline.at(i)->boundingRect().width() )
1.51 + w=textline.at(i)->boundingRect().width();
1.52 }
1.53 }
1.54 bbox.setSize (QSize(w,h));
1.55 @@ -109,7 +108,8 @@
1.56 heading=s;
1.57
1.58 // remove old textlines and prepare generating new ones
1.59 - textline.clear();
1.60 + while (!textline.isEmpty())
1.61 + delete textline.takeFirst();
1.62
1.63 // prevent empty textline, so at least a small selection stays
1.64 // visible for this heading
1.65 @@ -220,9 +220,8 @@
1.66 if (color!=c)
1.67 {
1.68 color=c;
1.69 - Q3CanvasText *t;
1.70 - for (t=textline.first(); t; t=textline.next() )
1.71 - t->setColor(c);
1.72 + for (int i=0; i<textline.size(); ++i)
1.73 + textline.at(i)->setColor(c);
1.74 }
1.75 }
1.76
1.77 @@ -234,12 +233,11 @@
1.78 void HeadingObj::setVisibility (bool v)
1.79 {
1.80 MapObj::setVisibility(v);
1.81 - Q3CanvasText *t;
1.82 - for (t=textline.first(); t; t=textline.next() )
1.83 + for (int i=0; i<textline.size(); ++i)
1.84 if (v)
1.85 - t->show();
1.86 + textline.at(i)->show();
1.87 else
1.88 - t->hide();
1.89 + textline.at(i)->hide();
1.90 }
1.91
1.92 int HeadingObj::getHeight ()