[][src]Struct qt_widgets::QGraphicsSimpleTextItem

#[repr(C)]pub struct QGraphicsSimpleTextItem { /* fields omitted */ }

The QGraphicsSimpleTextItem class provides a simple text path item that you can add to a QGraphicsScene.

C++ class: QGraphicsSimpleTextItem.

C++ documentation:

The QGraphicsSimpleTextItem class provides a simple text path item that you can add to a QGraphicsScene.

To set the item's text, you can either pass a QString to QGraphicsSimpleTextItem's constructor, or call setText() to change the text later. To set the text fill color, call setBrush().

The simple text item can have both a fill and an outline; setBrush() will set the text fill (i.e., text color), and setPen() sets the pen that will be used to draw the text outline. (The latter can be slow, especially for complex pens, and items with long text content.) If all you want is to draw a simple line of text, you should call setBrush() only, and leave the pen unset; QGraphicsSimpleTextItem's pen is by default Qt::NoPen.

QGraphicsSimpleTextItem uses the text's formatted size and the associated font to provide a reasonable implementation of boundingRect(), shape(), and contains(). You can set the font by calling setFont().

QGraphicsSimpleText does not display rich text; instead, you can use QGraphicsTextItem, which provides full text control capabilities.

Methods

impl QGraphicsSimpleTextItem[src]

pub unsafe fn bounding_rect(&self) -> CppBox<QRectF>[src]

Reimplemented from QGraphicsItem::boundingRect().

Calls C++ function: virtual QRectF QGraphicsSimpleTextItem::boundingRect() const.

C++ documentation:

Reimplemented from QGraphicsItem::boundingRect().

pub unsafe fn contains(&self, point: impl CastInto<Ref<QPointF>>) -> bool[src]

Reimplemented from QGraphicsItem::contains().

Calls C++ function: virtual bool QGraphicsSimpleTextItem::contains(const QPointF& point) const.

C++ documentation:

Reimplemented from QGraphicsItem::contains().

pub unsafe fn font(&self) -> CppBox<QFont>[src]

Returns the font that is used to draw the item's text.

Calls C++ function: QFont QGraphicsSimpleTextItem::font() const.

C++ documentation:

Returns the font that is used to draw the item's text.

See also setFont().

pub unsafe fn is_obscured_by(
    &self,
    item: impl CastInto<Ptr<QGraphicsItem>>
) -> bool
[src]

Reimplemented from QGraphicsItem::isObscuredBy().

Calls C++ function: virtual bool QGraphicsSimpleTextItem::isObscuredBy(const QGraphicsItem* item) const.

C++ documentation:

Reimplemented from QGraphicsItem::isObscuredBy().

pub unsafe fn from_q_graphics_item(
    parent: impl CastInto<Ptr<QGraphicsItem>>
) -> CppBox<QGraphicsSimpleTextItem>
[src]

Constructs a QGraphicsSimpleTextItem.

Calls C++ function: [constructor] void QGraphicsSimpleTextItem::QGraphicsSimpleTextItem(QGraphicsItem* parent = …).

C++ documentation:

Constructs a QGraphicsSimpleTextItem.

parent is passed to QGraphicsItem's constructor.

See also QGraphicsScene::addItem().

pub unsafe fn from_q_string_q_graphics_item(
    text: impl CastInto<Ref<QString>>,
    parent: impl CastInto<Ptr<QGraphicsItem>>
) -> CppBox<QGraphicsSimpleTextItem>
[src]

Constructs a QGraphicsSimpleTextItem, using text as the default plain text.

Calls C++ function: [constructor] void QGraphicsSimpleTextItem::QGraphicsSimpleTextItem(const QString& text, QGraphicsItem* parent = …).

C++ documentation:

Constructs a QGraphicsSimpleTextItem, using text as the default plain text.

parent is passed to QGraphicsItem's constructor.

See also QGraphicsScene::addItem().

pub unsafe fn new() -> CppBox<QGraphicsSimpleTextItem>[src]

The QGraphicsSimpleTextItem class provides a simple text path item that you can add to a QGraphicsScene.

Calls C++ function: [constructor] void QGraphicsSimpleTextItem::QGraphicsSimpleTextItem().

C++ documentation:

The QGraphicsSimpleTextItem class provides a simple text path item that you can add to a QGraphicsScene.

To set the item's text, you can either pass a QString to QGraphicsSimpleTextItem's constructor, or call setText() to change the text later. To set the text fill color, call setBrush().

The simple text item can have both a fill and an outline; setBrush() will set the text fill (i.e., text color), and setPen() sets the pen that will be used to draw the text outline. (The latter can be slow, especially for complex pens, and items with long text content.) If all you want is to draw a simple line of text, you should call setBrush() only, and leave the pen unset; QGraphicsSimpleTextItem's pen is by default Qt::NoPen.

QGraphicsSimpleTextItem uses the text's formatted size and the associated font to provide a reasonable implementation of boundingRect(), shape(), and contains(). You can set the font by calling setFont().

QGraphicsSimpleText does not display rich text; instead, you can use QGraphicsTextItem, which provides full text control capabilities.

pub unsafe fn from_q_string(
    text: impl CastInto<Ref<QString>>
) -> CppBox<QGraphicsSimpleTextItem>
[src]

Constructs a QGraphicsSimpleTextItem, using text as the default plain text.

Calls C++ function: [constructor] void QGraphicsSimpleTextItem::QGraphicsSimpleTextItem(const QString& text).

C++ documentation:

Constructs a QGraphicsSimpleTextItem, using text as the default plain text.

parent is passed to QGraphicsItem's constructor.

See also QGraphicsScene::addItem().

pub unsafe fn opaque_area(&self) -> CppBox<QPainterPath>[src]

Reimplemented from QGraphicsItem::opaqueArea().

Calls C++ function: virtual QPainterPath QGraphicsSimpleTextItem::opaqueArea() const.

C++ documentation:

Reimplemented from QGraphicsItem::opaqueArea().

pub unsafe fn paint(
    &self,
    painter: impl CastInto<Ptr<QPainter>>,
    option: impl CastInto<Ptr<QStyleOptionGraphicsItem>>,
    widget: impl CastInto<Ptr<QWidget>>
)
[src]

Reimplemented from QGraphicsItem::paint().

Calls C++ function: virtual void QGraphicsSimpleTextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget).

C++ documentation:

Reimplemented from QGraphicsItem::paint().

pub unsafe fn set_font(&self, font: impl CastInto<Ref<QFont>>)[src]

Sets the font that is used to draw the item's text to font.

Calls C++ function: void QGraphicsSimpleTextItem::setFont(const QFont& font).

C++ documentation:

Sets the font that is used to draw the item's text to font.

See also font().

pub unsafe fn set_text(&self, text: impl CastInto<Ref<QString>>)[src]

Sets the item's text to text. The text will be displayed as plain text. Newline characters ('\n') as well as characters of type QChar::LineSeparator will cause item to break the text into multiple lines.

Calls C++ function: void QGraphicsSimpleTextItem::setText(const QString& text).

C++ documentation:

Sets the item's text to text. The text will be displayed as plain text. Newline characters ('\n') as well as characters of type QChar::LineSeparator will cause item to break the text into multiple lines.

See also text().

pub unsafe fn shape(&self) -> CppBox<QPainterPath>[src]

Reimplemented from QGraphicsItem::shape().

Calls C++ function: virtual QPainterPath QGraphicsSimpleTextItem::shape() const.

C++ documentation:

Reimplemented from QGraphicsItem::shape().

pub unsafe fn text(&self) -> CppBox<QString>[src]

Returns the item's text.

Calls C++ function: QString QGraphicsSimpleTextItem::text() const.

C++ documentation:

Returns the item's text.

See also setText().

pub unsafe fn type_(&self) -> c_int[src]

Reimplemented from QGraphicsItem::type().

Calls C++ function: virtual int QGraphicsSimpleTextItem::type() const.

C++ documentation:

Reimplemented from QGraphicsItem::type().

Methods from Deref<Target = QAbstractGraphicsShapeItem>

pub unsafe fn brush(&self) -> CppBox<QBrush>[src]

Returns the item's brush, or an empty brush if no brush has been set.

Calls C++ function: QBrush QAbstractGraphicsShapeItem::brush() const.

C++ documentation:

Returns the item's brush, or an empty brush if no brush has been set.

See also setBrush().

pub unsafe fn is_obscured_by(
    &self,
    item: impl CastInto<Ptr<QGraphicsItem>>
) -> bool
[src]

Reimplemented from QGraphicsItem::isObscuredBy().

Calls C++ function: virtual bool QAbstractGraphicsShapeItem::isObscuredBy(const QGraphicsItem* item) const.

C++ documentation:

Reimplemented from QGraphicsItem::isObscuredBy().

pub unsafe fn opaque_area(&self) -> CppBox<QPainterPath>[src]

Reimplemented from QGraphicsItem::opaqueArea().

Calls C++ function: virtual QPainterPath QAbstractGraphicsShapeItem::opaqueArea() const.

C++ documentation:

Reimplemented from QGraphicsItem::opaqueArea().

pub unsafe fn pen(&self) -> CppBox<QPen>[src]

Returns the item's pen. If no pen has been set, this function returns QPen(), a default black solid line pen with 1 width.

Calls C++ function: QPen QAbstractGraphicsShapeItem::pen() const.

C++ documentation:

Returns the item's pen. If no pen has been set, this function returns QPen(), a default black solid line pen with 1 width.

See also setPen().

pub unsafe fn set_brush(&self, brush: impl CastInto<Ref<QBrush>>)[src]

Sets the item's brush to brush.

Calls C++ function: void QAbstractGraphicsShapeItem::setBrush(const QBrush& brush).

C++ documentation:

Sets the item's brush to brush.

The item's brush is used to fill the item.

If you use a brush with a QGradient, the gradient is relative to the item's coordinate system.

See also brush().

pub unsafe fn set_pen(&self, pen: impl CastInto<Ref<QPen>>)[src]

Sets the pen for this item to pen.

Calls C++ function: void QAbstractGraphicsShapeItem::setPen(const QPen& pen).

C++ documentation:

Sets the pen for this item to pen.

The pen is used to draw the item's outline.

See also pen().

Trait Implementations

impl CppDeletable for QGraphicsSimpleTextItem[src]

unsafe fn delete(&self)[src]

Destroys the QGraphicsSimpleTextItem.

Calls C++ function: virtual [destructor] void QGraphicsSimpleTextItem::~QGraphicsSimpleTextItem().

C++ documentation:

impl Deref for QGraphicsSimpleTextItem[src]

type Target = QAbstractGraphicsShapeItem

The resulting type after dereferencing.

fn deref(&self) -> &QAbstractGraphicsShapeItem[src]

Calls C++ function: QAbstractGraphicsShapeItem* static_cast<QAbstractGraphicsShapeItem*>(QGraphicsSimpleTextItem* ptr).

impl DynamicCast<QGraphicsSimpleTextItem> for QAbstractGraphicsShapeItem[src]

unsafe fn dynamic_cast(
    ptr: Ptr<QAbstractGraphicsShapeItem>
) -> Ptr<QGraphicsSimpleTextItem>
[src]

Calls C++ function: QGraphicsSimpleTextItem* dynamic_cast<QGraphicsSimpleTextItem*>(QAbstractGraphicsShapeItem* ptr).

impl DynamicCast<QGraphicsSimpleTextItem> for QGraphicsItem[src]

unsafe fn dynamic_cast(ptr: Ptr<QGraphicsItem>) -> Ptr<QGraphicsSimpleTextItem>[src]

Calls C++ function: QGraphicsSimpleTextItem* dynamic_cast<QGraphicsSimpleTextItem*>(QGraphicsItem* ptr).

impl StaticDowncast<QGraphicsSimpleTextItem> for QAbstractGraphicsShapeItem[src]

unsafe fn static_downcast(
    ptr: Ptr<QAbstractGraphicsShapeItem>
) -> Ptr<QGraphicsSimpleTextItem>
[src]

Calls C++ function: QGraphicsSimpleTextItem* static_cast<QGraphicsSimpleTextItem*>(QAbstractGraphicsShapeItem* ptr).

impl StaticDowncast<QGraphicsSimpleTextItem> for QGraphicsItem[src]

unsafe fn static_downcast(
    ptr: Ptr<QGraphicsItem>
) -> Ptr<QGraphicsSimpleTextItem>
[src]

Calls C++ function: QGraphicsSimpleTextItem* static_cast<QGraphicsSimpleTextItem*>(QGraphicsItem* ptr).

impl StaticUpcast<QAbstractGraphicsShapeItem> for QGraphicsSimpleTextItem[src]

unsafe fn static_upcast(
    ptr: Ptr<QGraphicsSimpleTextItem>
) -> Ptr<QAbstractGraphicsShapeItem>
[src]

Calls C++ function: QAbstractGraphicsShapeItem* static_cast<QAbstractGraphicsShapeItem*>(QGraphicsSimpleTextItem* ptr).

impl StaticUpcast<QGraphicsItem> for QGraphicsSimpleTextItem[src]

unsafe fn static_upcast(ptr: Ptr<QGraphicsSimpleTextItem>) -> Ptr<QGraphicsItem>[src]

Calls C++ function: QGraphicsItem* static_cast<QGraphicsItem*>(QGraphicsSimpleTextItem* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.