KDEUI
kkeysequencewidget.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KKEYSEQUENCEWIDGET_H
00023 #define KKEYSEQUENCEWIDGET_H
00024
00025 #include <QtCore/QList>
00026 #include <QtGui/QPushButton>
00027
00028 #include <kshortcut.h>
00029
00030
00031 class KKeySequenceWidgetPrivate;
00032 class QAction;
00033 class KAction;
00034 class KActionCollection;
00035
00049 class KDEUI_EXPORT KKeySequenceWidget: public QWidget
00050 {
00051 Q_OBJECT
00052
00053 Q_PROPERTY(
00054 bool multiKeyShortcutsAllowed
00055 READ multiKeyShortcutsAllowed
00056 WRITE setMultiKeyShortcutsAllowed )
00057
00058 Q_PROPERTY(
00059 ShortcutTypes checkForConflictsAgainst
00060 READ checkForConflictsAgainst
00061 WRITE setCheckForConflictsAgainst )
00062
00063
00064 public:
00067 enum Validation {
00069 Validate = 0,
00071 NoValidate = 1
00072 };
00073
00077 explicit KKeySequenceWidget(QWidget *parent = 0);
00078
00082 virtual ~KKeySequenceWidget();
00083
00090
00091 enum ShortcutType {
00092 None = 0x00,
00093 LocalShortcuts = 0x01,
00094 StandardShortcuts = 0x02,
00095 GlobalShortcuts = 0x03
00096 };
00097 Q_DECLARE_FLAGS(ShortcutTypes, ShortcutType)
00098
00099
00153 void setCheckForConflictsAgainst( ShortcutTypes types );
00154
00161 ShortcutTypes checkForConflictsAgainst() const;
00162
00166 void setMultiKeyShortcutsAllowed(bool);
00167 bool multiKeyShortcutsAllowed() const;
00168
00176 void setModifierlessAllowed(bool allow);
00177
00181 bool isModifierlessAllowed();
00182
00187 void setClearButtonShown(bool show);
00188
00190
00200 bool isKeySequenceAvailable(const QKeySequence &seq) const;
00201
00205 QKeySequence keySequence() const;
00206
00219 void setCheckActionCollections(const QList<KActionCollection *>& actionCollections);
00220
00227 KDE_DEPRECATED void setCheckActionList(const QList<QAction*> &checkList);
00228
00233 void setComponentName(const QString &componentName);
00234
00235
00236 Q_SIGNALS:
00237
00242 void keySequenceChanged(const QKeySequence &seq);
00243
00253 void stealShortcut(const QKeySequence &seq, KAction *action);
00254
00255 public Q_SLOTS:
00256
00264 void captureKeySequence();
00265
00272 void setKeySequence(const QKeySequence &seq, Validation val = NoValidate);
00273
00277 void clearKeySequence();
00278
00291 void applyStealShortcut();
00292
00293 private:
00294 Q_PRIVATE_SLOT(d, void doneRecording())
00295
00296 private:
00297 friend class KKeySequenceWidgetPrivate;
00298 KKeySequenceWidgetPrivate *const d;
00299
00300 Q_DISABLE_COPY(KKeySequenceWidget)
00301 };
00302
00303 Q_DECLARE_OPERATORS_FOR_FLAGS(KKeySequenceWidget::ShortcutTypes)
00304
00305 #endif //KKEYSEQUENCEWIDGET_H