summaryrefslogtreecommitdiffhomepage
path: root/spline/spline-widget.cpp
diff options
context:
space:
mode:
authorMichael Welter <michael@welter-4d.de>2021-10-20 23:36:53 +0200
committerMichael Welter <michael@welter-4d.de>2021-10-20 23:39:44 +0200
commit5ec680d09ced3cdf10ae4fe6ee36985dbcba913c (patch)
tree8af1dff0ce16e468b9bbed06ddc916b8efef0d04 /spline/spline-widget.cpp
parentea391bae54bbcf61698eaedc09cbedc32a4a8c46 (diff)
opentrack: fix compatibility option for obsolete QT
Diffstat (limited to 'spline/spline-widget.cpp')
-rw-r--r--spline/spline-widget.cpp11
1 files changed, 8 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);