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