Bump required Qt version to 5.12
This commit is contained in:
@@ -196,11 +196,7 @@ void FreeSpaceBar::DrawText(QPainter *p, const QRect r) {
|
||||
|
||||
int text_width = 0;
|
||||
for (const Label &label : labels) {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
text_width += kLabelBoxSize + kLabelBoxPadding + kLabelSpacing + small_metrics.horizontalAdvance(label.text);
|
||||
#else
|
||||
text_width += kLabelBoxSize + kLabelBoxPadding + kLabelSpacing + small_metrics.width(label.text);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Draw the text
|
||||
@@ -215,18 +211,10 @@ void FreeSpaceBar::DrawText(QPainter *p, const QRect r) {
|
||||
p->setBrush(label.color);
|
||||
p->drawRect(box);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
QRect text(x + kLabelBoxSize + kLabelBoxPadding, r.top(), small_metrics.horizontalAdvance(label.text), r.height());
|
||||
#else
|
||||
QRect text(x + kLabelBoxSize + kLabelBoxPadding, r.top(), small_metrics.width(label.text), r.height());
|
||||
#endif
|
||||
p->setPen(light ? label.color.darker() : label.color);
|
||||
p->drawText(text, Qt::AlignCenter, label.text);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
x += kLabelBoxSize + kLabelBoxPadding + kLabelSpacing + small_metrics.horizontalAdvance(label.text);
|
||||
#else
|
||||
x += kLabelBoxSize + kLabelBoxPadding + kLabelSpacing + small_metrics.width(label.text);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,17 +40,15 @@ LineTextEdit::LineTextEdit(QWidget *parent) : QTextEdit(parent) {
|
||||
}
|
||||
|
||||
QSize LineTextEdit::sizeHint() const {
|
||||
|
||||
QFontMetrics fm(font());
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
QSize LineTextEdit::minimumSizeHint() const {
|
||||
|
||||
@@ -49,11 +49,7 @@ MultiLoadingIndicator::MultiLoadingIndicator(QWidget *parent)
|
||||
|
||||
QSize MultiLoadingIndicator::sizeHint() const {
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
const int width = kHorizontalPadding * 2 + spinner_->sizeHint().width() + kSpacing + fontMetrics().horizontalAdvance(text_);
|
||||
#else
|
||||
const int width = kHorizontalPadding * 2 + spinner_->sizeHint().width() + kSpacing + fontMetrics().width(text_);
|
||||
#endif
|
||||
const int height = kVerticalPadding * 2 + qMax(spinner_->sizeHint().height(), fontMetrics().height());
|
||||
|
||||
return QSize(width, height);
|
||||
|
||||
@@ -80,11 +80,7 @@ void TrackSliderPopup::paintEvent(QPaintEvent*) {
|
||||
|
||||
void TrackSliderPopup::UpdatePixmap() {
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
const int text_width = qMax(font_metrics_.horizontalAdvance(text_), small_font_metrics_.horizontalAdvance(small_text_));
|
||||
#else
|
||||
const int text_width = qMax(font_metrics_.width(text_), small_font_metrics_.width(small_text_));
|
||||
#endif
|
||||
const QRect text_rect1(static_cast<int>(kBlurRadius) + kTextMargin, static_cast<int>(kBlurRadius) + kTextMargin, text_width + 2, font_metrics_.height());
|
||||
const QRect text_rect2(static_cast<int>(kBlurRadius) + kTextMargin, text_rect1.bottom(), text_width, small_font_metrics_.height());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user