c++ - QStateMachine how it works -


i've created 4 different qstate , want hide 1 object in evry state transition.

this code:

qstatemachine partita;  qstate *inizio_mano = new qstate(); qstate *aspetto_g1_primo = new qstate(); qstate *aspetto_g1_secondo = new qstate(); qfinalstate *fine_mano = new qfinalstate();  partita.setinitialstate(inizio_mano);  inizio_mano -> addtransition(this,presa==true,aspetto_g1_primo); inizio_mano -> addtransition(this,presa==false,aspetto_g1_secondo); aspetto_g1_primo -> addtransition(this,stato==true,fine_mano); aspetto_g1_secondo -> addtransition(this,stato==true,fine_mano); 

presa , stato 2 bool change in next step of program.

now have qgraphicsscene , in scene i've added in qgraphicspixmapitem.

for example want update scene hiding item:

if(presa==true) {object1->hide();}  

i understand have change qstate (in case inizio_mano aspetto_g1_primo), , i've done adding transition.

but how can hide item ?

how can connect qstate aspetto_g1_primo object1 -> hide();

i hope explained correctly.

my main problem is: how assign each qstate different configuration of scene ?

you have properties of qwidget here: http://doc.qt.io/qt-5/qwidget.html#properties

each child class have own additional properties, in doc.

so can :

aspetto_g1_primo->assignproperty(object1, "visible", false); 

then when entering state property "visible" of object1 set false.

you can same edit any other property depending on state, such geometry, stylesheet, or text of labels...