Results 1 to 3 of 3

Thread: QWizard: avoid to go next when pressing enter [Qt4.5]

  1. #1
    Join Date
    Mar 2006
    Posts
    56
    Thanks
    7
    Thanked 3 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QWizard: avoid to go next when pressing enter [Qt4.5]

    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!

  2. #2
    Join Date
    Apr 2009
    Posts
    21
    Thanked 3 Times in 2 Posts

    Default Re: QWizard: avoid to go next when pressing enter [Qt4.5]

    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();

  3. #3
    Join Date
    Mar 2006
    Posts
    56
    Thanks
    7
    Thanked 3 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QWizard: avoid to go next when pressing enter [Qt4.5]

    Thanks Freezeblue for your solution, it is working very well!

Similar Threads

  1. Replies: 2
    Last Post: 17th July 2006, 14:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.