Qtリファレンス Alt Keyのソースを表示
新しいページはコチラ
移動:
案内
,
検索
== '''概要''' == The Alt_Key library consists of four files(Alt_Keyライブラリは4つのファイルを含んでいます。): *alt_key.hpp *alt_key.cpp *kuhn_munkres.hpp *kuhn_munkres.cpp The public API is in alt_key.hpp and uses the AQP namespace.(この公開APIは alt_key.hpp にあります。名前空間AQPで使います。) The library is supplied along with the examples for the book Advanced Qt Programming.(このライブラリは実践Qt Programmingの本のために長く供給されます。) Many of the book's examples use the library.(本の例題の多くは、このライブラリを使います。) The library is also used by the Alt_Key GUI application(このライブラリはAlt_Key GUI アプリケーションでも使われます。). === '''Example(例)''' === Here is a list of menu options before and after Alt_Key has added accelerators(Alt_Keyがアクセラレータを追加する前後のメニューオプションのリストは次のとおりです): Before After Calculate &Calculate New &New Load... &Load... Save &Save Save &As... Save &As... Copy to Clipboard Copy &to Clipboard Set Options... Set &Options... Help &Help About A&bout Quit &Quit Notice that the "Save &As" option already had an accelerator: The Alt_Key library respects manually inserted accelerators. === '''API''' === *Include #include "alt_key.hpp" This includes the kuhn_munkres.hpp file. Either copy the four files into your project or soft link them or add them to your include path. *Constant QString AQP::Alphabet This string holds the characters that are eligible to be used as accelerators: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ. All the functions that take an alphabet argument use this as their default value. If you choose to use a different alphabet you may only use uppercase letters (or no-case letters for languages that don't distinguish case). (Actually this is now an instance of the private AQP::_Alphabet class; the class provides a single method which is a QString conversion function, so in most cases it can be used wherever a QString is expected. The reason for this change is to make the alphabet string translatable.) Main Functions These are the most commonly used functions provided by the Alt_Key library. void AQP::accelerateActions(QList<QAction*> actions, const QString &alphabet=Alphabet) This function takes a list of actions and optionally an alphabet. It adds keyboard accelerators to every action's text wherever possible. Existing accelerators are respected as are plain ampersands (which are represented by "&&" in strings). void AQP::accelerateMenu(QWidget *menuOrMenuBar, const QString &alphabet=Alphabet) This function takes a menu (including context menus) or a main window's menu bar and optionally an alphabet. It adds keyboard accelerators to every menu item's text wherever possible. The function works recursively, adding accelerators to submenus and subsubmenus. Existing accelerators are respected as are plain ampersands (which are represented by "&&" in strings). void AQP::accelerateWidget(QWidget *widget, const QString &alphabet=Alphabet) This function takes a widget (such as a QDialog subclass) and optionally an alphabet. It adds keyboard accelerators to every buddy label, button (i.e., all QAbstractButton subclasses apart from QToolButton), checkbox, checkable group box, and radio button, that is a child of the widget (or grandchild, recursively), wherever possible. Existing accelerators are respected as are plain ampersands (which are represented by "&&" in strings). void AQP::accelerateWidgets(QList<QWidget*> widgets, const QString &alphabet=Alphabet) This function takes a list of widgets (for example, all the widgets on a particular tab widget page) and optionally an alphabet. It adds keyboard accelerators to every suitable widget, (i.e., to every buddy label and button), wherever possible. Existing accelerators are respected as are plain ampersands (which are represented by "&&" in strings). Auxiliary Functions These functions are occassionally useful. QStringList AQP::accelerated(const QStringList &strings, const QString &alphabet=Alphabet) This function takes a list of strings and optionally an alphabet. It returns a new string list with a keyboard accelerator added to every string wherever possible. Existing accelerators are respected as are plain ampersands (which are represented by "&&" in strings). bool AQP::isValid(const QStringList &strings, QPair<int, int> *where=0, const QString &alphabet=Alphabet) This function returns true if the given list of strings has valid accelerators. Valid includes no accelerators, but does not include duplicate accelerators. If the where pair is passed and the function returns false the pair's ints are set to the index of the first string in the list and the index of the character within the string where a problem (e.g., duplicate accelerators) occurred. int AQP::numberAccelerated(const QStringList &strings) This function returns the number of strings in the string list that have accelerators. double AQP::quality(const QStringList &strings) This function returns a rough guide to accelerator quality. For each string the best quality is when the string has an accelerator for its first character, second best is an accelerator for the start of a word, third best is any accelerator at all, and worst is no accelerator. The quality computation accounts for the overall quality of all the strings in the list and returns a value that ranges from 0.0 (worst) to 1.0 (best).
Qtリファレンス Alt Key
に戻る。
個人用ツール
ログイン
名前空間
ページ
議論
変種
表示
閲覧
ソースを表示
履歴表示
操作
検索
案内
メインページ
コミュニティ・ポータル
最近の出来事
最近の更新
おまかせ表示
ヘルプ
ツールボックス
リンク元
関連ページの更新状況
特別ページ