From 4c0d4f35fecbd53f9bea12abe50a14fb74820435 Mon Sep 17 00:00:00 2001 From: Joseph Donofry Date: Thu, 4 Jul 2019 22:58:06 -0400 Subject: Fix support for Qt versions < 5.11 --- src/TypingDisplay.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/TypingDisplay.cpp') diff --git a/src/TypingDisplay.cpp b/src/TypingDisplay.cpp index fc5e2df4..6059601d 100644 --- a/src/TypingDisplay.cpp +++ b/src/TypingDisplay.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "Config.h" #include "TypingDisplay.h" @@ -69,9 +70,12 @@ TypingDisplay::paintEvent(QPaintEvent *) text_ = fm.elidedText(text_, Qt::ElideRight, (double)(width() * 0.75)); QPainterPath path; +#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) + path.addRoundedRect(QRectF(0, 0, fm.width(text_) + 2 * LEFT_PADDING, height()), 3, 3); +#else path.addRoundedRect( QRectF(0, 0, fm.horizontalAdvance(text_) + 2 * LEFT_PADDING, height()), 3, 3); - +#endif p.fillPath(path, backgroundColor()); p.drawText(region, Qt::AlignVCenter, text_); } -- cgit 1.5.1