From 7d67bcad22e07fcf9181fb72eb67bfa008f78e43 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 28 Dec 2024 22:08:52 -0500 Subject: [PATCH] compatibility with Qt 5.12 on Ubuntu 20.04LTS --- tools/lammps-gui/logwindow.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/lammps-gui/logwindow.cpp b/tools/lammps-gui/logwindow.cpp index b4ff36564c..e08b0c3aea 100644 --- a/tools/lammps-gui/logwindow.cpp +++ b/tools/lammps-gui/logwindow.cpp @@ -115,16 +115,20 @@ void LogWindow::stop_run() void LogWindow::next_warning() { auto *doc = document(); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + auto regex = QRegExp(QStringLiteral("^(ERROR|WARNING).*$")); +#else auto regex = QRegularExpression(QStringLiteral("^(ERROR|WARNING).*$")); +#endif if (warnings->get_nwarnings() > 0) { // wrap around search - if (!this->find(regex)) { - this->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor); - this->find(regex); + if (!find(regex)) { + moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor); + find(regex); } // move cursor to unselect - this->moveCursor(QTextCursor::NextBlock, QTextCursor::MoveAnchor); + moveCursor(QTextCursor::NextBlock, QTextCursor::MoveAnchor); } }