PDA

View Full Version : QWizard: avoid to go next when pressing enter [Qt4.5]



kalos80
3rd June 2009, 11:46
Hi all,

I'm creating a simple wizard.
The first page has a combo box. When I write something in the combobox and them commit the new text pressing the enter or return key, the combobox text is commited but the wizard passes to the next page.

Is there a way to disable this behavior?
I do not want to pass to the next page when the user commits the combobox text.

Thanks in advance for your help!

freezeblue
3rd June 2009, 14:20
Re-implement the virtual function keyPressEvent (QKeyEvent * event) of your wizard page. And seize the event of Qt::Key_Enter and Qt::Key_Backspace, then cal event->accept() without doing anything with these events. However, if wanna submit something, do it after catching these events and before calling event->accept();

kalos80
3rd June 2009, 17:11
Thanks Freezeblue for your solution, it is working very well!