QQuickItem class 的 boundingRect 从哪里得到它的值?
Where does the boundingRect of QQuickItem class get its values from?
http://doc.qt.io/qt-5/qquickitem.html
QSGNode *MyItem::updatePaintNode(QSGNode *node, UpdatePaintNodeData *)
{
QSGSimpleRectNode *n = static_cast<QSGSimpleRectNode *>(node);
if (!n) {
n = new QSGSimpleRectNode();
n->setColor(Qt::red);
}
n->setRect(boundingRect());
return n;
}
我查看了 "list all members" 列表,在那里找不到它:http://doc.qt.io/qt-5/qquickitem-members.html
根据项目的宽度和高度得出:
QRectF QQuickItem::boundingRect() const
{
Q_D(const QQuickItem);
return QRectF(0, 0, d->width, d->height);
}
http://doc.qt.io/qt-5/qquickitem.html
QSGNode *MyItem::updatePaintNode(QSGNode *node, UpdatePaintNodeData *)
{
QSGSimpleRectNode *n = static_cast<QSGSimpleRectNode *>(node);
if (!n) {
n = new QSGSimpleRectNode();
n->setColor(Qt::red);
}
n->setRect(boundingRect());
return n;
}
我查看了 "list all members" 列表,在那里找不到它:http://doc.qt.io/qt-5/qquickitem-members.html
根据项目的宽度和高度得出:
QRectF QQuickItem::boundingRect() const
{
Q_D(const QQuickItem);
return QRectF(0, 0, d->width, d->height);
}