Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtGui/qkeysequence.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QKEYSEQUENCE_H
0005 #define QKEYSEQUENCE_H
0006 
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtCore/qstring.h>
0009 #include <QtCore/qobjectdefs.h>
0010 
0011 QT_REQUIRE_CONFIG(shortcut);
0012 
0013 QT_BEGIN_NAMESPACE
0014 
0015 class QKeySequence;
0016 
0017 /*****************************************************************************
0018   QKeySequence stream functions
0019  *****************************************************************************/
0020 #if !defined(QT_NO_DATASTREAM) || defined(Q_QDOC)
0021 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
0022 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &out, QKeySequence &ks);
0023 #endif
0024 
0025 #if defined(Q_QDOC)
0026 void qt_set_sequence_auto_mnemonic(bool b);
0027 #endif
0028 
0029 class QVariant;
0030 class QKeySequencePrivate;
0031 
0032 Q_GUI_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QKeySequence &key, size_t seed = 0) noexcept;
0033 
0034 class Q_GUI_EXPORT QKeySequence
0035 {
0036     Q_GADGET
0037 
0038 public:
0039     enum StandardKey {
0040         UnknownKey,
0041         HelpContents,
0042         WhatsThis,
0043         Open,
0044         Close,
0045         Save,
0046         New,
0047         Delete,
0048         Cut,
0049         Copy,
0050         Paste,
0051         Undo,
0052         Redo,
0053         Back,
0054         Forward,
0055         Refresh,
0056         ZoomIn,
0057         ZoomOut,
0058         Print,
0059         AddTab,
0060         NextChild,
0061         PreviousChild,
0062         Find,
0063         FindNext,
0064         FindPrevious,
0065         Replace,
0066         SelectAll,
0067         Bold,
0068         Italic,
0069         Underline,
0070         MoveToNextChar,
0071         MoveToPreviousChar,
0072         MoveToNextWord,
0073         MoveToPreviousWord,
0074         MoveToNextLine,
0075         MoveToPreviousLine,
0076         MoveToNextPage,
0077         MoveToPreviousPage,
0078         MoveToStartOfLine,
0079         MoveToEndOfLine,
0080         MoveToStartOfBlock,
0081         MoveToEndOfBlock,
0082         MoveToStartOfDocument,
0083         MoveToEndOfDocument,
0084         SelectNextChar,
0085         SelectPreviousChar,
0086         SelectNextWord,
0087         SelectPreviousWord,
0088         SelectNextLine,
0089         SelectPreviousLine,
0090         SelectNextPage,
0091         SelectPreviousPage,
0092         SelectStartOfLine,
0093         SelectEndOfLine,
0094         SelectStartOfBlock,
0095         SelectEndOfBlock,
0096         SelectStartOfDocument,
0097         SelectEndOfDocument,
0098         DeleteStartOfWord,
0099         DeleteEndOfWord,
0100         DeleteEndOfLine,
0101         InsertParagraphSeparator,
0102         InsertLineSeparator,
0103         SaveAs,
0104         Preferences,
0105         Quit,
0106         FullScreen,
0107         Deselect,
0108         DeleteCompleteLine,
0109         Backspace,
0110         Cancel
0111      };
0112      Q_ENUM(StandardKey)
0113 
0114     enum SequenceFormat {
0115         NativeText,
0116         PortableText
0117     };
0118     Q_ENUM(SequenceFormat)
0119 
0120     QKeySequence();
0121     QKeySequence(const QString &key, SequenceFormat format = NativeText);
0122     QKeySequence(int k1, int k2 = 0, int k3 = 0, int k4 = 0);
0123     QKeySequence(QKeyCombination k1,
0124                  QKeyCombination k2 = QKeyCombination::fromCombined(0),
0125                  QKeyCombination k3 = QKeyCombination::fromCombined(0),
0126                  QKeyCombination k4 = QKeyCombination::fromCombined(0));
0127     QKeySequence(const QKeySequence &ks);
0128     QKeySequence(StandardKey key);
0129     ~QKeySequence();
0130 
0131     int count() const;
0132     bool isEmpty() const;
0133 
0134     enum SequenceMatch {
0135         NoMatch,
0136         PartialMatch,
0137         ExactMatch
0138     };
0139     Q_ENUM(SequenceMatch);
0140 
0141     QString toString(SequenceFormat format = PortableText) const;
0142     static QKeySequence fromString(const QString &str, SequenceFormat format = PortableText);
0143 
0144     static QList<QKeySequence> listFromString(const QString &str, SequenceFormat format = PortableText);
0145     static QString listToString(const QList<QKeySequence> &list, SequenceFormat format = PortableText);
0146 
0147     SequenceMatch matches(const QKeySequence &seq) const;
0148     static QKeySequence mnemonic(const QString &text);
0149     static QList<QKeySequence> keyBindings(StandardKey key);
0150 
0151     operator QVariant() const;
0152     QKeyCombination operator[](uint i) const;
0153     QKeySequence &operator=(const QKeySequence &other);
0154     QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QKeySequence)
0155     void swap(QKeySequence &other) noexcept { qt_ptr_swap(d, other.d); }
0156 
0157     bool operator==(const QKeySequence &other) const;
0158     inline bool operator!= (const QKeySequence &other) const
0159     { return !(*this == other); }
0160     bool operator< (const QKeySequence &ks) const;
0161     inline bool operator> (const QKeySequence &other) const
0162     { return other < *this; }
0163     inline bool operator<= (const QKeySequence &other) const
0164     { return !(other < *this); }
0165     inline bool operator>= (const QKeySequence &other) const
0166     { return !(*this < other); }
0167 
0168     bool isDetached() const;
0169 private:
0170     int assign(const QString &str);
0171     int assign(const QString &str, SequenceFormat format);
0172     void setKey(QKeyCombination key, int index);
0173 
0174     QKeySequencePrivate *d;
0175 
0176     friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
0177     friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QKeySequence &ks);
0178     friend Q_GUI_EXPORT size_t qHash(const QKeySequence &key, size_t seed) noexcept;
0179     friend class QShortcutMap;
0180     friend class QShortcut;
0181 
0182 public:
0183     typedef QKeySequencePrivate * DataPtr;
0184     inline DataPtr &data_ptr() { return d; }
0185 };
0186 
0187 Q_DECLARE_SHARED(QKeySequence)
0188 
0189 #if !defined(QT_NO_DEBUG_STREAM) || defined(Q_QDOC)
0190 Q_GUI_EXPORT QDebug operator<<(QDebug, const QKeySequence &);
0191 #endif
0192 
0193 QT_END_NAMESPACE
0194 
0195 #endif // QKEYSEQUENCE_H