diff options
author | Michael Welter <michael@welter-4d.de> | 2021-10-20 23:36:53 +0200 |
---|---|---|
committer | Michael Welter <michael@welter-4d.de> | 2021-10-20 23:39:44 +0200 |
commit | 5ec680d09ced3cdf10ae4fe6ee36985dbcba913c (patch) | |
tree | 8af1dff0ce16e468b9bbed06ddc916b8efef0d04 | |
parent | ea391bae54bbcf61698eaedc09cbedc32a4a8c46 (diff) |
opentrack: fix compatibility option for obsolete QT
-rw-r--r-- | spline/spline-widget.cpp | 11 | ||||
-rw-r--r-- | 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 <QDebug> #include <QMessageBox> #include <QApplication> +#include <cassert> static const char* own_name = "fusion"; |