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; QFont tsFont;
tsFont.setPointSizeF(tsFont.pointSizeF() * 0.9); 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. // We use the full width of the widget if there is no unread msg bubble.
const int bottomLineWidthLimit = (unreadMsgCount_ > 0) ? msgStampWidth : 0; 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)); text_ = fm.elidedText(text_, Qt::ElideRight, (double)(width() * 0.75));
QPainterPath path; 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.fillPath(path, backgroundColor());
p.drawText(region, Qt::AlignVCenter, text_); 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); userName_->setAlignment(Qt::AlignLeft | Qt::AlignTop);
// width deprecated in 5.13: // width deprecated in 5.13:
// userName_->setFixedWidth(QFontMetrics(userName_->font()).width(userName_->text())); // 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, // Set the user color asynchronously if it hasn't been generated yet,
// otherwise this will just set it. // otherwise this will just set it.

View file

@ -352,11 +352,11 @@ TimelineItem::setupWidgetLayout(Widget *widget, const Event &event, bool withSen
{ {
init(); init();
//if (event.type == mtx::events::EventType::RoomMessage) { // if (event.type == mtx::events::EventType::RoomMessage) {
// message_type_ = mtx::events::getMessageType(event.content.msgtype); // message_type_ = mtx::events::getMessageType(event.content.msgtype);
//} //}
// TODO: Fix this. // TODO: Fix this.
message_type_ = mtx::events::MessageType::Unknown; message_type_ = mtx::events::MessageType::Unknown;
event_id_ = QString::fromStdString(event.event_id); event_id_ = QString::fromStdString(event.event_id);
const auto sender = QString::fromStdString(event.sender); const auto sender = QString::fromStdString(event.sender);

View file

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

View file

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

View file

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