QSGSimpleRectNode Class

The QSGSimpleRectNode class is a convenience class for drawing solid filled rectangles using scenegraph. 更多...

头: #include <QSGSimpleRectNode>
CMake: find_package(Qt6 REQUIRED COMPONENTS Quick)
target_link_libraries(mytarget PRIVATE Qt6::Quick)
qmake: QT += quick
继承: QSGGeometryNode

公共函数

QSGSimpleRectNode (const QRectF & rect , const QColor & color )
QSGSimpleRectNode ()
QColor color () const
QRectF rect () const
void setColor (const QColor & color )
void setRect (const QRectF & rect )
void setRect (qreal x , qreal y , qreal w , qreal h )

详细描述

警告: This utility class is only functional when running with the default or software backends of the Qt Quick scenegraph. As an alternative, prefer using QSGRectangleNode 凭借 QQuickWindow::createRectangleNode (). However, this standalone class is still useful when used via subclassing and the application knows that no special scenegraph backends will be involved.

成员函数文档编制

QSGSimpleRectNode:: QSGSimpleRectNode (const QRectF & rect , const QColor & color )

Constructs a QSGSimpleRectNode instance which is spanning rect with the color color .

QSGSimpleRectNode:: QSGSimpleRectNode ()

Constructs a QSGSimpleRectNode instance with an empty rectangle and white color.

QColor QSGSimpleRectNode:: color () const

Returns the color of this rectangle.

另请参阅 setColor ().

QRectF QSGSimpleRectNode:: rect () const

Returns the rectangle that this rect node covers.

另请参阅 setRect ().

void QSGSimpleRectNode:: setColor (const QColor & color )

Sets the color of this rectangle to color . The default color will be white.

另请参阅 color ().

void QSGSimpleRectNode:: setRect (const QRectF & rect )

Sets the rectangle of this rect node to rect .

另请参阅 rect ().

void QSGSimpleRectNode:: setRect ( qreal x , qreal y , qreal w , qreal h )

这是重载函数。

Sets the rectangle of this rect node to begin at ( x , y ) and have width w 和高度 h .