src/gui/kernel/qshortcut.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
00004 **
00005 ** This file is part of the QtGui module of the Qt Toolkit.
00006 **
00007 ** This file may be used under the terms of the GNU General Public
00008 ** License version 2.0 as published by the Free Software Foundation
00009 ** and appearing in the file LICENSE.GPL included in the packaging of
00010 ** this file.  Please review the following information to ensure GNU
00011 ** General Public Licensing requirements will be met:
00012 ** http://www.trolltech.com/products/qt/opensource.html
00013 **
00014 ** If you are unsure which license is appropriate for your use, please
00015 ** review the following information:
00016 ** http://www.trolltech.com/products/qt/licensing.html or contact the
00017 ** sales department at sales@trolltech.com.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
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

Generated on Thu Mar 15 11:55:14 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1