C++ (Qt) void RoundRectItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){ const qreal lod = option->levelOfDetailFromTransform(painter->worldTransform()); if(lod > 10) painter->drawRoundedRect(-10, -10, 20, 20, 5, 5); if(lod > 20) painter->drawRoundedRect(-20, -20, 40, 40, 10, 10);}