summaryrefslogtreecommitdiff
path: root/src/plugins/scxmleditor
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2019-08-29 14:41:14 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2019-09-03 09:15:24 +0000
commit6f4aa0458c991e3f81154469265899e30fe8121e (patch)
tree0a44a02c244748e7c90acef88e5482a7114222d2 /src/plugins/scxmleditor
parentd39d26a54f797ca7900d7e61ff6253b4a8d2d848 (diff)
downloadqt-creator-6f4aa0458c991e3f81154469265899e30fe8121e.tar.gz
Remove usages of deprecated APIs (part 2)
Replace the uses of deprecated APIs listed below, while keeping in mind that compatibility with Qt 5.12 (the latest LTS) must be kept. This means that the new alternatives must be used only when compiling with Qt versions where the replacement is available. Replaced: QLineF::intersect() -> QLine::intersects() (since 5.14) QComboBox::activated() -> QComboBox::textActivated() (since 5.14) QWheelEvent::pos() -> QWheelEvent::position() (since 5.14) QList::swap() -> QList::swapItemsAt() (since 5.13) Task-number: QTBUG-76491 Change-Id: I62adc4f0826607b0156bf4bc5648ffb0e41cd895 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/scxmleditor')
-rw-r--r--src/plugins/scxmleditor/common/navigatorgraphicsview.cpp4
-rw-r--r--src/plugins/scxmleditor/plugin_interface/sceneutils.cpp4
-rw-r--r--src/plugins/scxmleditor/plugin_interface/transitionitem.cpp20
3 files changed, 28 insertions, 0 deletions
diff --git a/src/plugins/scxmleditor/common/navigatorgraphicsview.cpp b/src/plugins/scxmleditor/common/navigatorgraphicsview.cpp
index c1c8173638..e49aaaefca 100644
--- a/src/plugins/scxmleditor/common/navigatorgraphicsview.cpp
+++ b/src/plugins/scxmleditor/common/navigatorgraphicsview.cpp
@@ -80,7 +80,11 @@ void NavigatorGraphicsView::wheelEvent(QWheelEvent *event)
else
emit zoomOut();
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
emit moveMainViewTo(mapToScene(event->pos()));
+#else
+ emit moveMainViewTo(mapToScene(event->position().toPoint()));
+#endif
} else
QGraphicsView::wheelEvent(event);
}
diff --git a/src/plugins/scxmleditor/plugin_interface/sceneutils.cpp b/src/plugins/scxmleditor/plugin_interface/sceneutils.cpp
index 016749d221..04456168d6 100644
--- a/src/plugins/scxmleditor/plugin_interface/sceneutils.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/sceneutils.cpp
@@ -224,7 +224,11 @@ void layout(const QList<QGraphicsItem*> &items)
firstItem = initialItem->outputTransitions().constFirst()->connectedItem(initialItem);
int index = childItems.indexOf(firstItem);
if (index > 0)
+#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
childItems.swap(index, 0);
+#else
+ childItems.swapItemsAt(index, 0);
+#endif
}
// Search final-item
diff --git a/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp b/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp
index eb05ca403f..fefa5c3e56 100644
--- a/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp
@@ -306,11 +306,19 @@ void TransitionItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
QPointF intersPoint;
QLineF line2(p, p + QPointF(SELECTION_DISTANCE, SELECTION_DISTANCE));
line2.setAngle(line.angle() + 90);
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
if (line.intersect(line2, &intersPoint) == QLineF::BoundedIntersection)
+#else
+ if (line.intersects(line2, &intersPoint) == QLineF::BoundedIntersection)
+#endif
sel = true;
else {
line2.setAngle(line.angle() - 90);
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
sel = line.intersect(line2, &intersPoint) == QLineF::BoundedIntersection;
+#else
+ sel = line.intersects(line2, &intersPoint) == QLineF::BoundedIntersection;
+#endif
}
if (sel)
@@ -797,7 +805,11 @@ QPointF TransitionItem::findIntersectionPoint(ConnectableItem *item, const QLine
for (int i = 1; i < itemPolygon.count(); ++i) {
p2 = itemPolygon.at(i) + item->scenePos();
checkLine = QLineF(p1, p2);
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
if (checkLine.intersect(line, &intersectPoint) == QLineF::BoundedIntersection)
+#else
+ if (checkLine.intersects(line, &intersectPoint) == QLineF::BoundedIntersection)
+#endif
return intersectPoint;
p1 = p2;
}
@@ -1083,11 +1095,19 @@ bool TransitionItem::containsScenePoint(const QPointF &p) const
QPointF intersPoint;
QLineF line2(pp, pp + QPointF(SELECTION_DISTANCE, SELECTION_DISTANCE));
line2.setAngle(line.angle() + 90);
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
if (line.intersect(line2, &intersPoint) == QLineF::BoundedIntersection) {
+#else
+ if (line.intersects(line2, &intersPoint) == QLineF::BoundedIntersection) {
+#endif
return true;
} else {
line2.setAngle(line.angle() - 90);
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
if (line.intersect(line2, &intersPoint) == QLineF::BoundedIntersection)
+#else
+ if (line.intersects(line2, &intersPoint) == QLineF::BoundedIntersection)
+#endif
return true;
}
}