/*
incomming QDomElement
<divtext rotate="90" zindex="2" left="115" top="25" large="300" hight="400" >
<param font="arial" color="#0000ff" size="30">Scribble XHTML Floating DIV box width:300px height:400px top:25px left:115px</param>
</divtext>
*/
{
Q_OBJECT
public:
{
modus = MODUS_MOVE;
root = xmlstream;
moveBy(GetInt("left"),GetInt("top"));
rotate(GetInt("rotate"));
int FontSize = root.firstChildElement("param").attributeNode("size").value().toInt();
if (FontSize > 9) {
f.setPixelSize(FontSize);
} else {
f.setPixelSize(10);
}
f.setFamily( root.firstChildElement("param").attributeNode("font").value() );
setDefaultTextColor ( root.firstChildElement("param").attributeNode("color").value() );
human = root.firstChildElement("param").text();
setTextWidth ( GetInt("large") );
setPlainText ( human );
setFont(f);
setZValue( GetInt("zindex") + 300 ); /* to make border - */
SetMoveItem();
QObject::connect(scene,
SIGNAL(selectionChanged
()),
this,
SLOT(WakeUpHere
()));
/////// ensureVisible(QRectF(GetInt("left"),GetInt("top"),GetInt("large"),GetInt("hight")),80,80);
}
{
painter->drawRect (-2,-2,GetInt("large") + 4,8); /* GetInt("hight") + 4 border 2px out side overflow*/
update();
}
/*
incomming QDomElement
<divtext rotate="90" zindex="2" left="115" top="25" large="300" hight="400" >
<param font="arial" color="#0000ff" size="30">Scribble XHTML Floating DIV box width:300px height:400px top:25px left:115px</param>
</divtext>
*/
class FloatText : public QGraphicsTextItem
{
Q_OBJECT
public:
FloatText( QDomElement xmlstream , QGraphicsItem *parent, QGraphicsScene *scene )
: QGraphicsTextItem(parent, scene)
{
modus = MODUS_MOVE;
root = xmlstream;
moveBy(GetInt("left"),GetInt("top"));
rotate(GetInt("rotate"));
f = QFont();
int FontSize = root.firstChildElement("param").attributeNode("size").value().toInt();
if (FontSize > 9) {
f.setPixelSize(FontSize);
} else {
f.setPixelSize(10);
}
f.setFamily( root.firstChildElement("param").attributeNode("font").value() );
setDefaultTextColor ( root.firstChildElement("param").attributeNode("color").value() );
human = root.firstChildElement("param").text();
setTextWidth ( GetInt("large") );
setPlainText ( human );
setFont(f);
setZValue( GetInt("zindex") + 300 ); /* to make border - */
SetMoveItem();
QObject::connect(scene, SIGNAL(selectionChanged()), this, SLOT(WakeUpHere()));
/////// ensureVisible(QRectF(GetInt("left"),GetInt("top"),GetInt("large"),GetInt("hight")),80,80);
}
void paint(QPainter *painter,const QStyleOptionGraphicsItem *option,QWidget *widget)
{
painter->drawRect (-2,-2,GetInt("large") + 4,8); /* GetInt("hight") + 4 border 2px out side overflow*/
update();
}
To copy to clipboard, switch view to plain text mode
Bookmarks