コード例 #1
0
void FormEditorItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
    if (!painter->isActive())
        return;

    if (!qmlItemNode().isValid())
        return;

    painter->save();

    if (qmlItemNode().instanceIsRenderPixmapNull() || !isContentVisible()) {
        if (scene()->showBoundingRects() && m_boundingRect.width() > 15 && m_boundingRect.height() > 15)
            paintPlaceHolderForInvisbleItem(painter);
    } else {
        if (m_blurContent)
            painter->drawPixmap(boundingRect().topLeft(), qmlItemNode().instanceBlurredRenderPixmap());
        else
            painter->drawPixmap(boundingRect().topLeft(), qmlItemNode().instanceRenderPixmap());
    }

    if (!qmlItemNode().isRootModelNode())
        paintBoundingRect(painter);

//    if (qmlItemNode().modelNode().metaInfo().isSubclassOf("QtQuick.Loader", -1, -1))
//        paintComponentContentVisualisation(painter, boundingRect());

    painter->restore();
}
コード例 #2
0
void FormEditorItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
    if (!qmlItemNode().isValid())
        return;

    painter->save();

    if (isContentVisible())
        qmlItemNode().paintInstance(painter);

    if (!qmlItemNode().isRootModelNode())
        paintBoundingRect(painter);

    painter->restore();
}