I want to code a function to show the basic flow of my GUI like if I call that function in a slot it start transitions in states as FileMenu->Open(signal triggered and enables the slot connected to it) and so on. I tried with state machine as:
d1->assignProperty(ui->menuFile,"visible",true);
d0->addTransition(d1);
d1->addTransition(ui->actionOpen,SIGNAL(triggered()),d0);
dem->addState(d0);
dem->addState(d1);
dem->setInitialState(d0);
dem->start();
File menu is not appearing at the place. Also Signal is not triggered on state transition. I am new to QStateMachine
. I am not sure about triggering a signal this way is possible or not. If yes then and what is wrong in my code or is there any better way to do this?
Edit: file menu correction :
QRect r0 = this->geometry();
QRect tbar = ui->menuBar->geometry();
QRect r = ui->menuFile->geometry();
r.setCoords(r0.x(),r0.y()+tbar.height(),r0.x()+r.width(),r0.y()+r.height()+tbar.height());
ui->menuFile->setGeometry(r);
ui->menuFile->show();