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;
}
我检查了“列出所有成员”列表,但在那里找不到:http://doc.qt.io/qt-5/qquickitem-members.html
答案 0 :(得分:1)
它来自项目的宽度和高度:
QRectF QQuickItem::boundingRect() const
{
Q_D(const QQuickItem);
return QRectF(0, 0, d->width, d->height);
}