In view of the EU’s Cyber Resilience Act and an abundance of caution, we have withdrawn all our free software.
This library is no longer being developed or maintained.
The Alt_Key
library consists of four files: alt_key.hpp
,
alt_key.cpp
, kuhn_munkres.hpp
, and
kuhn_munkres.cpp
. The
public API is in alt_key.hpp
and uses the AQP
namespace.
The library is supplied along with the examples for the book Advanced Qt Programming. Many of the book's examples use the library. The library is also used by the Alt_Key GUI application.
Here is a list of menu options before and after Alt_Key
has added
accelerators:
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.
#include "alt_key.hpp"
kuhn_munkres.hpp
file. Either copy the four
files into your project or soft link them or add them to your include
path.
QString AQP::Alphabet
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).
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.)
These are the most commonly used functions provided by the
Alt_Key
library.
void AQP::accelerateActions(QList<QAction*> actions, const
QString &alphabet=Alphabet)
"&&"
in strings).
void AQP::accelerateMenu(QWidget *menuOrMenuBar, const QString
&alphabet=Alphabet)
"&&"
in strings).
void AQP::accelerateWidget(QWidget *widget, const QString
&alphabet=Alphabet)
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)
"&&"
in strings).
These functions are occassionally useful.
QStringList AQP::accelerated(const QStringList &strings, const
QString &alphabet=Alphabet)
"&&"
in
strings).
bool AQP::isValid(const QStringList &strings, QPair<int,
int> *where=0, const QString &alphabet=Alphabet)
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 int
s 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)
double AQP::quality(const QStringList &strings)
Your Privacy • Copyright © 2006 Qtrac Ltd. All Rights Reserved.