removed "0 files" mention

This commit is contained in:
csoler 2020-09-26 17:47:09 +02:00
parent e48986013f
commit 56f3df6737
2 changed files with 11 additions and 3 deletions

View File

@ -30,7 +30,10 @@ RSTreeView::RSTreeView(QWidget *parent) : QTreeView(parent)
void RSTreeView::wheelEvent(QWheelEvent *e) void RSTreeView::wheelEvent(QWheelEvent *e)
{ {
if(e->modifiers() == Qt::ControlModifier) if(e->modifiers() == Qt::ControlModifier)
{
emit zoomRequested(e->delta() > 0); emit zoomRequested(e->delta() > 0);
return;
}
else else
QTreeView::wheelEvent(e); QTreeView::wheelEvent(e);
} }

View File

@ -130,6 +130,7 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
uint32_t flags = (mUseGrid)?(ChannelPostThumbnailView::FLAG_SHOW_TEXT | ChannelPostThumbnailView::FLAG_SCALE_FONT):0; uint32_t flags = (mUseGrid)?(ChannelPostThumbnailView::FLAG_SHOW_TEXT | ChannelPostThumbnailView::FLAG_SCALE_FONT):0;
ChannelPostThumbnailView w(post,flags); ChannelPostThumbnailView w(post,flags);
w.setBackgroundRole(QPalette::AlternateBase);
w.setAspectRatio(mAspectRatio); w.setAspectRatio(mAspectRatio);
w.updateGeometry(); w.updateGeometry();
w.adjustSize(); w.adjustSize();
@ -198,8 +199,11 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
painter->drawText(QPoint(p.x()+0.5*font_height,y),QDateTime::fromSecsSinceEpoch(post.mMeta.mPublishTs).toString(Qt::DefaultLocaleShortDate)); painter->drawText(QPoint(p.x()+0.5*font_height,y),QDateTime::fromSecsSinceEpoch(post.mMeta.mPublishTs).toString(Qt::DefaultLocaleShortDate));
y += font_height; y += font_height;
painter->drawText(QPoint(p.x()+0.5*font_height,y),QString::number(post.mCount)+ " " +((post.mCount>1)?tr("files"):tr("file")) + " (" + QString::number(post.mSize) + " " + tr("bytes") + ")" ); if(post.mCount > 0)
y += font_height; {
painter->drawText(QPoint(p.x()+0.5*font_height,y),QString::number(post.mCount)+ " " +((post.mCount>1)?tr("files"):tr("file")) + " (" + QString::number(post.mSize) + " " + tr("bytes") + ")" );
y += font_height;
}
painter->restore(); painter->restore();
} }
@ -285,7 +289,7 @@ void ChannelPostFilesDelegate::paint(QPainter * painter, const QStyleOptionViewI
w.setFixedHeight(option.rect.height()); w.setFixedHeight(option.rect.height());
QPixmap pixmap(w.size()); QPixmap pixmap(w.size());
pixmap.fill(QRgb(0x00ffffff)); // choose a fully transparent background pixmap.fill(QRgb(0x00ffffff)); // choose a fully transparent background
w.render(&pixmap,QPoint(),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background w.render(&pixmap,QPoint(),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background
painter->drawPixmap(option.rect.topLeft(),pixmap); painter->drawPixmap(option.rect.topLeft(),pixmap);
@ -335,6 +339,7 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
ui->showUnread_TB->setToolTip(tr("Show unread posts only")); ui->showUnread_TB->setToolTip(tr("Show unread posts only"));
connect(ui->showUnread_TB,SIGNAL(toggled(bool)),this,SLOT(switchOnlyUnread(bool))); connect(ui->showUnread_TB,SIGNAL(toggled(bool)),this,SLOT(switchOnlyUnread(bool)));
ui->postsTree->setAlternatingRowColors(true);
ui->postsTree->setModel(mChannelPostsModel = new RsGxsChannelPostsModel()); ui->postsTree->setModel(mChannelPostsModel = new RsGxsChannelPostsModel());
ui->postsTree->setItemDelegate(mChannelPostsDelegate = new ChannelPostDelegate()); ui->postsTree->setItemDelegate(mChannelPostsDelegate = new ChannelPostDelegate());
ui->postsTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // prevents bug on w10, since row size depends on widget width ui->postsTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // prevents bug on w10, since row size depends on widget width