From 95c8949b23b2ffec17448baa656a648998196f4e Mon Sep 17 00:00:00 2001
From: Lukas Holecek <hluk@email.cz>
Date: Sat, 25 Apr 2020 13:56:46 +0200
Subject: [PATCH] Avoid showing horizontal scrollbar if visible items fit
Signed-off-by: Lukas Holecek <hluk@email.cz>
---
src/item/itemdelegate.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/item/itemdelegate.cpp b/src/item/itemdelegate.cpp
index 2f35d3a92..88447b935 100644
--- a/src/item/itemdelegate.cpp
+++ b/src/item/itemdelegate.cpp
@@ -66,8 +66,8 @@ QSize ItemDelegate::sizeHint(const QModelIndex &index) const
QWidget *ww = w->widget();
const auto margins = m_sharedData->theme.margins();
const auto rowNumberSize = m_sharedData->theme.rowNumberSize();
- return QSize( ww->width() + 2 * margins.width() + rowNumberSize.width(),
- qMax(ww->height() + 2 * margins.height(), rowNumberSize.height()) );
+ const int width = ww->isVisible() ? ww->width() + 2 * margins.width() + rowNumberSize.width() : 0;
+ return QSize( width, qMax(ww->height() + 2 * margins.height(), rowNumberSize.height()) );
}
}
return QSize(0, 100);
--
GitLab