{
public:
{
painter->drawText(0, 0, "123");
painter->fillRect(0, 0, 128, 128, Qt::green);
painter->beginNativePainting();
glEnable(GL_SCISSOR_TEST);
glScissor(0, 0, 64, 64);
glClearColor(1, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
glDisable(GL_SCISSOR_TEST);
glEnd();
painter->endNativePainting();
}
QRectF boundingRect
(void) const {
return QRectF(0,
0,
100,
100);
}
};
class MyItem:public QGraphicsItem
{
public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
painter->drawText(0, 0, "123");
painter->fillRect(0, 0, 128, 128, Qt::green);
painter->beginNativePainting();
glEnable(GL_SCISSOR_TEST);
glScissor(0, 0, 64, 64);
glClearColor(1, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
glDisable(GL_SCISSOR_TEST);
glEnd();
painter->endNativePainting();
}
QRectF boundingRect(void) const
{
return QRectF(0, 0, 100, 100);
}
};
To copy to clipboard, switch view to plain text mode
Bookmarks