Kolyunya
Kolyunya

Reputation: 6240

Qt4.8 QGraphicsWidget usage

I can't figure out from the docs, how to use QGraphicsWidget to draw something on it.

Can you help me please? I try this code but when I add it to the graphics scene it shows nothing.

class Platform : public QGraphicsWidget
{

    public:
        Platform()
        {

            QGraphicsEllipseItem elipse(0,0,10,10,this);
            setGraphicsItem(&elipse);

        }

};

Upvotes: 0

Views: 1415

Answers (1)

madjar
madjar

Reputation: 12951

QGraphicsWidget is not a widget on which you draw things, it is a widget that can be draw in the Graphics View framework. To draw things, you'll need a QGraphicsScene to hold the items to draw and a QGraphicsView, which is the widget that displays the QGraphicsScene.

You should start with the documentation for the Graphics View framework.

Upvotes: 4

Related Questions