Qt-interest Archive, February 2007
Shortcuts for QDialogButtonBox
Message 1 in thread
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
i use the QDialogButtonBox for standard-buttons like Ok and Cancel. How
can i set a short-cut for these buttons? <ALT>+<O> for Ok and <ALT>+<C>
for cancel for example. Or better: How can i set the system-default
short-cut for such standard-buttons?
thanks & greetings
- --
Andreas 'ar' Richter
http://www.oszine.de - http://ar.oszine.de
GPG-KeyID: 0x7BA12DD9
Fingerprint: D2E9 202B F4F0 EB16 25DE 5FF7 0CF2 3C57 7BA1 2DD9
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF0tGlDPI8V3uhLdkRAoZ+AKCvQzxN0YfnjkZ4t1RnLcWTAjydRwCfYZv7
OQpieem6glrxhrMpPT4MBaw=
=xD/U
-----END PGP SIGNATURE-----
--
[ signature omitted ]
Message 2 in thread
> How
> can i set a short-cut for these buttons? <ALT>+<O> for Ok and <ALT>+<C>
> for cancel for example.
Quick answer: Read the docs of QAbstractButton.
> Or better: How can i set the system-default
> short-cut for such standard-buttons?
System/dialog default for the accept()/reject() slots are Enter and ESC,
respectively. You may want to set up QActions for your dialog(s) with
appropriate shortcuts, or overriding the defaults in
QDialog::keyPressEvent().
Martin
--
[ signature omitted ]
Message 3 in thread
Martin Gebert schrieb:
> System/dialog default for the accept()/reject() slots are Enter and ESC,
> respectively.
Correction: Enter triggers the default/autoDefault button, whereas ESC
triggers closeEvent(). IIRC.
Martin
--
[ signature omitted ]
Message 4 in thread
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Gebert schrieb:
>> How
>> can i set a short-cut for these buttons? <ALT>+<O> for Ok and <ALT>+<C>
>> for cancel for example.
>
> Quick answer: Read the docs of QAbstractButton.
Done.
>> Or better: How can i set the system-default
>> short-cut for such standard-buttons?
>
> System/dialog default for the accept()/reject() slots are Enter and ESC,
> respectively. You may want to set up QActions for your dialog(s) with
> appropriate shortcuts, or overriding the defaults in
> QDialog::keyPressEvent().
My problem is the design of my dialog. The user usually focused a
QTextEdit. And then the Return key are not send to the dialog for accept.
I set now tabChangesFocus to true. So the users can swith out of the
QTextEdit through the keyboard and then hit Return to accept the dialog.
> Martin
- --
Andreas 'ar' Richter
http://www.oszine.de - http://ar.oszine.de
GPG-KeyID: 0x7BA12DD9
Fingerprint: D2E9 202B F4F0 EB16 25DE 5FF7 0CF2 3C57 7BA1 2DD9
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF0uqKDPI8V3uhLdkRAouHAKDnzIK0N/WQZd+xk8tgWQu+wWCoOACeJt2G
ek0jGmjuuUtn+yjfi0lg0iQ=
=9Xf5
-----END PGP SIGNATURE-----
--
[ signature omitted ]