Obsolete Members for Q3Accel

以下成員源於類 Q3Accel 已過時。 提供它們是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它們。

靜態公共成員

(obsolete) QString keyToString (QKeySequence k )
(obsolete) QKeySequence stringToKey (const QString & s )

成員函數文檔編製

[static] QString Q3Accel:: keyToString ( QKeySequence k )

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 上下文。

The function is superfluous. Cast the QKeySequence k QString for the same effect.

[static] QKeySequence Q3Accel:: stringToKey (const QString & s )

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 從字符串 s for the same effect.

另請參閱 QObject::tr () 和 Qt 國際化 .