Fix support for Qt versions < 5.11
This commit is contained in:
parent
2484e0c118
commit
4c0d4f35fe
8 changed files with 56 additions and 12 deletions
|
|
@ -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_);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue