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>
This commit is contained in:
Sona Kurazyan
2019-08-29 14:41:14 +02:00
parent d39d26a54f
commit 6f4aa0458c
8 changed files with 53 additions and 2 deletions

View File

@@ -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;
}
}