Question

In my Qt symbian app, I have over ride the negative exit button with back to come back on main screen and then again over ride it with exit to close the app, my app is working fine on emulator but when I test it on device it shows exit button instead of back, some time it shows back also but if I go to the same page twice then again it start showing exit button, frustrating part is that app is working fine on Qt emulator but not on device. Does somebody knows whats the problem is. I am using

back->setSoftKeyRole(QAction::NegativeSoftKey);
this->addAction(back);

to over ride the exit button before loading the screen and

back->setSoftKeyRole(QAction::NegativeSoftKey);
this->removeAction(back);

to removing back button when coming back to mainWindow.

Était-ce utile?

La solution

Create vertical layout and Widget which You will add on scrollarea with parent as that class this e.g

QVBoxLayout *vlay = new QVBoxLayout(this); 
QWidget *area = new QWidget(this)

And add widget to it This will make it child of parent class. works fine for me.

Autres conseils

I think adding and removing QAction objects here and there is asking for problems. You should try to redesign your application to use a QStateMachine to handle transitions between states. Take a look at the introductory documentation here.

Refer this LINK for custom softkeys..

QAction* myAction= new QAction(tr("My Action"), this);
myAction->setSoftKeyRole(QAction::NegativeSoftKey);
addAction(myAction);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top