Qtリファレンス Alt Keyのソースを表示
新しいページはコチラ
移動:
案内
,
検索
[[Qt#Qtリファレンス|Qtリファレンス]]へ戻る == '''概要''' == <span style="color:#cccccc;">The Alt_Key library consists of four files</span>(Alt_Keyライブラリは4つのファイルを含んでいます。): *alt_key.hpp *alt_key.cpp *kuhn_munkres.hpp *kuhn_munkres.cpp <span style="color:#cccccc;">The public API is in alt_key.hpp and uses the AQP namespace.</span>(この公開APIは alt_key.hpp にあります。名前空間AQPで使います。) <span style="color:#cccccc;">The library is supplied along with the examples for the book Advanced Qt Programming.</span>(このライブラリは実践Qt Programmingの本のために長く供給されます。) <span style="color:#cccccc;">Many of the book's examples use the library.</span>(本の例題の多くは、このライブラリを使います。) <span style="color:#cccccc;">The library is also used by the Alt_Key GUI application.</span>(このライブラリはAlt_Key GUI アプリケーションでも使われます。) === '''Example(例)''' === <span style="color:#cccccc;">Here is a list of menu options before and after Alt_Key has added accelerators</span>(Alt_Keyがアクセラレータを追加する前後のメニューオプションのリストは次のとおりです): <ytmath> <style> table td { background: #eee; padding-left:10px; } table tr:nth-child(odd) td { background: #fff; } </style> <table border=0> <tr><td align="left"><span style="font-weight: bold;">Before</span></td><td align="left"><span style="font-weight: bold;">After</span></td></tr> <tr><td align="left">Calculate</td><td align="left">&Calculate</td></tr> <tr><td align="left">New</td><td align="left">&New</td></tr> <tr><td align="left">Load...</td><td align="left">&Load...</td></tr> <tr><td align="left">Save</td><td align="left">&Save</td></tr> <tr><td align="left">Save &As...</td><td align="left">Save &As...</td></tr> <tr><td align="left">Copy to Clipboard </td><td align="left">Copy &to Clipboard</td></tr> <tr><td align="left">Set Options...</td><td align="left">Set &Options...</td></tr> <tr><td align="left">Help</td><td align="left">&Help</td></tr> <tr><td align="left">About</td><td align="left">A&bout</td></tr> <tr><td align="left">Quit</td><td align="left">&Quit</td></tr> </table> </ytmath> <span style="color:#cccccc;">Notice that the "Save &As" option already had an accelerator</span>([名前を付けて保存]オプションのは既にアクセラレータを持っていることに注意して下さい。): <span style="color:#cccccc;">The Alt_Key library respects manually inserted accelerators.</span>(Alt_Key ライブラリは手動で挿入されたアクセラレータを尊重します。) === '''API''' === *'''<span style="color:#cccccc;">Include</span>(インクルードするファイル)''' #include "alt_key.hpp" <span style="color:#cccccc;">This includes the kuhn_munkres.hpp file.</span>(これはkuhn_munkres.hppファイルをインクルードします。) <span style="color:#cccccc;">Either copy the four files into your project or soft link them or add them to your include path.</span>(4つのファイルをプロジェクトにコピーするか、ソフトリンクするか、インクルードパスに追加します。 ) *'''Constant(定数)''' QString AQP::Alphabet <span style="color:#cccccc;">This string holds the characters that are eligible to be used as accelerators</span>(この文字列は、アクセラレータとして使用できる文字を保持します ): 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ. <span style="color:#cccccc;">All the functions that take an alphabet argument use this as their default value.</span>(アルファベット引数を取るすべての関数は、これをデフォルト値として使用します) <span style="color:#cccccc;">If you choose to use a different alphabet you may only use uppercase letters</span>(別のアルファベットを使用する場合は、大文字のみを使用できます ) (<span style="color:#cccccc;">or no-case letters for languages that don't distinguish case</span>) ((あるいは大小を持たない、大文字と小文字を区別しない言語 )). (<span style="color:#cccccc;">Actually this is now an instance of the private AQP::_Alphabet class;</span>(実際、これは今、プライベートなAQP::_Alphabet クラスは実在している。) <span style="color:#cccccc;">the class provides a single method which is a QString conversion function</span>(このクラスはQString互換関数のシングルメソッド提供します。), <span style="color:#cccccc;">so in most cases it can be used wherever a QString is expected.</span>(だから、ほとんどの場合、QStringが期待されるのであれば、それは使用することができます。 ) <span style="color:#cccccc;">The reason for this change is to make the alphabet string translatable.</span>(この変更理由は、翻訳可能なアルファベット文字列を作ることにあります。)) *'''<span style="color:#cccccc;">Main Functions</span>(メインファンクション)''' <span style="color:#cccccc;">These are the most commonly used functions provided by the Alt_Key library.</span>(これらの最も一般的なAlt_Key ライブラリによって提供される関数の使い方) *'''<span style="color:deeppink;">void</span> <span style="color:darkblue;">AQP::accelerateActions</span>(<span style="color:deeppink;">QList<QAction*></span> actions, <span style="color:deeppink;">const QString&</span> alphabet=Alphabet)''' <span style="color:#cccccc;">This function takes a list of actions and optionally an alphabet. It adds keyboard accelerators to every action's text wherever possible.</span><span style="color:#cccccc;">Existing accelerators are respected as are plain ampersands</span> (<span style="color:#cccccc;">which are represented by "&&" in strings</span>). *'''<span style="color:deeppink;">void</span> <span style="color:darkblue;">AQP::accelerateMenu</span>(<span style="color:deeppink;">QWidget*</span> menuOrMenuBar, <span style="color:deeppink;">const QString&</span> alphabet=Alphabet)''' <span style="color:#cccccc;">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. </span><span style="color:#cccccc;">The function works recursively, adding accelerators to submenus and subsubmenus. </span><span style="color:#cccccc;">Existing accelerators are respected as are plain ampersands</span> (<span style="color:#cccccc;">which are represented by "&&" in strings).</span> *'''<span style="color:deeppink;">void</span> <span style="color:darkblue;">AQP::accelerateWidget</span>(<span style="color:deeppink;">QWidget*</span> widget, <span style="color:deeppink;">const QString&</span> alphabet=Alphabet)''' <span style="color:#cccccc;">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. </span><span style="color:#cccccc;">Existing accelerators are respected as are plain ampersands</span> (<span style="color:#cccccc;">which are represented by "&&" in strings</span>). *'''<span style="color:deeppink;">void</span> <span style="color:darkblue;">AQP::accelerateWidgets</span>(<span style="color:deeppink;">QList<QWidget*></span> widgets, <span style="color:deeppink;">const QString &</span> alphabet=Alphabet)''' <span style="color:#cccccc;">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. </span><span style="color:#cccccc;">Existing accelerators are respected as are plain ampersands (<span style="color:#cccccc;">which are represented by "&&" in strings</span>). <span style="color:#cccccc;">Auxiliary Functions</span> <span style="color:#cccccc;">These functions are occassionally useful.</span> *'''<span style="color:deeppink;">QStringList</span> <span style="color:darkblue;">AQP::accelerated</span>(<span style="color:deeppink;">const QStringList&</span> strings, <span style="color:deeppink;">const QString&</span> alphabet=Alphabet)''' <span style="color:#cccccc;">This function takes a list of strings and optionally an alphabet. </span><span style="color:#cccccc;">It returns a new string list with a keyboard accelerator added to every string wherever possible. </span><span style="color:#cccccc;">Existing accelerators are respected as are plain ampersands</span> (<span style="color:#cccccc;">which are represented by "&&" in strings</span>). *'''<span style="color:deeppink;">bool</span> <span style="color:darkblue;">AQP::isValid</span>(<span style="color:deeppink;">const QStringList&</span> strings, <span style="color:deeppink;">QPair<int, int>*</span> where=0, <span style="color:deeppink;">const QString&</span> alphabet=Alphabet)''' <span style="color:#cccccc;">This function returns true if the given list of strings has valid accelerators. </span><span style="color:#cccccc;">Valid includes no accelerators, but does not include duplicate accelerators. </span><span style="color:#cccccc;">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.</span> *'''<span style="color:deeppink;">int</span> <span style="color:darkblue;">AQP::numberAccelerated</span>(<span style="color:deeppink;">const QStringList&</span> strings)''' <span style="color:#cccccc;">This function returns the number of strings in the string list that have accelerators.</span> *'''<span style="color:deeppink;">double</span> <span style="color:darkblue;">AQP::quality</span>(<span style="color:deeppink;">const QStringList&</span> strings)''' <span style="color:#cccccc;">This function returns a rough guide to accelerator quality. </span><span style="color:#cccccc;">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. </span><span style="color:#cccccc;">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).</span> [[Qt#Qtリファレンス|Qtリファレンス]]へ戻る
Qtリファレンス Alt Key
に戻る。
個人用ツール
ログイン
名前空間
ページ
議論
変種
表示
閲覧
ソースを表示
履歴表示
操作
検索
案内
メインページ
コミュニティ・ポータル
最近の出来事
最近の更新
おまかせ表示
ヘルプ
ツールボックス
リンク元
関連ページの更新状況
特別ページ