diff --git a/src/item/itemdelegate.cpp b/src/item/itemdelegate.cpp
index 2f35d3a92c7c416ec30cc354ff5e047fb71137f5..88447b93548663b2d8a24fc56f40b685917cd666 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);