summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qkeysequence.cpp19
-rw-r--r--src/gui/kernel/qkeysequence.h9
2 files changed, 10 insertions, 18 deletions
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 986701bd7b..e197b974e6 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1040,7 +1040,7 @@ void QKeySequence::setKey(int key, int index)
Returns the number of keys in the key sequence.
The maximum is 4.
*/
-uint QKeySequence::count() const
+int QKeySequence::count() const
{
if (!d->key[0])
return 0;
@@ -1478,7 +1478,8 @@ QKeySequence::SequenceMatch QKeySequence::matches(const QKeySequence &seq) const
}
-/*!
+/*! \fn QKeySequence::operator QString() const
+
\obsolete
Use toString() instead.
@@ -1487,10 +1488,6 @@ QKeySequence::SequenceMatch QKeySequence::matches(const QKeySequence &seq) const
calling toString(QKeySequence::NativeText). Note that the
result is not platform independent.
*/
-QKeySequence::operator QString() const
-{
- return QKeySequence::toString(QKeySequence::NativeText);
-}
/*!
Returns the key sequence as a QVariant
@@ -1500,18 +1497,12 @@ QKeySequence::operator QVariant() const
return QVariant(QVariant::KeySequence, this);
}
-/*!
+/*! \fn QKeySequence::operator int () const
+
\obsolete
For backward compatibility: returns the first keycode
as integer. If the key sequence is empty, 0 is returned.
*/
-QKeySequence::operator int () const
-{
- if (1 <= count())
- return d->key[0];
- return 0;
-}
-
/*!
Returns a reference to the element at position \a index in the key
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 1127e8afca..53f89bd838 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -154,7 +154,7 @@ public:
QKeySequence(StandardKey key);
~QKeySequence();
- uint count() const; // ### Qt 5: return 'int'
+ int count() const;
bool isEmpty() const;
enum SequenceMatch {
@@ -170,10 +170,11 @@ public:
static QKeySequence mnemonic(const QString &text);
static QList<QKeySequence> keyBindings(StandardKey key);
- // ### Qt 5: kill 'operator QString' - it's evil
- operator QString() const;
+#if QT_DEPRECATED_SINCE(5, 0)
+ QT_DEPRECATED operator QString() const { return toString(QKeySequence::NativeText); }
+ QT_DEPRECATED operator int() const { if (1 <= count()) return operator [](0); return 0; }
+#endif
operator QVariant() const;
- operator int() const;
int operator[](uint i) const;
QKeySequence &operator=(const QKeySequence &other);
#ifdef Q_COMPILER_RVALUE_REFS