Results 1 to 2 of 2

Thread: QSpinBox doesn't consume the enter key

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QSpinBox doesn't consume the enter key

    Apparently QSpinBox doesn't consume the enter key, meaning that when the enter key is pressed when the spinbox is in focus, the key press is still propagated to the parent widget. Everything else is fine. Numbers, letters and the arrow keys are all consumed, but not the enter key. In my case this is really bad, because the parent also does something with the enter key. Is there anything I can do about this?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QSpinBox doesn't consume the enter key

    You can sub class QSpinBox, reimplement only keyReleaseEvent() method, and comsume the enter key and call the base class implementation of QSpinBox::keyReleaseEvent() if the key is not enter key

  3. The following user says thank you to Santosh Reddy for this useful post:

    Cruz (19th May 2011)

Similar Threads

  1. How to disable enter
    By phillip_Qt in forum Qt Programming
    Replies: 11
    Last Post: 23rd August 2012, 07:52
  2. QMessageBox with Enter key
    By dima in forum Qt Programming
    Replies: 1
    Last Post: 1st May 2011, 11:15
  3. Do resources in QRC files consume memory?
    By TheNewGuy in forum Newbie
    Replies: 1
    Last Post: 7th December 2009, 08:07
  4. Replies: 1
    Last Post: 14th September 2008, 23:05
  5. QGraphicsScene doesn't enter drag event
    By Radagast in forum Qt Programming
    Replies: 8
    Last Post: 16th June 2008, 17:21

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.