From kde-commits Fri Oct 03 00:26:55 2008 From: =?utf-8?q?Rafael=20Fern=C3=A1ndez=20L=C3=B3pez?= Date: Fri, 03 Oct 2008 00:26:55 +0000 To: kde-commits Subject: KDE/kdelibs/kfile Message-Id: <1222993615.543806.24972.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=122299362403571 SVN commit 867177 by ereslibre: Update grid size only when the text is on top M +17 -6 kdiroperator.cpp --- trunk/KDE/kdelibs/kfile/kdiroperator.cpp #867176:867177 @@ -2363,23 +2363,34 @@ if (leftChecked) { decorationPosition = QStyleOptionViewItem::Left; view->setFlow(QListView::TopToBottom); - view->setGridSize(QSize()); } else { decorationPosition = QStyleOptionViewItem::Top; view->setFlow(QListView::LeftToRight); - updateListViewGrid(); } + updateListViewGrid(); + itemView->update(); } void KDirOperator::Private::updateListViewGrid() { + if (!itemView) { + return; + } + QListView *view = static_cast(itemView); - const QFontMetrics metrics(itemView->viewport()->font()); - int size = itemView->iconSize().height() + metrics.height() * 2; - // some heuristics for good looking. let's guess width = height * (3 / 2) is nice - view->setGridSize(QSize(size * (3.0 / 2.0), size)); + + const bool leftChecked = actionCollection->action("decorationAtLeft")->isChecked(); + + if (leftChecked) { + view->setGridSize(QSize()); + } else { + const QFontMetrics metrics(itemView->viewport()->font()); + int size = itemView->iconSize().height() + metrics.height() * 2; + // some heuristics for good looking. let's guess width = height * (3 / 2) is nice + view->setGridSize(QSize(size * (3.0 / 2.0), size)); + } } void KDirOperator::setViewConfig(KConfigGroup& configGroup)