Keep me logged in for two weeks
Login using OpenID
Forgot your password?
What are you waiting for? Just register and start collecting points. It's fun!
the widget should respond to enter key.
Are you talking from standard or custom widgets?
You could subclass the widget, overwrite the keyPressEvent and do it there.
Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)
but inside key press event does i have to use Qobject::connect to make the enter to respond or some other way can you give example?
I guess subclassing you have to intercept the enter key and manually call the function that implements the slot “clicked” in your button, or “triggered” if it is an action, and so on.
I’m a bit confused.
If you have for example a QPushButton and want it to emit a clicked signal in case a B key is pressed, you overwrite keyPressEvent, make an if to check for the B and then emit the needed signal.
You can just make your button the default button on the form.
That will make it respond to an Enter click anywhere in the form, except when the currently focussed widget accepts the enter key itself (like a QPlainTextEdit widget).
Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/
You must log in to post
a reply. Not a member yet? Register here!
© 2014 Qt Project Hosting. Qt® and the Qt logo is a registered trade mark of Digia plc and/or its subsidiaries and is used pursuant to a license from Digia plc and/or its subsidiaries.
This site is hosted by Gitorious AS. Your use of this web site is governed by these terms of service.
Qt Project Hosting, P.O. Box 4332 Nydalen, 0402 Oslo, Norway. Org. Nr. 997 447 913
You are about to flag this item as unappropriate.