X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/dcf7529688170e1ba00cf743d7420bb35d5af6ec..6861a876830e301878b65cb4e4574bfda4c73340:/src/iconmanager.cpp diff --git a/src/iconmanager.cpp b/src/iconmanager.cpp index 471e69842..97dac53b7 100644 --- a/src/iconmanager.cpp +++ b/src/iconmanager.cpp @@ -53,16 +53,18 @@ * QListView does not invoke QItemDelegate::sizeHint() when the * uniformItemSize property has been set to true, so this property is * set before exchanging a block of icons. It is important to reset - * it to false again before the event loop is entered, otherwise QListView + * it again before the event loop is entered, otherwise QListView * would not get the correct size hints after dispatching the layoutChanged() * signal. */ class LayoutBlocker { public: - LayoutBlocker(QAbstractItemView* view) : m_view(0) + LayoutBlocker(QAbstractItemView* view) : + m_uniformSizes(false), + m_view(qobject_cast(view)) { - if (view->inherits("QListView")) { - m_view = qobject_cast(view); + if (m_view != 0) { + m_uniformSizes = m_view->uniformItemSizes(); m_view->setUniformItemSizes(true); } } @@ -70,11 +72,12 @@ public: ~LayoutBlocker() { if (m_view != 0) { - m_view->setUniformItemSizes(false); + m_view->setUniformItemSizes(m_uniformSizes); } } private: + bool m_uniformSizes; QListView* m_view; };