00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef QSHORTCUT_H
00025 #define QSHORTCUT_H
00026
00027 #include <QtGui/qwidget.h>
00028 #include <QtGui/qkeysequence.h>
00029
00030 QT_BEGIN_HEADER
00031
00032 QT_MODULE(Gui)
00033
00034 #ifndef QT_NO_SHORTCUT
00035
00036 class QShortcutPrivate;
00037 class Q_GUI_EXPORT QShortcut : public QObject
00038 {
00039 Q_OBJECT
00040 Q_DECLARE_PRIVATE(QShortcut)
00041 Q_PROPERTY(QKeySequence key READ key WRITE setKey)
00042 Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis)
00043 Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
00044 Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat)
00045 Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext)
00046 public:
00047 explicit QShortcut(QWidget *parent);
00048 QShortcut(const QKeySequence& key, QWidget *parent,
00049 const char *member = 0, const char *ambiguousMember = 0,
00050 Qt::ShortcutContext context = Qt::WindowShortcut);
00051 ~QShortcut();
00052
00053 void setKey(const QKeySequence& key);
00054 QKeySequence key() const;
00055
00056 void setEnabled(bool enable);
00057 bool isEnabled() const;
00058
00059 void setContext(Qt::ShortcutContext context);
00060 Qt::ShortcutContext context();
00061
00062 void setWhatsThis(const QString &text);
00063 QString whatsThis() const;
00064
00065 void setAutoRepeat(bool on);
00066 bool autoRepeat() const;
00067
00068 int id() const;
00069
00070 inline QWidget *parentWidget() const
00071 { return static_cast<QWidget *>(QObject::parent()); }
00072
00073 Q_SIGNALS:
00074 void activated();
00075 void activatedAmbiguously();
00076
00077 protected:
00078 bool event(QEvent *e);
00079 };
00080
00081 #endif // QT_NO_SHORTCUT
00082
00083 QT_END_HEADER
00084
00085 #endif // QSHORTCUT_H