Remove deprecated usage of QKeySequence from qguivariant
authorOlivier Goffart <ogoffart@woboq.com>
Sat, 25 Feb 2012 10:42:57 +0000 (11:42 +0100)
committerQt by Nokia <qt-info@nokia.com>
Mon, 27 Feb 2012 11:49:33 +0000 (12:49 +0100)
The implicit conversion operators are deprecated.

Change-Id: I0e94c0671413da1ab58c6c7b8bb31614e2696409
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
src/gui/kernel/qguivariant.cpp

index 0492e48..50d3f0b 100644 (file)
@@ -236,7 +236,7 @@ static bool convert(const QVariant::Private *d, int t,
         switch (d->type) {
 #ifndef QT_NO_SHORTCUT
         case QVariant::KeySequence:
-            *str = QString(*v_cast<QKeySequence>(d));
+            *str = (*v_cast<QKeySequence>(d)).toString(QKeySequence::NativeText);
             return true;
 #endif
         case QVariant::Font:
@@ -285,7 +285,8 @@ static bool convert(const QVariant::Private *d, int t,
 #ifndef QT_NO_SHORTCUT
     case QVariant::Int:
         if (d->type == QVariant::KeySequence) {
-            *static_cast<int *>(result) = (int)(*(v_cast<QKeySequence>(d)));
+            const QKeySequence &seq = *v_cast<QKeySequence>(d);
+            *static_cast<int *>(result) = seq.isEmpty() ? 0 : seq[0];
             return true;
         }
         break;