mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 19:49:01 +08:00
46dda5372b
* Switch stuff to Qt6 * give opencv4 the correct deps * add Qt5Compat to find_dependency * refine vtk deps and promote targets to global * fix dep * ci is probably faster than my desktop pc building. * remove invalid patch part * add qt6 patch * second patch * make openimageio ignore qt5 * [skip actions] qt6 part 3 * vtk qt6 patch * try openimageio again * move gl include * fix patch * does it work now? * remove qualified name * more qt6 fixes * more patches * update and fix rtabmap * gles feature in qtbase needs to be disabled for vtk since vtk assumes desktop opengl * remove patch add error if qtbase was build with gles2 * disable also second patch * fix theia * paraview consolidate patches * fix case issue * fix missing , * add more qt6 changes * remove unnecessary patches * bump port version * remove comments from vtk * add platform features for tools. * fix format * bump ports * another one to bump * v db Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
507 lines
22 KiB
Diff
507 lines
22 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index b3c91500041421328fde0821ef6876c78eef55d6..b4157a3d53407b536b3694b12faa3ed7794fb4c5 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -1,27 +1,20 @@
|
|
-if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|
- CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
|
|
-endif ()
|
|
+CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
|
|
|
|
PROJECT(QtTesting)
|
|
|
|
IF(NOT DEFINED QtTesting_QT_VERSION)
|
|
- SET(QtTesting_QT_VERSION "4" CACHE STRING "Expected Qt version")
|
|
+ SET(QtTesting_QT_VERSION "5" CACHE STRING "Expected Qt version")
|
|
MARK_AS_ADVANCED(QtTesting_QT_VERSION)
|
|
- SET_PROPERTY(CACHE QtTesting_QT_VERSION PROPERTY STRINGS 4 5)
|
|
+ SET_PROPERTY(CACHE QtTesting_QT_VERSION PROPERTY STRINGS 5 6)
|
|
ENDIF()
|
|
-IF(NOT (QtTesting_QT_VERSION VERSION_EQUAL "4" OR
|
|
- QtTesting_QT_VERSION VERSION_EQUAL "5"))
|
|
- message(FATAL_ERROR "Expected value for QtTesting_QT_VERSION is either '4' or '5'")
|
|
+IF(NOT (QtTesting_QT_VERSION VERSION_EQUAL "5" OR
|
|
+ QtTesting_QT_VERSION VERSION_EQUAL "6"))
|
|
+ message(FATAL_ERROR "Expected value for QtTesting_QT_VERSION is either '5' or '6'")
|
|
ENDIF()
|
|
|
|
set(qt_imported_targets)
|
|
-IF(QtTesting_QT_VERSION VERSION_GREATER "4")
|
|
- FIND_PACKAGE(Qt5 REQUIRED COMPONENTS Core Widgets)
|
|
- SET(qt_imported_targets Qt5::Core Qt5::Widgets)
|
|
-ELSE()
|
|
- FIND_PACKAGE(Qt4 REQUIRED COMPONENTS QtGui)
|
|
- SET(qt_imported_targets Qt4::QtCore Qt4::QtGui)
|
|
-ENDIF()
|
|
+FIND_PACKAGE(Qt${QtTesting_QT_VERSION} REQUIRED COMPONENTS Core Widgets)
|
|
+SET(qt_imported_targets Qt${QtTesting_QT_VERSION}::Core Qt${QtTesting_QT_VERSION}::Widgets)
|
|
|
|
IF(NOT DEFINED QT_TESTING_WITH_PYTHON)
|
|
OPTION(QT_TESTING_WITH_PYTHON "Enable Qt Testing with Python" OFF)
|
|
diff --git a/Testing/CMake/qtTestingMacroGenerateMocs.cmake b/Testing/CMake/qtTestingMacroGenerateMocs.cmake
|
|
index 4b1f34a4fa5d7e7effb63ae49518e75c47e2598c..953e7402bc269cf3af41914945b194348cfc428a 100644
|
|
--- a/Testing/CMake/qtTestingMacroGenerateMocs.cmake
|
|
+++ b/Testing/CMake/qtTestingMacroGenerateMocs.cmake
|
|
@@ -19,3 +19,13 @@ macro(QT5_GENERATE_MOCS)
|
|
OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${moc_file})
|
|
endforeach()
|
|
endmacro()
|
|
+
|
|
+
|
|
+macro(QT6_GENERATE_MOCS)
|
|
+ foreach(file ${ARGN})
|
|
+ set(moc_file moc_${file})
|
|
+ QT_GENERATE_MOC(${file} ${moc_file})
|
|
+ set_property(SOURCE ${file} APPEND PROPERTY
|
|
+ OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${moc_file})
|
|
+ endforeach()
|
|
+endmacro()
|
|
diff --git a/Testing/Cpp/CMakeLists.txt b/Testing/Cpp/CMakeLists.txt
|
|
index fed244434f888af3ba2f4b50609f94d08eebd47b..31e629c990290bb5d4fce52005c1781aebdf3b5a 100644
|
|
--- a/Testing/Cpp/CMakeLists.txt
|
|
+++ b/Testing/Cpp/CMakeLists.txt
|
|
@@ -1,6 +1,9 @@
|
|
include(../CMake/qtTestingMacroGenerateMocs.cmake)
|
|
|
|
-IF(QtTesting_QT_VERSION VERSION_GREATER "4")
|
|
+IF(QtTesting_QT_VERSION VERSION_GREATER "5")
|
|
+ FIND_PACKAGE(Qt6 REQUIRED QUIET COMPONENTS Test)
|
|
+ SET(TEST_LIBRARIES Qt6::Test)
|
|
+ELSEIF(QtTesting_QT_VERSION VERSION_GREATER "4")
|
|
FIND_PACKAGE(Qt5 REQUIRED QUIET COMPONENTS Test)
|
|
SET(TEST_LIBRARIES Qt5::Test)
|
|
ELSE()
|
|
@@ -38,7 +41,10 @@ include_directories(
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
)
|
|
|
|
-if(QtTesting_QT_VERSION VERSION_GREATER "4")
|
|
+if(QtTesting_QT_VERSION VERSION_GREATER "5")
|
|
+ QT6_GENERATE_MOCS(${TEST_SOURCES})
|
|
+ QT6_WRAP_CPP( TEST_MOC_SRCS ${TEST_MOC_HEADERS} )
|
|
+elseif(QtTesting_QT_VERSION VERSION_GREATER "4")
|
|
QT5_GENERATE_MOCS(${TEST_SOURCES})
|
|
QT5_WRAP_CPP( TEST_MOC_SRCS ${TEST_MOC_HEADERS} )
|
|
else()
|
|
diff --git a/pq3DViewEventPlayer.cxx b/pq3DViewEventPlayer.cxx
|
|
index 5be26b88d394ee82543b039e2173f7624e960808..3ec526a9033328cc924f02dd4c0ba21f30b9a7de 100644
|
|
--- a/pq3DViewEventPlayer.cxx
|
|
+++ b/pq3DViewEventPlayer.cxx
|
|
@@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
#include <QApplication>
|
|
#include <QKeyEvent>
|
|
#include <QMouseEvent>
|
|
-#include <QRegExp>
|
|
+#include <QRegularExpression>
|
|
#include <QWidget>
|
|
#include <QtDebug>
|
|
|
|
@@ -53,18 +53,19 @@ bool pq3DViewEventPlayer::playEvent(
|
|
{
|
|
if (Command == "mousePress" || Command == "mouseRelease" || Command == "mouseMove")
|
|
{
|
|
- QRegExp mouseRegExp("\\(([^,]*),([^,]*),([^,]),([^,]),([^,]*)\\)");
|
|
- if (mouseRegExp.indexIn(Arguments) != -1)
|
|
+ QRegularExpression mouseRegExp("\\(([^,]*),([^,]*),([^,]),([^,]),([^,]*)\\)");
|
|
+ QRegularExpressionMatch match = mouseRegExp.match(Arguments);
|
|
+ if (match.hasMatch())
|
|
{
|
|
- QVariant v = mouseRegExp.cap(1);
|
|
+ QVariant v = match.captured(1);
|
|
int x = static_cast<int>(v.toDouble() * widget->size().width());
|
|
- v = mouseRegExp.cap(2);
|
|
+ v = match.captured(2);
|
|
int y = static_cast<int>(v.toDouble() * widget->size().height());
|
|
- v = mouseRegExp.cap(3);
|
|
+ v = match.captured(3);
|
|
Qt::MouseButton button = static_cast<Qt::MouseButton>(v.toInt());
|
|
- v = mouseRegExp.cap(4);
|
|
+ v = match.captured(4);
|
|
Qt::MouseButtons buttons = static_cast<Qt::MouseButton>(v.toInt());
|
|
- v = mouseRegExp.cap(5);
|
|
+ v = match.captured(5);
|
|
Qt::KeyboardModifiers keym = static_cast<Qt::KeyboardModifier>(v.toInt());
|
|
QEvent::Type type = (Command == "mousePress")
|
|
? QEvent::MouseButtonPress
|
|
diff --git a/pq3DViewEventTranslator.cxx b/pq3DViewEventTranslator.cxx
|
|
index e42b28ec22ef24f07b5adffb1fb7740df320adf5..17f7b2d9e17a36b926c585f85ce37c1ee21b6eff 100644
|
|
--- a/pq3DViewEventTranslator.cxx
|
|
+++ b/pq3DViewEventTranslator.cxx
|
|
@@ -71,8 +71,13 @@ bool pq3DViewEventTranslator::translateEvent(QObject* Object, QEvent* Event, boo
|
|
if (mouseEvent)
|
|
{
|
|
QSize size = widget->size();
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
+ double normalized_x = mouseEvent->position().x() / static_cast<double>(size.width());
|
|
+ double normalized_y = mouseEvent->position().y() / static_cast<double>(size.height());
|
|
+#else
|
|
double normalized_x = mouseEvent->x() / static_cast<double>(size.width());
|
|
double normalized_y = mouseEvent->y() / static_cast<double>(size.height());
|
|
+#endif
|
|
int button = mouseEvent->button();
|
|
int buttons = mouseEvent->buttons();
|
|
int modifiers = mouseEvent->modifiers();
|
|
@@ -88,7 +93,10 @@ bool pq3DViewEventTranslator::translateEvent(QObject* Object, QEvent* Event, boo
|
|
QMouseEvent e(QEvent::MouseButtonPress, QPoint(), Qt::MouseButton(), Qt::MouseButtons(),
|
|
Qt::KeyboardModifiers());
|
|
|
|
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
+ // FIXME: QMouseEvent copy ctor is private in Qt6
|
|
lastMoveEvent = e;
|
|
+#endif
|
|
return true;
|
|
break;
|
|
}
|
|
@@ -98,10 +106,18 @@ bool pq3DViewEventTranslator::translateEvent(QObject* Object, QEvent* Event, boo
|
|
QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent*>(Event);
|
|
if (mouseEvent)
|
|
{
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
+ QMouseEvent e(QEvent::MouseMove,
|
|
+ QPoint(mouseEvent->position().x(), mouseEvent->position().y()),
|
|
+#else
|
|
QMouseEvent e(QEvent::MouseMove, QPoint(mouseEvent->x(), mouseEvent->y()),
|
|
+#endif
|
|
mouseEvent->button(), mouseEvent->buttons(), mouseEvent->modifiers());
|
|
|
|
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
+ // FIXME: QMouseEvent copy ctor is private in Qt6
|
|
lastMoveEvent = e;
|
|
+#endif
|
|
}
|
|
return true;
|
|
break;
|
|
@@ -117,8 +133,13 @@ bool pq3DViewEventTranslator::translateEvent(QObject* Object, QEvent* Event, boo
|
|
// record last move event if it is valid
|
|
if (lastMoveEvent.type() == QEvent::MouseMove)
|
|
{
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
+ double normalized_x = lastMoveEvent.position().x() / static_cast<double>(size.width());
|
|
+ double normalized_y = lastMoveEvent.position().y() / static_cast<double>(size.height());
|
|
+#else
|
|
double normalized_x = lastMoveEvent.x() / static_cast<double>(size.width());
|
|
double normalized_y = lastMoveEvent.y() / static_cast<double>(size.height());
|
|
+#endif
|
|
int button = lastMoveEvent.button();
|
|
int buttons = lastMoveEvent.buttons();
|
|
int modifiers = lastMoveEvent.modifiers();
|
|
@@ -131,8 +152,13 @@ bool pq3DViewEventTranslator::translateEvent(QObject* Object, QEvent* Event, boo
|
|
.arg(modifiers));
|
|
}
|
|
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
+ double normalized_x = mouseEvent->position().x() / static_cast<double>(size.width());
|
|
+ double normalized_y = mouseEvent->position().y() / static_cast<double>(size.height());
|
|
+#else
|
|
double normalized_x = mouseEvent->x() / static_cast<double>(size.width());
|
|
double normalized_y = mouseEvent->y() / static_cast<double>(size.height());
|
|
+#endif
|
|
int button = mouseEvent->button();
|
|
int buttons = mouseEvent->buttons();
|
|
int modifiers = mouseEvent->modifiers();
|
|
diff --git a/pqAbstractButtonEventTranslator.cxx b/pqAbstractButtonEventTranslator.cxx
|
|
index ad785ec90b564cde7fc5146e8060da8daf0cb459..bdcdced3de5248324b1bcca791026202878000b9 100644
|
|
--- a/pqAbstractButtonEventTranslator.cxx
|
|
+++ b/pqAbstractButtonEventTranslator.cxx
|
|
@@ -36,6 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
#include <QAction>
|
|
#include <QDebug>
|
|
#include <QKeyEvent>
|
|
+#include <QMenu>
|
|
#include <QMouseEvent>
|
|
#include <QPushButton>
|
|
#include <QToolButton>
|
|
diff --git a/pqAbstractItemViewEventPlayer.cxx b/pqAbstractItemViewEventPlayer.cxx
|
|
index 95860b099bae0c71b0b37aab980d06eb5d1caf1e..9ab04ae0e954a295b12b910e7e050bafd24555b2 100644
|
|
--- a/pqAbstractItemViewEventPlayer.cxx
|
|
+++ b/pqAbstractItemViewEventPlayer.cxx
|
|
@@ -48,7 +48,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
/// Converts a string representation of a model index into the real thing
|
|
static QModelIndex OldGetIndex(QAbstractItemView& View, const QString& Name)
|
|
{
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
+ QStringList rows = Name.split('/', Qt::SkipEmptyParts);
|
|
+#else
|
|
QStringList rows = Name.split('/', QString::SkipEmptyParts);
|
|
+#endif
|
|
QString column;
|
|
|
|
if (rows.size())
|
|
@@ -88,7 +92,11 @@ static QModelIndex GetIndexByItemName(QAbstractItemView& View, const QString& Na
|
|
|
|
static QModelIndex GetIndex(QAbstractItemView* View, const QString& Name)
|
|
{
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
+ QStringList idxs = Name.split('/', Qt::SkipEmptyParts);
|
|
+#else
|
|
QStringList idxs = Name.split('/', QString::SkipEmptyParts);
|
|
+#endif
|
|
|
|
QModelIndex index;
|
|
for (int i = 0; i != idxs.size(); ++i)
|
|
@@ -200,7 +208,8 @@ bool pqAbstractItemViewEventPlayer::playEvent(
|
|
if (Command == "mouseWheel")
|
|
{
|
|
int delta = args[0].toInt();
|
|
- QWheelEvent we(QPoint(x, y), delta, buttons, keym);
|
|
+ QWheelEvent we(QPointF(x, y), QPointF(x, y), QPoint(0, 0), QPoint(0, delta), buttons, keym,
|
|
+ Qt::NoScrollPhase, false);
|
|
QCoreApplication::sendEvent(Object, &we);
|
|
return true;
|
|
}
|
|
diff --git a/pqAbstractItemViewEventPlayerBase.cxx b/pqAbstractItemViewEventPlayerBase.cxx
|
|
index 8a523e668e4f8d37caae67787ab15cdd3ef7f9ff..fc52293a226a663f87e59246a60f94815e536900 100644
|
|
--- a/pqAbstractItemViewEventPlayerBase.cxx
|
|
+++ b/pqAbstractItemViewEventPlayerBase.cxx
|
|
@@ -163,11 +163,12 @@ bool pqAbstractItemViewEventPlayerBase::playEvent(
|
|
return false;
|
|
}
|
|
|
|
- QRegExp regExp1("^([\\d\\.]+),(\\d+)$");
|
|
- if (command == "setCheckState" && regExp1.indexIn(arguments) != -1)
|
|
+ QRegularExpression regExp1("^([\\d\\.]+),(\\d+)$");
|
|
+ QRegularExpressionMatch match = regExp1.match(arguments);
|
|
+ if (command == "setCheckState" && match.hasMatch())
|
|
{
|
|
- QString strIndex = regExp1.cap(1);
|
|
- int check_state = regExp1.cap(2).toInt();
|
|
+ QString strIndex = match.captured(1);
|
|
+ int check_state = match.captured(2).toInt();
|
|
|
|
QModelIndex index =
|
|
pqAbstractItemViewEventPlayerBase::GetIndex(strIndex, abstractItemView, error);
|
|
diff --git a/pqAbstractItemViewEventTranslator.cxx b/pqAbstractItemViewEventTranslator.cxx
|
|
index b769cca66eab194773d5338171152715181efaa3..07f7b42071582906fcbdbbc149a69773c92b31e6 100644
|
|
--- a/pqAbstractItemViewEventTranslator.cxx
|
|
+++ b/pqAbstractItemViewEventTranslator.cxx
|
|
@@ -153,11 +153,19 @@ bool pqAbstractItemViewEventTranslator::translateEvent(QObject* Object, QEvent*
|
|
if (wheelEvent)
|
|
{
|
|
QString idxStr;
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
+ QModelIndex idx = object->indexAt(wheelEvent->position().toPoint());
|
|
+#else
|
|
QModelIndex idx = object->indexAt(wheelEvent->pos());
|
|
+#endif
|
|
idxStr = toIndexStr(idx);
|
|
QRect r = object->visualRect(idx);
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
+ relPt = wheelEvent->position().toPoint() - r.topLeft();
|
|
+#else
|
|
relPt = wheelEvent->pos() - r.topLeft();
|
|
- int numStep = wheelEvent->delta() > 0 ? 120 : -120;
|
|
+#endif
|
|
+ int numStep = wheelEvent->angleDelta().y() > 0 ? 120 : -120;
|
|
int buttons = wheelEvent->buttons();
|
|
int modifiers = wheelEvent->modifiers();
|
|
Q_EMIT recordEvent(Object, "mouseWheel", QString("%1,%2,%3,%4,%5")
|
|
diff --git a/pqBasicWidgetEventPlayer.cxx b/pqBasicWidgetEventPlayer.cxx
|
|
index 27663a340efb87b92fc4ce10ac393238e8925e95..11ac0d577d53b66e7f624354292a70fb26b553d3 100644
|
|
--- a/pqBasicWidgetEventPlayer.cxx
|
|
+++ b/pqBasicWidgetEventPlayer.cxx
|
|
@@ -83,7 +83,8 @@ bool pqBasicWidgetEventPlayer::playEvent(
|
|
if (command == "mouseWheel")
|
|
{
|
|
int delta = args[0].toInt();
|
|
- QWheelEvent we(QPoint(x, y), delta, buttons, keym);
|
|
+ QWheelEvent we(QPoint(x, y), QPoint(x, y), QPoint(0, 0), QPoint(0, delta), buttons,
|
|
+ keym, Qt::NoScrollPhase, false);
|
|
QCoreApplication::sendEvent(object, &we);
|
|
return true;
|
|
}
|
|
diff --git a/pqBasicWidgetEventTranslator.cxx b/pqBasicWidgetEventTranslator.cxx
|
|
index bdbc340cb9714aea681024d24055be113f6b1bd4..57026f6a65408252602765ad6de6771fef58afa8 100644
|
|
--- a/pqBasicWidgetEventTranslator.cxx
|
|
+++ b/pqBasicWidgetEventTranslator.cxx
|
|
@@ -80,8 +80,13 @@ bool pqBasicWidgetEventTranslator::translateEvent(
|
|
.arg(mouseEvent->button())
|
|
.arg(mouseEvent->buttons())
|
|
.arg(mouseEvent->modifiers())
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
+ .arg(mouseEvent->position().x())
|
|
+ .arg(mouseEvent->position().y());
|
|
+#else
|
|
.arg(mouseEvent->x())
|
|
.arg(mouseEvent->y());
|
|
+#endif
|
|
|
|
if (event->type() != QEvent::MouseButtonRelease)
|
|
{
|
|
@@ -116,13 +121,18 @@ bool pqBasicWidgetEventTranslator::translateEvent(
|
|
{
|
|
int buttons = wheelEvent->buttons();
|
|
int modifiers = wheelEvent->modifiers();
|
|
- int numStep = wheelEvent->delta();
|
|
+ int numStep = wheelEvent->angleDelta().y() > 0 ? 120 : -120;
|
|
Q_EMIT recordEvent(object, "mouseWheel", QString("%1,%2,%3,%4,%5")
|
|
.arg(numStep)
|
|
.arg(buttons)
|
|
.arg(modifiers)
|
|
- .arg(wheelEvent->x())
|
|
- .arg(wheelEvent->y()));
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
+ .arg(wheelEvent->position().x())
|
|
+ .arg(wheelEvent->position().y()));
|
|
+#else
|
|
+ .arg(wheelEvent->pos().x())
|
|
+ .arg(wheelEvent->pos().y()));
|
|
+#endif
|
|
}
|
|
}
|
|
return true;
|
|
diff --git a/pqEventRecorder.cxx b/pqEventRecorder.cxx
|
|
index e20b15ef096a68f5126e387dbfb551a8a5a01c31..8737dfa9fefdbcbe5e9df6dda1621f043e345b69 100644
|
|
--- a/pqEventRecorder.cxx
|
|
+++ b/pqEventRecorder.cxx
|
|
@@ -192,8 +192,10 @@ void pqEventRecorder::start()
|
|
// Set the device
|
|
this->Stream.setDevice(this->File);
|
|
|
|
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
// Set UTF8 Codec
|
|
this->Stream.setCodec("UTF-8");
|
|
+#endif
|
|
|
|
// Set the Stream to the Observer
|
|
this->ActiveObserver->setStream(&this->Stream);
|
|
diff --git a/pqEventTranslator.cxx b/pqEventTranslator.cxx
|
|
index beb7be450741abef46cee21f11f502ecf84f0552..9d9d691848847e47ad2596bea4134e1ccb14665d 100644
|
|
--- a/pqEventTranslator.cxx
|
|
+++ b/pqEventTranslator.cxx
|
|
@@ -103,7 +103,7 @@ struct pqEventTranslator::pqImplementation
|
|
/// Stores the working set of widget translators
|
|
QList<pqWidgetEventTranslator*> Translators;
|
|
/// Stores the set of objects that should be ignored when translating events
|
|
- QMap<QObject*, QRegExp> IgnoredObjects;
|
|
+ QMap<QObject*, QRegularExpression> IgnoredObjects;
|
|
|
|
// list of widgets for which mouse propagation will happen
|
|
// we'll only translate the first and ignore the rest
|
|
@@ -272,7 +272,7 @@ pqEventComment* pqEventTranslator::eventComment() const
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------
|
|
-void pqEventTranslator::ignoreObject(QObject* object, QRegExp commandFilter)
|
|
+void pqEventTranslator::ignoreObject(QObject* object, QRegularExpression commandFilter)
|
|
{
|
|
this->Implementation->IgnoredObjects.insert(object, commandFilter);
|
|
}
|
|
@@ -353,11 +353,21 @@ bool pqEventTranslator::eventFilter(QObject* object, QEvent* event)
|
|
{
|
|
// Check it is not the overlay, and it contains the mouse cursor
|
|
if (topWidget != this->Implementation->CheckOverlay &&
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
+ topWidget->geometry().contains(
|
|
+ static_cast<QMouseEvent*>(event)->globalPosition().toPoint(), true))
|
|
+#else
|
|
topWidget->geometry().contains(static_cast<QMouseEvent*>(event)->globalPos(), true))
|
|
+#endif
|
|
{
|
|
// Recover the child widget onder the cursor, if any
|
|
QWidget* childWidget = topWidget->childAt(
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
+ topWidget->mapFromGlobal(
|
|
+ static_cast<QMouseEvent*>(event)->globalPosition().toPoint()));
|
|
+#else
|
|
topWidget->mapFromGlobal(static_cast<QMouseEvent*>(event)->globalPos()));
|
|
+#endif
|
|
|
|
// If child exist, check it is not the overlayed widget and indeed a new widget
|
|
if (childWidget == NULL ||
|
|
@@ -583,7 +593,7 @@ void pqEventTranslator::onRecordEvent(
|
|
{
|
|
if (this->Implementation->IgnoredObjects.contains(Object))
|
|
{
|
|
- QRegExp commandFilter = this->Implementation->IgnoredObjects.value(Object);
|
|
+ QRegularExpression commandFilter = this->Implementation->IgnoredObjects.value(Object);
|
|
if (Command.contains(commandFilter))
|
|
{
|
|
return;
|
|
diff --git a/pqEventTranslator.h b/pqEventTranslator.h
|
|
index d756bec96f42db4db8e28517a0d610cbef0e1ef4..4b0549f6d794cfeb43ecd6ea2644a5067e25c34d 100644
|
|
--- a/pqEventTranslator.h
|
|
+++ b/pqEventTranslator.h
|
|
@@ -36,7 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
#include "QtTestingExport.h"
|
|
#include <QObject>
|
|
#include <QRect>
|
|
-#include <QRegExp>
|
|
+#include <QRegularExpression>
|
|
|
|
class pqEventComment;
|
|
class pqTestUtility;
|
|
@@ -92,8 +92,8 @@ public:
|
|
/// translating events which command is equivalent to the regexp
|
|
/// (useful to prevent recording UI events from being
|
|
/// captured as part of the recording)
|
|
- void ignoreObject(
|
|
- QObject* object, QRegExp commandFilter = QRegExp("*", Qt::CaseInsensitive, QRegExp::Wildcard));
|
|
+ void ignoreObject(QObject* object, QRegularExpression commandFilter = QRegularExpression(
|
|
+ "*", QRegularExpression::CaseInsensitiveOption));
|
|
|
|
/// start listening to the GUI and translating events
|
|
void start();
|
|
diff --git a/pqObjectNaming.h b/pqObjectNaming.h
|
|
index d31b28d4a4f8275232331af860699796c77c2114..5cef1618d431d26f38cf10d2649e2dc5202f737f 100644
|
|
--- a/pqObjectNaming.h
|
|
+++ b/pqObjectNaming.h
|
|
@@ -38,7 +38,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
#include "QtTestingExport.h"
|
|
|
|
class QObject;
|
|
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
class QStringList;
|
|
+#endif
|
|
|
|
/// Provides functionality to ensuring that Qt objects can be uniquely identified for recording and
|
|
/// playback of regression tests
|
|
diff --git a/pqPlayBackEventsDialog.cxx b/pqPlayBackEventsDialog.cxx
|
|
index d8b3e9547d146fb68dd6c61942b825ae67cd67ec..ff0ebb926c3f49b29f1bce06fa36c4e65a889b0c 100644
|
|
--- a/pqPlayBackEventsDialog.cxx
|
|
+++ b/pqPlayBackEventsDialog.cxx
|
|
@@ -350,7 +350,9 @@ void pqPlayBackEventsDialog::onStarted(const QString& filename)
|
|
file.open(QIODevice::ReadOnly);
|
|
this->Implementation->Ui.logBrowser->append(QString("Start file : %1").arg(infoFile.fileName()));
|
|
QTextStream stream(&file);
|
|
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
stream.setCodec("UTF-8");
|
|
+#endif
|
|
this->Implementation->Ui.currentFileLabel->setText(infoFile.fileName());
|
|
while (!stream.atEnd())
|
|
{
|
|
diff --git a/pqTreeViewEventPlayer.cxx b/pqTreeViewEventPlayer.cxx
|
|
index 02199925d018adc0df3a85548a7813aee7f21c84..d541a9cc684be11b0d30f1fdf321d872e8f9a78b 100644
|
|
--- a/pqTreeViewEventPlayer.cxx
|
|
+++ b/pqTreeViewEventPlayer.cxx
|
|
@@ -63,8 +63,9 @@ bool pqTreeViewEventPlayer::playEvent(
|
|
return false;
|
|
}
|
|
|
|
- QRegExp regExp0("^([\\d\\.]+),(\\d+),(\\d+)$");
|
|
- if (command == "setTreeItemCheckState" && regExp0.indexIn(arguments) != -1)
|
|
+ QRegularExpression regExp0("^([\\d\\.]+),(\\d+),(\\d+)$");
|
|
+ QRegularExpressionMatch match = regExp0.match(arguments);
|
|
+ if (command == "setTreeItemCheckState" && match.hasMatch())
|
|
{
|
|
// legacy command recorded from tree widgets.
|
|
QTreeWidget* treeWidget = qobject_cast<QTreeWidget*>(object);
|
|
@@ -72,11 +73,14 @@ bool pqTreeViewEventPlayer::playEvent(
|
|
{
|
|
return false;
|
|
}
|
|
- QString str_index = regExp0.cap(1);
|
|
- int column = regExp0.cap(2).toInt();
|
|
- int check_state = regExp0.cap(3).toInt();
|
|
-
|
|
+ QString str_index = match.captured(1);
|
|
+ int column = match.captured(2).toInt();
|
|
+ int check_state = match.captured(3).toInt();
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
+ QStringList indices = str_index.split(".", Qt::SkipEmptyParts);
|
|
+#else
|
|
QStringList indices = str_index.split(".", QString::SkipEmptyParts);
|
|
+#endif
|
|
QTreeWidgetItem* cur_item = NULL;
|
|
Q_FOREACH (QString cur_index, indices)
|
|
{
|