improving readability of channel list view items

This commit is contained in:
csoler 2020-10-16 23:08:11 +02:00
parent 695706cfae
commit 5fe37e013a
2 changed files with 24 additions and 7 deletions

View File

@ -204,17 +204,28 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
font.setBold(true);
painter->setFont(font);
}
painter->drawText(QPoint(p.x()+0.5*font_height,y),QString::fromUtf8(post.mMeta.mMsgName.c_str()));
y += font_height;
painter->drawText(QPoint(p.x()+0.5*font_height,y),QDateTime::fromSecsSinceEpoch(post.mMeta.mPublishTs).toString(Qt::DefaultLocaleShortDate));
{
painter->save();
QFont font(painter->font());
font.setUnderline(true);
painter->setFont(font);
painter->drawText(QPoint(p.x()+0.5*font_height,y),QString::fromUtf8(post.mMeta.mMsgName.c_str()));
painter->restore();
}
y += font_height;
y += font_height/2.0;
QString info_text = QDateTime::fromSecsSinceEpoch(post.mMeta.mPublishTs).toString(Qt::DefaultLocaleShortDate);
if(post.mCount > 0)
{
painter->drawText(QPoint(p.x()+0.5*font_height,y),QString::number(post.mCount)+ " " +((post.mCount>1)?tr("files"):tr("file")) + " (" + misc::friendlyUnit(qulonglong(post.mSize)) + ")" );
y += font_height;
}
info_text += ", " + QString::number(post.mCount)+ " " +((post.mCount>1)?tr("files"):tr("file")) + " (" + misc::friendlyUnit(qulonglong(post.mSize)) + ")" ;
painter->drawText(QPoint(p.x()+0.5*font_height,y),info_text);
y += font_height;
painter->restore();
}

View File

@ -482,6 +482,12 @@ p, li { white-space: pre-wrap; }
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QLabel" name="postName_LB">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>TextLabel</string>
</property>