Qtリファレンス Alt Key 新しいページはコチラ

提供: yonewiki
移動: 案内, 検索
(概要)
(API)
 
1行: 1行:
 +
[[Qt#Qtリファレンス|Qtリファレンス]]へ戻る
 
== '''概要''' ==
 
== '''概要''' ==
 The Alt_Key library consists of four files(Alt_Keyライブラリは4つのファイルを含んでいます。):
+
 <span style="color:#cccccc;">The Alt_Key library consists of four files</span>(Alt_Keyライブラリは4つのファイルを含んでいます。):
 
*alt_key.hpp
 
*alt_key.hpp
 
*alt_key.cpp
 
*alt_key.cpp
7行: 8行:
  
  
 The public API is in alt_key.hpp and uses the AQP namespace.(この公開APIは alt_key.hpp にあります。名前空間AQPで使います。)
+
 <span style="color:#cccccc;">The public API is in alt_key.hpp and uses the AQP namespace.</span>(この公開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 アプリケーションでも使われます。).
+
 
 +
 <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(例)''' ===
 
=== '''Example(例)''' ===
 Here is a list of menu options before and after Alt_Key has added accelerators(Alt_Keyがアクセラレータを追加する前後のメニューオプションのリストは次のとおりです):
+
 <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>
  
Before After
+
<table border=0>
Calculate &Calculate
+
<tr><td align="left"><span style="font-weight: bold;">Before</span></td><td align="left"><span style="font-weight: bold;">After</span></td></tr>
New &New
+
<tr><td align="left">Calculate</td><td align="left">&Calculate</td></tr>
Load... &Load...
+
<tr><td align="left">New</td><td align="left">&New</td></tr>
Save &Save
+
<tr><td align="left">Load...</td><td align="left">&Load...</td></tr>
Save &As... Save &As...
+
<tr><td align="left">Save</td><td align="left">&Save</td></tr>
Copy to Clipboard Copy &to Clipboard
+
<tr><td align="left">Save &As...</td><td align="left">Save &As...</td></tr>
Set Options... Set &Options...
+
<tr><td align="left">Copy to Clipboard </td><td align="left">Copy &to Clipboard</td></tr>
Help &Help
+
<tr><td align="left">Set Options...</td><td align="left">Set &Options...</td></tr>
About A&bout
+
<tr><td align="left">Help</td><td align="left">&Help</td></tr>
Quit &Quit
+
<tr><td align="left">About</td><td align="left">A&bout</td></tr>
Notice that the "Save &As" option already had an accelerator: The Alt_Key library respects manually inserted accelerators.
+
<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''' ===
 
=== '''API''' ===
*Include
+
*'''<span style="color:#cccccc;">Include</span>(インクルードするファイル)'''
 
&#x23;include "alt_key.hpp"
 
&#x23;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
+
 <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
 
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)
+
<span style="color:#cccccc;">This string holds the characters that are eligible to be used as accelerators</span>(この文字列は、アクセラレータとして使用できる文字を保持します ): 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.
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.
+
 <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>) ((あるいは大小を持たない、大文字と小文字を区別しない言語 )).
int AQP::numberAccelerated(const QStringList &strings)
+
(<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>(この変更理由は、翻訳可能なアルファベット文字列を作ることにあります。))
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).
+
*'''<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>(この関数は、ウィジェット(QDialogサブクラスなど)とオプションでアルファベットを取ります。 可能な限り、すべてのバディラベル、ボタン(つまり、QToolButtonを除くすべてのQAbstractButtonサブクラス)、チェックボックス、チェック可能なグループボックス、およびウィジェットの子(または孫、再帰的)であるラジオボタンにキーボードアクセラレータを追加します。 )<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>(プレーンアンパサンドと同様に、既存のアクセラレータが尊重されます ) (<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>(指定された文字列リストに有効なアクセラレータがある場合、この関数はtrueを返します。 )<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>(whereペアが渡され、関数がfalseを返す場合、ペアのintは、リストの最初の文字列のインデックスと、問題(アクセラレータの重複など)が発生した文字列内の文字のインデックスに設定されます。 )
 +
 
 +
 
 +
*'''<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>(各文字列について、最高の品質は、文字列の最初の文字にアクセラレータがある場合、2番目に良いのは単語の先頭のアクセラレータ、3番目に良いのはすべてのアクセラレータ、最悪なケースはアクセラレータがない場合です。 )<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>(品質計算は、リスト内のすべての文字列の全体的な品質を考慮し、0.0(最低)から1.0(最高)の範囲の値を返します。 )
 +
 
 +
 
 +
 
 +
[[Qt#Qtリファレンス|Qtリファレンス]]へ戻る

2021年3月2日 (火) 00:00時点における最新版



個人用ツール
名前空間

変種
操作
案内
ツールボックス