summary refs log tree commit diff
path: root/src/TypingDisplay.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/TypingDisplay.cpp')
-rw-r--r--src/TypingDisplay.cpp6
1 files changed, 5 insertions, 1 deletions
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 <QPainter> #include <QPoint> #include <QShowEvent> +#include <QtGlobal> #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_); }