54 #include <QGraphicsItem>
55 #include <QGraphicsLayoutItem>
60 #include <QPainterPath>
73 class Text :
public QObject,
public QGraphicsSimpleTextItem,
public QGraphicsLayoutItem
76 Q_INTERFACES(QGraphicsLayoutItem)
81 Text (QGraphicsItem *_parent = 0);
82 Text (
const QString &_text, QGraphicsItem *_parent = 0);
91 QPainterPath
shape ()
const;
94 virtual void paint (QPainter *_painter,
const QStyleOptionGraphicsItem *_option, QWidget *_widget = 0);
124 void setText (QString _text) {text_ = _text; update (); };
127 QString
text () {
return text_; };
132 virtual QSizeF sizeHint ( Qt::SizeHint _which,
const QSizeF & _constraint = QSizeF())
const;
140 QBrush backgroundBrush_;
146 Qt::Alignment alignment_;
void setBackground(bool _leftOut, bool _rightOut)
Enables background painting.
void setHorizontalStretch(bool _stretch)
Should this widget be stretchable in horizontal direction.
virtual void setGeometry(const QRectF &_rect)
Sets the geometry.
Text(QGraphicsItem *_parent=0)
Constructor.
virtual QRectF boundingRect() const
Bounding rectangle.
QBrush backgroundBrush()
Returns the current background brush.
virtual void setBackgroundBrush(QBrush _brush)
Sets the background brush.
QPen backgroundPen()
Returns the current background pen.
virtual void setBackgroundPen(QPen _pen)
Sets the background pen.
void setAlignment(Qt::Alignment _alignment)
Placement of the text in a stretched widget.
void setText(QString _text)
Set displayed text.
virtual void paint(QPainter *_painter, const QStyleOptionGraphicsItem *_option, QWidget *_widget=0)
Background painting.
QString text()
Get displayed text.
void clearBackground()
Disables backgorund painting.
QPainterPath shape() const
Returns the shape for proper repainting/event handling.