diff --git a/src/LoginPage.cpp b/src/LoginPage.cpp index bb25b535..6d040c53 100644 --- a/src/LoginPage.cpp +++ b/src/LoginPage.cpp @@ -162,8 +162,6 @@ LoginPage::LoginPage(QWidget *parent) error_label_->setFont(font); error_label_->setWordWrap(true); - error_font_metrics_ = new QFontMetrics(font); - top_layout_->addLayout(top_bar_layout_); top_layout_->addStretch(1); top_layout_->addLayout(logo_layout_); @@ -192,8 +190,9 @@ LoginPage::LoginPage(QWidget *parent) void LoginPage::loginError(const QString &msg) { - int width = error_font_metrics_->boundingRect(msg).width(); - int height = error_font_metrics_->boundingRect(msg).height(); + auto rect = QFontMetrics(font()).boundingRect(msg); + int width = rect.width(); + int height = rect.height(); error_label_->setFixedHeight(qCeil(width / 200 * height)); error_label_->setText(msg); } diff --git a/src/LoginPage.h b/src/LoginPage.h index 624a52a4..92b60afe 100644 --- a/src/LoginPage.h +++ b/src/LoginPage.h @@ -115,8 +115,6 @@ private: QLabel *error_label_; QLabel *error_matrixid_label_; - QFontMetrics *error_font_metrics_; - QHBoxLayout *serverLayout_; QHBoxLayout *matrixidLayout_; LoadingIndicator *spinner_;