[−][src]Struct qt_widgets::QGraphicsRectItem
The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.
C++ class: QGraphicsRectItem
.
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
.
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
.
Reimplemented from QGraphicsItem::contains().
pub unsafe fn is_obscured_by(
&self,
item: impl CastInto<Ptr<QGraphicsItem>>
) -> bool
[src]
&self,
item: impl CastInto<Ptr<QGraphicsItem>>
) -> bool
Reimplemented from QGraphicsItem::isObscuredBy().
Calls C++ function: virtual bool QGraphicsRectItem::isObscuredBy(const QGraphicsItem* item) const
.
Reimplemented from QGraphicsItem::isObscuredBy().
pub unsafe fn from_q_graphics_item(
parent: impl CastInto<Ptr<QGraphicsItem>>
) -> CppBox<QGraphicsRectItem>
[src]
parent: impl CastInto<Ptr<QGraphicsItem>>
) -> CppBox<QGraphicsRectItem>
Constructs a QGraphicsRectItem. parent is passed to QAbstractGraphicsShapeItem's constructor.
Calls C++ function: [constructor] void QGraphicsRectItem::QGraphicsRectItem(QGraphicsItem* parent = …)
.
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]
rect: impl CastInto<Ref<QRectF>>,
parent: impl CastInto<Ptr<QGraphicsItem>>
) -> CppBox<QGraphicsRectItem>
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 = …)
.
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]
x: c_double,
y: c_double,
w: c_double,
h: c_double,
parent: impl CastInto<Ptr<QGraphicsItem>>
) -> CppBox<QGraphicsRectItem>
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 = …)
.
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()
.
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]
rect: impl CastInto<Ref<QRectF>>
) -> CppBox<QGraphicsRectItem>
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)
.
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]
x: c_double,
y: c_double,
w: c_double,
h: c_double
) -> CppBox<QGraphicsRectItem>
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)
.
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
.
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]
&self,
painter: impl CastInto<Ptr<QPainter>>,
option: impl CastInto<Ptr<QStyleOptionGraphicsItem>>,
widget: impl CastInto<Ptr<QWidget>>
)
Reimplemented from QGraphicsItem::paint().
Calls C++ function: virtual void QGraphicsRectItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = …)
.
Reimplemented from QGraphicsItem::paint().
pub unsafe fn paint_2a(
&self,
painter: impl CastInto<Ptr<QPainter>>,
option: impl CastInto<Ptr<QStyleOptionGraphicsItem>>
)
[src]
&self,
painter: impl CastInto<Ptr<QPainter>>,
option: impl CastInto<Ptr<QStyleOptionGraphicsItem>>
)
Reimplemented from QGraphicsItem::paint().
Calls C++ function: virtual void QGraphicsRectItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option)
.
Reimplemented from QGraphicsItem::paint().
pub unsafe fn rect(&self) -> CppBox<QRectF>
[src]
Returns the item's rectangle.
Calls C++ function: QRectF QGraphicsRectItem::rect() const
.
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)
.
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]
&self,
x: c_double,
y: c_double,
w: c_double,
h: c_double
)
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)
.
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
.
Reimplemented from QGraphicsItem::shape().
pub unsafe fn type_(&self) -> c_int
[src]
Reimplemented from QGraphicsItem::type().
Calls C++ function: virtual int QGraphicsRectItem::type() const
.
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
.
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]
&self,
item: impl CastInto<Ptr<QGraphicsItem>>
) -> bool
Reimplemented from QGraphicsItem::isObscuredBy().
Calls C++ function: virtual bool QAbstractGraphicsShapeItem::isObscuredBy(const QGraphicsItem* item) const
.
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
.
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
.
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)
.
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)
.
Trait Implementations
impl CppDeletable for QGraphicsRectItem
[src]
unsafe fn delete(&self)
[src]
Destroys the QGraphicsRectItem.
Calls C++ function: virtual [destructor] void QGraphicsRectItem::~QGraphicsRectItem()
.
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]
ptr: Ptr<QAbstractGraphicsShapeItem>
) -> Ptr<QGraphicsRectItem>
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]
ptr: Ptr<QAbstractGraphicsShapeItem>
) -> Ptr<QGraphicsRectItem>
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]
ptr: Ptr<QGraphicsRectItem>
) -> Ptr<QAbstractGraphicsShapeItem>
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
impl RefUnwindSafe for QGraphicsRectItem
impl Send for QGraphicsRectItem
impl Sync for QGraphicsRectItem
impl Unpin for QGraphicsRectItem
impl UnwindSafe for QGraphicsRectItem
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> CastInto<U> for T where
U: CastFrom<T>,
[src]
U: CastFrom<T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StaticUpcast<T> for T
[src]
unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,