From 5ec680d09ced3cdf10ae4fe6ee36985dbcba913c Mon Sep 17 00:00:00 2001 From: Michael Welter Date: Wed, 20 Oct 2021 23:36:53 +0200 Subject: opentrack: fix compatibility option for obsolete QT --- spline/spline-widget.cpp | 11 ++++++++--- tracker-fusion/fusion.cpp | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/spline/spline-widget.cpp b/spline/spline-widget.cpp index 514bbf7b..6746a6c0 100644 --- a/spline/spline-widget.cpp +++ b/spline/spline-widget.cpp @@ -109,9 +109,11 @@ void spline_widget::drawBackground() const int ystep = (int)std::ceil(y_step_), xstep = (int)std::ceil(x_step_); const double maxx = config->max_input(); const double maxy = config->max_output(); - +#ifndef OTR_OBSOLETE_QT_WORKAROUND double space_width = metrics.horizontalAdvance(' '); - +#else + double space_width = metrics.boundingRect(' ').right(); +#endif painter.setPen(palette().text().color()); // vertical grid @@ -145,8 +147,11 @@ void spline_widget::drawBackground() const QString text = QString::number(i); QRectF rect = metrics.boundingRect(text); +#ifndef OTR_OBSOLETE_QT_WORKAROUND double advance = metrics.horizontalAdvance(text); - +#else + double advance = metrics.boundingRect(text).right(); +#endif painter.drawText(QPointF(x - advance/2 - rect.left(), pixel_bounds.bottom() + metrics.lineSpacing()), text); diff --git a/tracker-fusion/fusion.cpp b/tracker-fusion/fusion.cpp index 47dc0d13..56a5fa33 100644 --- a/tracker-fusion/fusion.cpp +++ b/tracker-fusion/fusion.cpp @@ -14,6 +14,7 @@ #include #include #include +#include static const char* own_name = "fusion"; -- cgit v1.2.3