headingobj.cpp
changeset 616 16d63fc9ae42
parent 428 9ae68208e2ff
child 657 8e596f73f258
     1.1 --- a/headingobj.cpp	Mon Feb 19 12:01:52 2007 +0000
     1.2 +++ b/headingobj.cpp	Thu Nov 08 15:28:03 2007 +0000
     1.3 @@ -80,7 +80,7 @@
     1.4  	// then no selection would be visible, thus we prevent it in ::setText()
     1.5  	if (!textline.isEmpty() )
     1.6  	{
     1.7 -		for (int i=0; i<textline.size(); ++i)
     1.8 +		for (int i=0; i<textline.size(); i++)
     1.9  		{
    1.10  			h+=textline.at(i)->boundingRect().height();
    1.11  			if (w<textline.at(i)->boundingRect().width() )
    1.12 @@ -90,13 +90,17 @@
    1.13      bbox.setSize (QSizeF(w,h));
    1.14  }
    1.15  
    1.16 -QGraphicsSimpleTextItem* HeadingObj::newLine(QString s)
    1.17 +//QGraphicsSimpleTextItem* HeadingObj::newLine(QString s)
    1.18 +QGraphicsTextItem* HeadingObj::newLine(QString s)
    1.19  {
    1.20 -    QGraphicsSimpleTextItem *t=new QGraphicsSimpleTextItem (s,0,scene);
    1.21 +    //QGraphicsSimpleTextItem *t=new QGraphicsSimpleTextItem (s,0,scene);
    1.22 +    QGraphicsTextItem *t=new QGraphicsTextItem (s,0,scene);
    1.23      t->setFont (font);
    1.24      t->setZValue(Z_TEXT);
    1.25 -    //t->setDefaultTextColor(color);
    1.26 -    t->setBrush(color);
    1.27 +	// TextItem
    1.28 +    t->setDefaultTextColor(color);
    1.29 +	// SimpleTextItem
    1.30 +    //t->setBrush(color);
    1.31      return t;
    1.32  }
    1.33  
    1.34 @@ -108,6 +112,21 @@
    1.35  	while (!textline.isEmpty())
    1.36  		delete textline.takeFirst();
    1.37  
    1.38 +	if (s.startsWith("<html>"))
    1.39 +	{
    1.40 +		QGraphicsTextItem *t=new QGraphicsTextItem ();
    1.41 +		t->setFont (font);
    1.42 +		t->setZValue(Z_TEXT);
    1.43 +		t->setHtml (s);
    1.44 +		t->setDefaultTextColor(color);
    1.45 +		scene->addItem (t);
    1.46 +		textline.append (t);
    1.47 +		setVisibility (visible);
    1.48 +		move (absPos.x(),absPos.y());
    1.49 +		calcBBoxSize();
    1.50 +		return;
    1.51 +	}
    1.52 +
    1.53  	// prevent empty textline, so at least a small selection stays
    1.54  	// visible for this heading
    1.55  	if (s.length()==0) s="  ";
    1.56 @@ -218,8 +237,10 @@
    1.57      {
    1.58  		color=c;
    1.59  		for (int i=0; i<textline.size(); ++i)
    1.60 -			//textline.at(i)->setDefaultTextColor(c);
    1.61 -			textline.at(i)->setBrush(c);
    1.62 +			// TextItem
    1.63 +			textline.at(i)->setDefaultTextColor(c);
    1.64 +			// SimpleTextItem
    1.65 +			//textline.at(i)->setBrush(c);
    1.66      }	    
    1.67  }
    1.68