Fix formatting issues

This commit is contained in:
Joseph Donofry 2019-07-04 21:31:28 -04:00
parent c0a010acbb
commit 2484e0c118
No known key found for this signature in database
GPG Key ID: E8A1D78EF044B0CB
7 changed files with 16 additions and 12 deletions

View File

@ -182,7 +182,8 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
QFont tsFont;
tsFont.setPointSizeF(tsFont.pointSizeF() * 0.9);
const int msgStampWidth = QFontMetrics(tsFont).horizontalAdvance(lastMsgInfo_.timestamp) + 4;
const int msgStampWidth =
QFontMetrics(tsFont).horizontalAdvance(lastMsgInfo_.timestamp) + 4;
// We use the full width of the widget if there is no unread msg bubble.
const int bottomLineWidthLimit = (unreadMsgCount_ > 0) ? msgStampWidth : 0;

View File

@ -69,7 +69,8 @@ TypingDisplay::paintEvent(QPaintEvent *)
text_ = fm.elidedText(text_, Qt::ElideRight, (double)(width() * 0.75));
QPainterPath path;
path.addRoundedRect(QRectF(0, 0, fm.horizontalAdvance(text_) + 2 * LEFT_PADDING, height()), 3, 3);
path.addRoundedRect(
QRectF(0, 0, fm.horizontalAdvance(text_) + 2 * LEFT_PADDING, height()), 3, 3);
p.fillPath(path, backgroundColor());
p.drawText(region, Qt::AlignVCenter, text_);

View File

@ -733,7 +733,8 @@ TimelineItem::generateUserName(const QString &user_id, const QString &displaynam
userName_->setAlignment(Qt::AlignLeft | Qt::AlignTop);
// width deprecated in 5.13:
// userName_->setFixedWidth(QFontMetrics(userName_->font()).width(userName_->text()));
userName_->setFixedWidth(QFontMetrics(userName_->font()).horizontalAdvance(userName_->text()));
userName_->setFixedWidth(
QFontMetrics(userName_->font()).horizontalAdvance(userName_->text()));
// Set the user color asynchronously if it hasn't been generated yet,
// otherwise this will just set it.

View File

@ -162,8 +162,9 @@ AudioItem::resizeEvent(QResizeEvent *event)
font.setWeight(QFont::Medium);
QFontMetrics fm(font);
const int computedWidth = std::min(
fm.horizontalAdvance(text_) + 2 * IconRadius + VerticalPadding * 2 + TextPadding, (double)MaxWidth);
const int computedWidth =
std::min(fm.horizontalAdvance(text_) + 2 * IconRadius + VerticalPadding * 2 + TextPadding,
(double)MaxWidth);
resize(computedWidth, Height);

View File

@ -153,8 +153,9 @@ FileItem::resizeEvent(QResizeEvent *event)
font.setWeight(QFont::Medium);
QFontMetrics fm(font);
const int computedWidth = std::min(
fm.horizontalAdvance(text_) + 2 * IconRadius + VerticalPadding * 2 + TextPadding, (double)MaxWidth);
const int computedWidth =
std::min(fm.horizontalAdvance(text_) + 2 * IconRadius + VerticalPadding * 2 + TextPadding,
(double)MaxWidth);
resize(computedWidth, Height);

View File

@ -31,9 +31,8 @@ public:
gradient.setFinalStop(right1);
painter.setBrush(QBrush(gradient));
// Deprecated in 5.13: painter.drawRoundRect(
// QRectF(QPointF(width - margin * radius, margin), QPointF(width, height - margin)),
// 0.0,
// 0.0);
// QRectF(QPointF(width - margin * radius, margin), QPointF(width, height -
// margin)), 0.0, 0.0);
painter.drawRoundedRect(
QRectF(QPointF(width - margin * radius, margin), QPointF(width, height - margin)),
0.0,