remove QFontMEtrics declaration

This commit is contained in:
kirillpt 2020-11-25 02:03:25 +03:00
parent daf8531e3f
commit 4e8a2d8c9e
2 changed files with 3 additions and 6 deletions

View file

@ -162,8 +162,6 @@ LoginPage::LoginPage(QWidget *parent)
error_label_->setFont(font); error_label_->setFont(font);
error_label_->setWordWrap(true); error_label_->setWordWrap(true);
error_font_metrics_ = new QFontMetrics(font);
top_layout_->addLayout(top_bar_layout_); top_layout_->addLayout(top_bar_layout_);
top_layout_->addStretch(1); top_layout_->addStretch(1);
top_layout_->addLayout(logo_layout_); top_layout_->addLayout(logo_layout_);
@ -192,8 +190,9 @@ LoginPage::LoginPage(QWidget *parent)
void void
LoginPage::loginError(const QString &msg) LoginPage::loginError(const QString &msg)
{ {
int width = error_font_metrics_->boundingRect(msg).width(); auto rect = QFontMetrics(font()).boundingRect(msg);
int height = error_font_metrics_->boundingRect(msg).height(); int width = rect.width();
int height = rect.height();
error_label_->setFixedHeight(qCeil(width / 200 * height)); error_label_->setFixedHeight(qCeil(width / 200 * height));
error_label_->setText(msg); error_label_->setText(msg);
} }

View file

@ -115,8 +115,6 @@ private:
QLabel *error_label_; QLabel *error_label_;
QLabel *error_matrixid_label_; QLabel *error_matrixid_label_;
QFontMetrics *error_font_metrics_;
QHBoxLayout *serverLayout_; QHBoxLayout *serverLayout_;
QHBoxLayout *matrixidLayout_; QHBoxLayout *matrixidLayout_;
LoadingIndicator *spinner_; LoadingIndicator *spinner_;