fixed sizes in forums and removed duplicate text on distribution column

This commit is contained in:
csoler 2020-06-30 18:10:28 +02:00
parent c58aa688d1
commit 8d40224c37
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 22 additions and 5 deletions

View File

@ -669,8 +669,11 @@ QVariant RsGxsForumModel::displayRole(const ForumModelPostEntry& fmpe,int col) c
return QVariant(DateTime::formatDateTime(qtime)); return QVariant(DateTime::formatDateTime(qtime));
} }
case COLUMN_THREAD_DISTRIBUTION: case COLUMN_THREAD_DISTRIBUTION: // passthrough // handled by delegate.
case COLUMN_THREAD_AUTHOR:{ case COLUMN_THREAD_MSGID:
return QVariant();
case COLUMN_THREAD_AUTHOR:
{
QString name; QString name;
RsGxsId id = RsGxsId(fmpe.mAuthorId.toStdString()); RsGxsId id = RsGxsId(fmpe.mAuthorId.toStdString());
@ -680,7 +683,6 @@ QVariant RsGxsForumModel::displayRole(const ForumModelPostEntry& fmpe,int col) c
return name; return name;
return QVariant(tr("[Unknown]")); return QVariant(tr("[Unknown]"));
} }
case COLUMN_THREAD_MSGID: return QVariant();
#ifdef TODO #ifdef TODO
if (filterColumn == COLUMN_THREAD_CONTENT) { if (filterColumn == COLUMN_THREAD_CONTENT) {
// need content for filter // need content for filter

View File

@ -134,6 +134,13 @@ public:
const QPoint p = QPoint((r.width() - pix.width())/2, (r.height() - pix.height())/2); const QPoint p = QPoint((r.width() - pix.width())/2, (r.height() - pix.height())/2);
painter->drawPixmap(r.topLeft() + p, pix); painter->drawPixmap(r.topLeft() + p, pix);
} }
virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override
{
static auto img(FilesDefs::getPixmapFromQtResourcePath(IMAGE_WARNING_YELLOW));
return QSize(img.width()*1.2,option.rect.height());
}
}; };
class ReadStatusItemDelegate: public QStyledItemDelegate class ReadStatusItemDelegate: public QStyledItemDelegate
@ -183,6 +190,13 @@ public:
const QPoint p = QPoint((r.width() - pix.width())/2, (r.height() - pix.height())/2); const QPoint p = QPoint((r.width() - pix.width())/2, (r.height() - pix.height())/2);
painter->drawPixmap(r.topLeft() + p, pix); painter->drawPixmap(r.topLeft() + p, pix);
} }
virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override
{
static auto img(FilesDefs::getPixmapFromQtResourcePath(":/images/message-state-unread.png"));
return QSize(img.width()*1.2,option.rect.height());
}
}; };
class ForumPostSortFilterProxyModel: public QSortFilterProxyModel class ForumPostSortFilterProxyModel: public QSortFilterProxyModel
@ -299,9 +313,10 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
QHeaderView * ttheader = ui->threadTreeWidget->header () ; QHeaderView * ttheader = ui->threadTreeWidget->header () ;
ttheader->resizeSection (RsGxsForumModel::COLUMN_THREAD_DATE, 140*f); ttheader->resizeSection (RsGxsForumModel::COLUMN_THREAD_DATE, 140*f);
ttheader->resizeSection (RsGxsForumModel::COLUMN_THREAD_TITLE, 440*f); ttheader->resizeSection (RsGxsForumModel::COLUMN_THREAD_TITLE, 440*f);
ttheader->resizeSection (RsGxsForumModel::COLUMN_THREAD_DISTRIBUTION, 24*f);
ttheader->resizeSection (RsGxsForumModel::COLUMN_THREAD_AUTHOR, 150*f); ttheader->resizeSection (RsGxsForumModel::COLUMN_THREAD_AUTHOR, 150*f);
ttheader->resizeSection (RsGxsForumModel::COLUMN_THREAD_READ, 24*f);
ui->threadTreeWidget->resizeColumnToContents(RsGxsForumModel::COLUMN_THREAD_DISTRIBUTION);
ui->threadTreeWidget->resizeColumnToContents(RsGxsForumModel::COLUMN_THREAD_READ);
QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_TITLE, QHeaderView::Interactive); QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_TITLE, QHeaderView::Interactive);
QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_DATE, QHeaderView::Interactive); QHeaderView_setSectionResizeModeColumn(ttheader, RsGxsForumModel::COLUMN_THREAD_DATE, QHeaderView::Interactive);