fix: remove sizeHint again
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
5f190ca34c
commit
e6c3dad6e5
@ -29,18 +29,8 @@ void InstanceDelegate::initStyleOption(QStyleOptionViewItem* option, const QMode
|
|||||||
if (index.column() == InstanceList::NameColumn) {
|
if (index.column() == InstanceList::NameColumn) {
|
||||||
option->decorationSize = QSize(m_iconSize, m_iconSize);
|
option->decorationSize = QSize(m_iconSize, m_iconSize);
|
||||||
if (m_isGrid) {
|
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
|
// FIXME: kinda hacky way to add vertical padding. This assumes that the icon is square in the first place
|
||||||
option->decorationSize.rheight() += 8;
|
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;
|
|
||||||
}
|
|
||||||
|
@ -27,7 +27,6 @@ class InstanceDelegate : public QStyledItemDelegate {
|
|||||||
InstanceDelegate(QObject* parent = 0, int iconSize = 48, bool isGrid = false);
|
InstanceDelegate(QObject* parent = 0, int iconSize = 48, bool isGrid = false);
|
||||||
|
|
||||||
void initStyleOption(QStyleOptionViewItem* option, const QModelIndex& index) const override;
|
void initStyleOption(QStyleOptionViewItem* option, const QModelIndex& index) const override;
|
||||||
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_iconSize;
|
int m_iconSize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user