Another attempt to fix wxUIActionSimulator compilation in wxQt

Pass QWindow to {mouse,key}Event() functions for Qt 5.3+, apparently Qt
documentation is wrong and simply wasn't updated since Qt4.
This commit is contained in:
Vadim Zeitlin
2016-02-26 12:19:30 +01:00
parent 39ad5135f8
commit a6155cfe11

View File

@@ -27,14 +27,14 @@
using namespace Qt;
using namespace QTest;
// Apparently {mouse,key}Event() functions signature has changed somewhere
// between Qt 5.3 and 5.5 as they're documented to take QWidget in the latter
// but actually take QWindow in the former, so use this helper to hide the
// difference.
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
inline QWidget* argForEvents(QWidget* w) { return w; }
#else
// Apparently {mouse,key}Event() functions signature has changed from QWidget
// to QWindow at some time during Qt5, but we don't know when exactly. We do
// know that they take QWindow for 5.3 and, presumably, later versions (but not
// for whichever version this code was originally written for).
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
inline QWindow* argForEvents(QWidget* w) { return w->windowHandle(); }
#else
inline QWidget* argForEvents(QWidget* w) { return w; }
#endif
static MouseButton ConvertMouseButton( int button )