[][src]Struct qt_widgets::QGraphicsRectItem

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

The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.

C++ class: QGraphicsRectItem.

C++ documentation:

The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.

To set the item's rectangle, pass a QRectF to QGraphicsRectItem's constructor, or call the setRect() function. The rect() function returns the current rectangle.

QGraphicsRectItem uses the rectangle and the pen width to provide a reasonable implementation of boundingRect(), shape(), and contains(). The paint() function draws the rectangle using the item's associated pen and brush, which you can set by calling the setPen() and setBrush() functions.

Note: The rendering of invalid rectangles, such as those with negative widths or heights, is undefined. If you cannot be sure that you are using valid rectangles (for example, if you are creating rectangles using data from an unreliable source) then you should use QRectF::normalized() to create normalized rectangles, and use those instead.

Methods

impl QGraphicsRectItem[src]

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

Reimplemented from QGraphicsItem::boundingRect().

Calls C++ function: virtual QRectF QGraphicsRectItem::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 QGraphicsRectItem::contains(const QPointF& point) const.

C++ documentation:

Reimplemented from QGraphicsItem::contains().

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

Reimplemented from QGraphicsItem::isObscuredBy().

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

C++ documentation:

Reimplemented from QGraphicsItem::isObscuredBy().

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

Constructs a QGraphicsRectItem. parent is passed to QAbstractGraphicsShapeItem's constructor.

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

C++ documentation:

Constructs a QGraphicsRectItem. parent is passed to QAbstractGraphicsShapeItem's constructor.

See also QGraphicsScene::addItem().

pub unsafe fn from_q_rect_f_q_graphics_item(
    rect: impl CastInto<Ref<QRectF>>,
    parent: impl CastInto<Ptr<QGraphicsItem>>
) -> CppBox<QGraphicsRectItem>
[src]

Constructs a QGraphicsRectItem, using rect as the default rectangle. parent is passed to QAbstractGraphicsShapeItem's constructor.

Calls C++ function: [constructor] void QGraphicsRectItem::QGraphicsRectItem(const QRectF& rect, QGraphicsItem* parent = …).

C++ documentation:

Constructs a QGraphicsRectItem, using rect as the default rectangle. parent is passed to QAbstractGraphicsShapeItem's constructor.

See also QGraphicsScene::addItem().

pub unsafe fn from_4_double_q_graphics_item(
    x: c_double,
    y: c_double,
    w: c_double,
    h: c_double,
    parent: impl CastInto<Ptr<QGraphicsItem>>
) -> CppBox<QGraphicsRectItem>
[src]

Constructs a QGraphicsRectItem with a default rectangle defined by (x, y) and the given width and height.

Calls C++ function: [constructor] void QGraphicsRectItem::QGraphicsRectItem(double x, double y, double w, double h, QGraphicsItem* parent = …).

C++ documentation:

Constructs a QGraphicsRectItem with a default rectangle defined by (x, y) and the given width and height.

parent is passed to QAbstractGraphicsShapeItem's constructor.

See also QGraphicsScene::addItem().

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

The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.

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

C++ documentation:

The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.

To set the item's rectangle, pass a QRectF to QGraphicsRectItem's constructor, or call the setRect() function. The rect() function returns the current rectangle.

QGraphicsRectItem uses the rectangle and the pen width to provide a reasonable implementation of boundingRect(), shape(), and contains(). The paint() function draws the rectangle using the item's associated pen and brush, which you can set by calling the setPen() and setBrush() functions.

Note: The rendering of invalid rectangles, such as those with negative widths or heights, is undefined. If you cannot be sure that you are using valid rectangles (for example, if you are creating rectangles using data from an unreliable source) then you should use QRectF::normalized() to create normalized rectangles, and use those instead.

pub unsafe fn from_q_rect_f(
    rect: impl CastInto<Ref<QRectF>>
) -> CppBox<QGraphicsRectItem>
[src]

Constructs a QGraphicsRectItem, using rect as the default rectangle. parent is passed to QAbstractGraphicsShapeItem's constructor.

Calls C++ function: [constructor] void QGraphicsRectItem::QGraphicsRectItem(const QRectF& rect).

C++ documentation:

Constructs a QGraphicsRectItem, using rect as the default rectangle. parent is passed to QAbstractGraphicsShapeItem's constructor.

See also QGraphicsScene::addItem().

pub unsafe fn from_4_double(
    x: c_double,
    y: c_double,
    w: c_double,
    h: c_double
) -> CppBox<QGraphicsRectItem>
[src]

Constructs a QGraphicsRectItem with a default rectangle defined by (x, y) and the given width and height.

Calls C++ function: [constructor] void QGraphicsRectItem::QGraphicsRectItem(double x, double y, double w, double h).

C++ documentation:

Constructs a QGraphicsRectItem with a default rectangle defined by (x, y) and the given width and height.

parent is passed to QAbstractGraphicsShapeItem's constructor.

See also QGraphicsScene::addItem().

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

Reimplemented from QGraphicsItem::opaqueArea().

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

C++ documentation:

Reimplemented from QGraphicsItem::opaqueArea().

pub unsafe fn paint_3a(
    &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 QGraphicsRectItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = …).

C++ documentation:

Reimplemented from QGraphicsItem::paint().

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

Reimplemented from QGraphicsItem::paint().

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

C++ documentation:

Reimplemented from QGraphicsItem::paint().

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

Returns the item's rectangle.

Calls C++ function: QRectF QGraphicsRectItem::rect() const.

C++ documentation:

Returns the item's rectangle.

See also setRect().

pub unsafe fn set_rect_1a(&self, rect: impl CastInto<Ref<QRectF>>)[src]

Sets the item's rectangle to be the given rectangle.

Calls C++ function: void QGraphicsRectItem::setRect(const QRectF& rect).

C++ documentation:

Sets the item's rectangle to be the given rectangle.

See also rect().

pub unsafe fn set_rect_4a(
    &self,
    x: c_double,
    y: c_double,
    w: c_double,
    h: c_double
)
[src]

Sets the item's rectangle to the rectangle defined by (x, y) and the given width and height.

Calls C++ function: void QGraphicsRectItem::setRect(double x, double y, double w, double h).

C++ documentation:

Sets the item's rectangle to the rectangle defined by (x, y) and the given width and height.

This convenience function is equivalent to calling setRect(QRectF(x, y, width, height))

See also rect().

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

Reimplemented from QGraphicsItem::shape().

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

C++ documentation:

Reimplemented from QGraphicsItem::shape().

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

Reimplemented from QGraphicsItem::type().

Calls C++ function: virtual int QGraphicsRectItem::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 QGraphicsRectItem[src]

unsafe fn delete(&self)[src]

Destroys the QGraphicsRectItem.

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

C++ documentation:

Destroys the QGraphicsRectItem.

impl Deref for QGraphicsRectItem[src]

type Target = QAbstractGraphicsShapeItem

The resulting type after dereferencing.

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

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

impl DynamicCast<QGraphicsRectItem> for QAbstractGraphicsShapeItem[src]

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

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

impl DynamicCast<QGraphicsRectItem> for QGraphicsItem[src]

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

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

impl StaticDowncast<QGraphicsRectItem> for QAbstractGraphicsShapeItem[src]

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

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

impl StaticDowncast<QGraphicsRectItem> for QGraphicsItem[src]

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

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

impl StaticUpcast<QAbstractGraphicsShapeItem> for QGraphicsRectItem[src]

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

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

impl StaticUpcast<QGraphicsItem> for QGraphicsRectItem[src]

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

Calls C++ function: QGraphicsItem* static_cast<QGraphicsItem*>(QGraphicsRectItem* 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.