fix: remove sizeHint again

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2022-10-03 15:47:11 +02:00
parent 5f190ca34c
commit e6c3dad6e5
No known key found for this signature in database
GPG Key ID: C10411294912A422
2 changed files with 0 additions and 11 deletions

View File

@ -29,18 +29,8 @@ void InstanceDelegate::initStyleOption(QStyleOptionViewItem* option, const QMode
if (index.column() == InstanceList::NameColumn) {
option->decorationSize = QSize(m_iconSize, m_iconSize);
if (m_isGrid) {
option->decorationAlignment = Qt::AlignCenter;
option->displayAlignment = Qt::AlignHCenter | Qt::AlignTop;
// FIXME: kinda hacky way to add vertical padding. This assumes that the icon is square in the first place
option->decorationSize.rheight() += 8;
}
}
}
QSize InstanceDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
{
QSize s = QStyledItemDelegate::sizeHint(option, index);
if (m_isGrid)
s.rheight() = std::max(s.height(), m_iconSize * 2);
return s;
}

View File

@ -27,7 +27,6 @@ class InstanceDelegate : public QStyledItemDelegate {
InstanceDelegate(QObject* parent = 0, int iconSize = 48, bool isGrid = false);
void initStyleOption(QStyleOptionViewItem* option, const QModelIndex& index) const override;
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
private:
int m_iconSize;