From 2a0dd1586414f83b55cb20d11042fb49efc88419 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 2 Mar 2026 10:36:18 +1100 Subject: Update deprecated methods for Qt 6+. QDropEvent::pos -> position for Qt6. QMessageBox constructor updated to variant with single buttons argument. --- qt/ScintillaEditBase/PlatQt.cpp | 5 +++++ qt/ScintillaEditBase/PlatQt.h | 5 +++++ qt/ScintillaEditBase/ScintillaEditBase.cpp | 16 +++++++++++++--- 3 files changed, 23 insertions(+), 3 deletions(-) (limited to 'qt') diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp index 38aec01a0..96e7f2865 100644 --- a/qt/ScintillaEditBase/PlatQt.cpp +++ b/qt/ScintillaEditBase/PlatQt.cpp @@ -1378,8 +1378,13 @@ void Platform::Assert(const char *c, const char *file, int line) noexcept char buffer[2000]; snprintf(buffer, std::size(buffer), "Assertion [%s] failed at %s %d", c, file, line); if (Platform::ShowAssertionPopUps(false)) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0) + QMessageBox mb(QMessageBox::Icon::NoIcon, "Assertion Failure", buffer, + QMessageBox::StandardButton::Ok); +#else QMessageBox mb("Assertion Failure", buffer, QMessageBox::NoIcon, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); +#endif mb.exec(); } else { strcat(buffer, "\n"); diff --git a/qt/ScintillaEditBase/PlatQt.h b/qt/ScintillaEditBase/PlatQt.h index 08cda9dc4..56fa8bb06 100644 --- a/qt/ScintillaEditBase/PlatQt.h +++ b/qt/ScintillaEditBase/PlatQt.h @@ -61,6 +61,11 @@ inline Point PointFromQPoint(QPoint qp) return Point(qp.x(), qp.y()); } +inline Point PointFromQPointF(QPointF qp) +{ + return Point(qp.x(), qp.y()); +} + inline QPointF QPointFFromPoint(Point qp) { return QPointF(qp.x, qp.y); diff --git a/qt/ScintillaEditBase/ScintillaEditBase.cpp b/qt/ScintillaEditBase/ScintillaEditBase.cpp index 187da9dbe..477dd44cf 100644 --- a/qt/ScintillaEditBase/ScintillaEditBase.cpp +++ b/qt/ScintillaEditBase/ScintillaEditBase.cpp @@ -304,6 +304,16 @@ unsigned int TimeOfEvent(const QElapsedTimer &timer) return static_cast(timer.elapsed() % maxTime); } +Point PointOfEvent(const QDropEvent *event) +{ +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + PLATFORM_ASSERT(false); + return PointFromQPointF(event->position()); +#else + return PointFromQPoint(event->pos()); +#endif +} + } void ScintillaEditBase::mousePressEvent(QMouseEvent *event) @@ -396,7 +406,7 @@ void ScintillaEditBase::dragEnterEvent(QDragEnterEvent *event) } else if (event->mimeData()->hasText()) { event->acceptProposedAction(); - const Point point = PointFromQPoint(event->pos()); + const Point point = PointOfEvent(event); sqt->DragEnter(point); } else { event->ignore(); @@ -415,7 +425,7 @@ void ScintillaEditBase::dragMoveEvent(QDragMoveEvent *event) } else if (event->mimeData()->hasText()) { event->acceptProposedAction(); - const Point point = PointFromQPoint(event->pos()); + const Point point = PointOfEvent(event); sqt->DragMove(point); } else { event->ignore(); @@ -430,7 +440,7 @@ void ScintillaEditBase::dropEvent(QDropEvent *event) } else if (event->mimeData()->hasText()) { event->acceptProposedAction(); - const Point point = PointFromQPoint(event->pos()); + const Point point = PointOfEvent(event); const bool move = (event->source() == this && event->proposedAction() == Qt::MoveAction); sqt->Drop(point, event->mimeData(), move); -- cgit v1.2.3