From 6cb7de33f682a6554999199d35f98e6221e8a32f Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Fri, 8 Aug 2014 23:32:54 +0300 Subject: [PATCH] Don't shrink transferlist rows when scrolling horizontally. Closes #1613. --- src/transferlistdelegate.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/transferlistdelegate.h b/src/transferlistdelegate.h index ecda9f644..e181a343f 100644 --- a/src/transferlistdelegate.h +++ b/src/transferlistdelegate.h @@ -210,6 +210,26 @@ public: 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 ic_sizes(icon.availableSizes()); + icon_height = ic_sizes[0].height(); + } + + if (size.height() < icon_height) + size.setHeight(icon_height); + + return size; + } + }; #endif // TRANSFERLISTDELEGATE_H