summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/global/qglobal.h6
-rw-r--r--src/corelib/kernel/qvariant_p.h22
-rw-r--r--src/gui/kernel/qevent.cpp7
-rw-r--r--src/gui/kernel/qevent.h4
-rw-r--r--src/gui/kernel/qevent_p.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h2
-rw-r--r--src/widgets/dialogs/qdialog.h4
-rw-r--r--tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp2
8 files changed, 38 insertions, 11 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 99328d52ac..d0d6e851ad 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -415,9 +415,15 @@ QT_END_INCLUDE_NAMESPACE
#ifdef Q_COMPILER_EXPLICIT_OVERRIDES
# define Q_DECL_OVERRIDE override
# define Q_DECL_FINAL final
+# ifdef Q_COMPILER_DECLTYPE // required for class-level final to compile in qvariant_p.h
+# define Q_DECL_FINAL_CLASS final
+# else
+# define Q_DECL_FINAL_CLASS
+# endif
#else
# define Q_DECL_OVERRIDE
# define Q_DECL_FINAL
+# define Q_DECL_FINAL_CLASS
#endif
//defines the type for the WNDPROC on windows
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h
index b28aaf3c20..90756d76cc 100644
--- a/src/corelib/kernel/qvariant_p.h
+++ b/src/corelib/kernel/qvariant_p.h
@@ -207,6 +207,19 @@ class QVariantIsNull
/// \internal
/// This class checks if a type T has method called isNull. Result is kept in the Value property
/// TODO Can we somehow generalize it? A macro version?
+#if defined(Q_COMPILER_DECLTYPE) // C++11 version
+ template<typename T>
+ class HasIsNullMethod {
+ struct Yes { char unused[1]; };
+ struct No { char unused[2]; };
+ Q_STATIC_ASSERT(sizeof(Yes) != sizeof(No));
+
+ template<class C> static decltype(static_cast<const C*>(0)->isNull(), Yes()) test(int);
+ template<class C> static No test(...);
+ public:
+ static const bool Value = (sizeof(test<T>(0)) == sizeof(Yes));
+ };
+#else // C++98 version (doesn't work for final classes)
template<typename T, bool IsClass = QTypeInfo<T>::isComplex>
class HasIsNullMethod
{
@@ -215,7 +228,7 @@ class QVariantIsNull
Q_STATIC_ASSERT(sizeof(Yes) != sizeof(No));
struct FallbackMixin { bool isNull() const; };
- struct Derived : public T, public FallbackMixin {};
+ struct Derived : public T, public FallbackMixin {}; // <- doesn't work for final classes
template<class C, C> struct TypeCheck {};
template<class C> static Yes test(...);
@@ -231,6 +244,7 @@ class QVariantIsNull
public:
static const bool Value = false;
};
+#endif
// TODO This part should go to autotests during HasIsNullMethod generalization.
Q_STATIC_ASSERT(!HasIsNullMethod<bool>::Value);
@@ -240,6 +254,12 @@ class QVariantIsNull
Q_STATIC_ASSERT(!HasIsNullMethod<SelfTest2>::Value);
struct SelfTest3 : public SelfTest1 {};
Q_STATIC_ASSERT(HasIsNullMethod<SelfTest3>::Value);
+ struct SelfTestFinal1 Q_DECL_FINAL_CLASS { bool isNull() const; };
+ Q_STATIC_ASSERT(HasIsNullMethod<SelfTestFinal1>::Value);
+ struct SelfTestFinal2 Q_DECL_FINAL_CLASS {};
+ Q_STATIC_ASSERT(!HasIsNullMethod<SelfTestFinal2>::Value);
+ struct SelfTestFinal3 Q_DECL_FINAL_CLASS : public SelfTest1 {};
+ Q_STATIC_ASSERT(HasIsNullMethod<SelfTestFinal3>::Value);
template<typename T, bool HasIsNull = HasIsNullMethod<T>::Value>
struct CallFilteredIsNull
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 7b84f4a982..adf5f66679 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3863,10 +3863,11 @@ QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const
}
/*!
+ \since 5.0
Returns the raw, unfiltered positions for the touch point. The positions are in native screen coordinates.
To get local coordinates you can use mapFromGlobal() of the QWindow returned by QTouchEvent::window().
- \note Returns an empty list if the touch device's capabilities do not include QTouchDevice::RawPositions.
+ \note Returns an empty vector if the touch device's capabilities do not include QTouchDevice::RawPositions.
\note Native screen coordinates refer to the native orientation of the screen which, in case of
mobile devices, is typically portrait. This means that on systems capable of screen orientation
@@ -3875,7 +3876,7 @@ QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const
\sa QTouchDevice::capabilities(), device(), window()
*/
-QList<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const
+QVector<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const
{
return d->rawScreenPositions;
}
@@ -4033,7 +4034,7 @@ void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v)
}
/*! \internal */
-void QTouchEvent::TouchPoint::setRawScreenPositions(const QList<QPointF> &positions)
+void QTouchEvent::TouchPoint::setRawScreenPositions(const QVector<QPointF> &positions)
{
if (d->ref.load() != 1)
d = d->detach();
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 7c871b0dda..a7dce43f72 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -753,7 +753,7 @@ public:
qreal pressure() const;
QVector2D velocity() const;
InfoFlags flags() const;
- QList<QPointF> rawScreenPositions() const;
+ QVector<QPointF> rawScreenPositions() const;
// internal
void setId(int id);
@@ -776,7 +776,7 @@ public:
void setPressure(qreal pressure);
void setVelocity(const QVector2D &v);
void setFlags(InfoFlags flags);
- void setRawScreenPositions(const QList<QPointF> &positions);
+ void setRawScreenPositions(const QVector<QPointF> &positions);
private:
QTouchEventTouchPointPrivate *d;
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 3f354c14e4..4c639f4eef 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -107,7 +107,7 @@ public:
qreal pressure;
QVector2D velocity;
QTouchEvent::TouchPoint::InfoFlags flags;
- QList<QPointF> rawScreenPositions;
+ QVector<QPointF> rawScreenPositions;
};
class QFileOpenEventPrivate
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index 6dae11ea81..040f62e763 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -98,7 +98,7 @@ public:
Qt::TouchPointState state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released}
QVector2D velocity; // in screen coordinate system, pixels / seconds
QTouchEvent::TouchPoint::InfoFlags flags;
- QList<QPointF> rawPositions; // in screen coordinates
+ QVector<QPointF> rawPositions; // in screen coordinates
};
static void registerTouchDevice(QTouchDevice *device);
diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h
index 7d3052a782..f20ff46d41 100644
--- a/src/widgets/dialogs/qdialog.h
+++ b/src/widgets/dialogs/qdialog.h
@@ -91,8 +91,8 @@ Q_SIGNALS:
void rejected();
public Q_SLOTS:
- void open();
- int exec();
+ virtual void open();
+ virtual int exec();
virtual void done(int);
virtual void accept();
virtual void reject();
diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
index 391600dd57..997e15ed55 100644
--- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
+++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
@@ -595,7 +595,7 @@ void tst_QTouchEvent::basicRawEventTranslation()
rawTouchPoint.setState(Qt::TouchPointPressed);
rawTouchPoint.setScreenPos(screenPos);
rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.pos(), screenGeometry));
- QList<QPointF> rawPosList;
+ QVector<QPointF> rawPosList;
rawPosList << QPointF(12, 34) << QPointF(56, 78);
rawTouchPoint.setRawScreenPositions(rawPosList);
const ulong timestamp = 1234;