KDEUI
kkeysequencewidget.h
Go to the documentation of this file.
00001 // vim: noexpandtab ts=4 sw=4 00002 /* This file is part of the KDE libraries 00003 Copyright (C) 2001, 2002 Ellis Whitehead <ellis@kde.org> 00004 Copyright (C) 2007 Andreas Hartmetz <ahartmetz@gmail.com> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 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 00051 class KDEUI_EXPORT KKeySequenceWidget: public QWidget 00052 { 00053 Q_OBJECT 00054 00055 Q_FLAGS(ShortcutTypes) 00056 00057 Q_PROPERTY( 00058 bool multiKeyShortcutsAllowed 00059 READ multiKeyShortcutsAllowed 00060 WRITE setMultiKeyShortcutsAllowed ) 00061 00062 Q_PROPERTY( 00063 ShortcutTypes checkForConflictsAgainst 00064 READ checkForConflictsAgainst 00065 WRITE setCheckForConflictsAgainst ) 00066 00067 Q_PROPERTY( 00068 bool modifierlessAllowed 00069 READ isModifierlessAllowed 00070 WRITE setModifierlessAllowed ) 00071 00072 public: 00075 enum Validation { 00077 Validate = 0, 00079 NoValidate = 1 00080 }; 00081 00085 explicit KKeySequenceWidget(QWidget *parent = 0); 00086 00090 virtual ~KKeySequenceWidget(); 00091 00098 00099 enum ShortcutType { 00100 None = 0x00, 00101 LocalShortcuts = 0x01, 00102 StandardShortcuts = 0x02, 00103 GlobalShortcuts = 0x03 00104 }; 00105 Q_DECLARE_FLAGS(ShortcutTypes, ShortcutType) 00106 00107 00161 void setCheckForConflictsAgainst( ShortcutTypes types ); 00162 00169 ShortcutTypes checkForConflictsAgainst() const; 00170 00174 void setMultiKeyShortcutsAllowed(bool); 00175 bool multiKeyShortcutsAllowed() const; 00176 00184 void setModifierlessAllowed(bool allow); 00185 00189 bool isModifierlessAllowed(); 00190 00195 void setClearButtonShown(bool show); 00196 00198 00208 bool isKeySequenceAvailable(const QKeySequence &seq) const; 00209 00213 QKeySequence keySequence() const; 00214 00227 void setCheckActionCollections(const QList<KActionCollection *>& actionCollections); 00228 00235 #ifndef KDE_NO_DEPRECATED 00236 KDE_DEPRECATED void setCheckActionList(const QList<QAction*> &checkList); 00237 #endif 00238 00243 void setComponentName(const QString &componentName); 00244 00245 00246 Q_SIGNALS: 00247 00252 void keySequenceChanged(const QKeySequence &seq); 00253 00263 void stealShortcut(const QKeySequence &seq, KAction *action); 00264 00265 public Q_SLOTS: 00266 00274 void captureKeySequence(); 00275 00282 void setKeySequence(const QKeySequence &seq, Validation val = NoValidate); 00283 00287 void clearKeySequence(); 00288 00301 void applyStealShortcut(); 00302 00303 private: 00304 Q_PRIVATE_SLOT(d, void doneRecording()) 00305 00306 private: 00307 friend class KKeySequenceWidgetPrivate; 00308 KKeySequenceWidgetPrivate *const d; 00309 00310 Q_DISABLE_COPY(KKeySequenceWidget) 00311 }; 00312 00313 Q_DECLARE_OPERATORS_FOR_FLAGS(KKeySequenceWidget::ShortcutTypes) 00314 00315 #endif //KKEYSEQUENCEWIDGET_H
KDE 4.6 API Reference