mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 13:08:48 +03:00
Fix formatting issues
This commit is contained in:
parent
c0a010acbb
commit
2484e0c118
7 changed files with 16 additions and 12 deletions
|
@ -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;
|
||||
|
|
|
@ -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_);
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -352,11 +352,11 @@ TimelineItem::setupWidgetLayout(Widget *widget, const Event &event, bool withSen
|
|||
{
|
||||
init();
|
||||
|
||||
//if (event.type == mtx::events::EventType::RoomMessage) {
|
||||
// if (event.type == mtx::events::EventType::RoomMessage) {
|
||||
// message_type_ = mtx::events::getMessageType(event.content.msgtype);
|
||||
//}
|
||||
// TODO: Fix this.
|
||||
message_type_ = mtx::events::MessageType::Unknown;
|
||||
message_type_ = mtx::events::MessageType::Unknown;
|
||||
event_id_ = QString::fromStdString(event.event_id);
|
||||
const auto sender = QString::fromStdString(event.sender);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue