ifdef QFontMetrics::horizontalAdvance to make it work with older Qt

This commit is contained in:
Jonas Kvinge
2019-07-08 23:27:45 +02:00
parent 4150e3efde
commit 5f7efee00e
10 changed files with 52 additions and 2 deletions

View File

@@ -48,7 +48,11 @@ QSize LineTextEdit::sizeHint() const {
static const int kMargin = 5;
int h = 2 * kMargin + qMax(fm.height(), 14);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
int w = 2 * kMargin + fm.horizontalAdvance("W") * 15;
#else
int w = 2 * kMargin + fm.width("W") * 15;
#endif
return QSize(w, h);
}