Author: aschnell Date: Thu Jan 15 16:36:47 2009 New Revision: 54660 URL: http://svn.opensuse.org/viewcvs/yast?rev=54660&view=rev Log: - backup Modified: branches/tmp/aschnell/graph/qt-graph/src/YQGraph.cc branches/tmp/aschnell/graph/qt-graph/src/YQGraph.h Modified: branches/tmp/aschnell/graph/qt-graph/src/YQGraph.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/graph/qt-graph/src/YQGraph.cc?rev=54660&r1=54659&r2=54660&view=diff ============================================================================== --- branches/tmp/aschnell/graph/qt-graph/src/YQGraph.cc (original) +++ branches/tmp/aschnell/graph/qt-graph/src/YQGraph.cc Thu Jan 15 16:36:47 2009 @@ -244,20 +244,20 @@ if (strcmp(ND_shape(node)->name, "ellipse") == 0) { - Node* shape = new Node(rect); - shape->label = QString(ND_label(node)->text); + Node* shape = new Node(rect, ND_label(node)->text); scene->addItem(shape); shape->setPen(pen1); shape->setBrush(brush1); + shape->setLabelPen(QPen(Qt::blue)); item = shape; } else { - Node* shape = new Node(rect); - shape->label = QString(ND_label(node)->text); + Node* shape = new Node(rect, ND_label(node)->text); scene->addItem(shape); shape->setPen(pen1); shape->setBrush(brush1); + shape->setLabelPen(QPen(Qt::black)); item = shape; } @@ -316,8 +316,9 @@ } -Node::Node(const QRectF& rect, QGraphicsItem* parent) - : QGraphicsRectItem(rect, parent) +Node::Node(const QRectF& rect, const QString& label) + : QGraphicsRectItem(rect), + label(label) { } @@ -328,10 +329,17 @@ void -Node::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) +Node::setLabelPen(const QPen& tmp) +{ + labelPen = tmp; +} + + +void +Node::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) { QGraphicsRectItem::paint(painter, option, widget); - painter->setPen(Qt::black); + painter->setPen(labelPen); painter->drawText(rect(), Qt::AlignCenter | Qt::AlignHCenter, label); } Modified: branches/tmp/aschnell/graph/qt-graph/src/YQGraph.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/graph/qt-graph/src/YQGraph.h?rev=54660&r1=54659&r2=54660&view=diff ============================================================================== --- branches/tmp/aschnell/graph/qt-graph/src/YQGraph.h (original) +++ branches/tmp/aschnell/graph/qt-graph/src/YQGraph.h Thu Jan 15 16:36:47 2009 @@ -83,7 +83,7 @@ private: QGraphicsScene* scene; - + void arrow(QPainterPath& path, const QLineF& line, const QString& type); }; @@ -94,15 +94,19 @@ public: - Node(const QRectF& rect, QGraphicsItem* parent = 0); + Node(const QRectF& rect, const QString& label); ~Node(); - + + void setLabelPen(const QPen& labelPen); + void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget); +private: + QString label; - + QPen labelPen; + }; - #endif // YQGraph_h -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org