this is my simple code:
I've created a new scene
, view
and QPixmapItem
QGraphicsScene *scena = new QGraphicsScene();
QGraphicsPixmapItem *object1= new QGraphicsPixmapItem();
object1->setPixmap(QPixmap(":/prova/prova.png"));
QGraphicsView *view = new QGraphicsView();
view->setScene(scena);
scena->addItem(object1);
view->show();
and next I've created a new QStateMachine
with two QState
QStateMachine *machine = new QStateMachine();
QState *s1 = new QState();
QState *s2 = new QState();
machine -> addState(s1);
machine -> addState(s2);
//mouse click in a void mousePressEvent
s1 -> addTransition(this,SIGNAL(mouseclick()),s2);
machine -> start();
I want to show the
view
ins1
and setobject1
visible.With a mouse click on the scene I've added a transition to
s2
.In
s2
I want to hide onlyobject1
.
How can I do this? Someone can help me with a small tutorial?
I'm using Qt 5.6.0 with MinGW 4.9.2 32bit.