1

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

4

1 回答 1

1

它来自项目的宽度和高度:

QRectF QQuickItem::boundingRect() const
{
    Q_D(const QQuickItem);
    return QRectF(0, 0, d->width, d->height);
}
于 2016-04-20T09:59:00.660 回答