mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 05:43:32 -07:00
Don't shrink transferlist rows when scrolling horizontally. Closes #1613.
This commit is contained in:
parent
2cf8b86dad
commit
8659fec3f2
1 changed files with 20 additions and 0 deletions
|
@ -201,6 +201,26 @@ public:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reimplementing sizeHint() because the 'name' column contains text+icon.
|
||||||
|
// When that WHOLE column goes out of view(eg user scrolls horizontally)
|
||||||
|
// the rows shrink if the text's height is smaller than the icon's height.
|
||||||
|
// This happens because icon from the 'name' column is no longer drawn.
|
||||||
|
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const {
|
||||||
|
QSize size = QItemDelegate::sizeHint(option, index);
|
||||||
|
|
||||||
|
static int icon_height = -1;
|
||||||
|
if (icon_height == -1) {
|
||||||
|
QIcon icon(":/Icons/skin/downloading.png");
|
||||||
|
QList<QSize> ic_sizes(icon.availableSizes());
|
||||||
|
icon_height = ic_sizes[0].height();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size.height() < icon_height)
|
||||||
|
size.setHeight(icon_height);
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TRANSFERLISTDELEGATE_H
|
#endif // TRANSFERLISTDELEGATE_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue