View Full Version : QSpinBox doesn't consume the enter key

18th May 2011, 16:42
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?

Santosh Reddy
18th May 2011, 20:30
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