The following class members are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.
QString | keyToString ( QKeySequence k ) (obsolete) |
QKeySequence | stringToKey ( const QString & s ) (obsolete) |
Creates an accelerator string for the key k. For instance CTRL+Key_O gives "Ctrl+O". The "Ctrl" etc. are translated (using QObject::tr()) in the "Q3Accel" context.
The function is superfluous. Cast the QKeySequence k to a QString for the same effect.
Returns an accelerator code for the string s. For example "Ctrl+O" gives CTRL+UNICODE_ACCEL+'O'. The strings "Ctrl", "Shift", "Alt" are recognized, as well as their translated equivalents in the "Q3Accel" context (using QObject::tr()). Returns 0 if s is not recognized.
This function is typically used with tr(), so that accelerator keys can be replaced in translations:
Q3PopupMenu *file = new Q3PopupMenu(this); file->insertItem(p1, tr("&Open..."), this, SLOT(open()), Q3Accel::stringToKey(tr("Ctrl+O", "File|Open")));
Notice the "File|Open" translator comment. It is by no means necessary, but it provides some context for the human translator.
The function is superfluous. Construct a QKeySequence from the string s for the same effect.
See also QObject::tr() and Internationalization with Qt.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.