43 #include "private/qwidget_p.h" 45 #ifndef QT_NO_SHORTCUT 50 #include <private/qapplication_p.h> 51 #include <private/qshortcutmap_p.h> 55 #define QAPP_CHECK(functionName) \ 57 qWarning("QShortcut: Initialize QApplication before calling '" functionName "'."); \ 176 qWarning(
"QShortcut: No widget parent defined");
213 const char *member,
const char *ambiguousMember,
222 d->sc_sequence =
key;
223 d->redoGrab(
qApp->d_func()->shortcutMap);
237 qApp->d_func()->shortcutMap.removeShortcut(
d->sc_id,
this);
257 if (
d->sc_sequence == key)
260 d->sc_sequence =
key;
261 d->redoGrab(
qApp->d_func()->shortcutMap);
267 return d->sc_sequence;
291 if (
d->sc_enabled == enable)
294 d->sc_enabled = enable;
295 qApp->d_func()->shortcutMap.setShortcutEnabled(enable,
d->sc_id,
this);
301 return d->sc_enabled;
322 if(
d->sc_context == context)
326 d->redoGrab(
qApp->d_func()->shortcutMap);
332 return d->sc_context;
355 d->sc_whatsthis =
text;
361 return d->sc_whatsthis;
380 if (
d->sc_autorepeat == on)
383 d->sc_autorepeat = on;
384 qApp->d_func()->shortcutMap.setShortcutAutoRepeat(on,
d->sc_id,
this);
390 return d->sc_autorepeat;
410 bool handled =
false;
414 #ifndef QT_NO_WHATSTHIS 429 #endif // QT_NO_SHORTCUT
#define QAPP_CHECK(functionName)
int id() const
Returns the shortcut's ID.
#define QT_END_NAMESPACE
This macro expands to.
int setShortcutEnabled(bool enable, int id, QObject *owner, const QKeySequence &key=QKeySequence())
Changes the enable state of a shortcut to enable.
~QShortcut()
Destroys the shortcut.
void setAutoRepeat(bool on)
The QShortcutEvent class provides an event which is generated when the user presses a key combination...
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
void setWhatsThis(const QString &text)
The QShortcut class is used to create keyboard shortcuts.
void setEnabled(bool enable)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Qt::ShortcutContext sc_context
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Q_CORE_EXPORT void qWarning(const char *,...)
void setKey(const QKeySequence &key)
static bool inWhatsThisMode()
Returns true if the user interface is in "What's This?" mode; otherwise returns false.
Qt::ShortcutContext context()
bool isEmpty() const
Returns true if the key sequence is empty; otherwise returns false.
void redoGrab(QShortcutMap &map)
const QKeySequence & key()
int setShortcutAutoRepeat(bool on, int id, QObject *owner, const QKeySequence &key=QKeySequence())
Changes the auto repeat state of a shortcut to enable.
int shortcutId()
This is an overloaded member function, provided for convenience. It differs from the above function o...
QShortcut(QWidget *parent)
Constructs a QShortcut object for the parent widget.
#define Q_DECLARE_PUBLIC(Class)
The QKeySequence class encapsulates a key sequence as used by shortcuts.
QString whatsThis() const
void activated()
This signal is emitted when the user types the shortcut's key sequence.
QObject * parent() const
Returns a pointer to the parent object.
int removeShortcut(int id, QObject *owner, const QKeySequence &key=QKeySequence())
Removes a shortcut from the global map.
int addShortcut(QObject *owner, const QKeySequence &key, Qt::ShortcutContext context)
Adds a shortcut to the global map.
void activatedAmbiguously()
When a key sequence is being typed at the keyboard, it is said to be ambiguous as long as it matches ...
static void showText(const QPoint &pos, const QString &text, QWidget *w=0)
Shows text as a "What's This?" window, at global position pos.
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
void setContext(Qt::ShortcutContext context)
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.