diff options
| author | Peter Penz <[email protected]> | 2008-03-29 19:40:26 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-03-29 19:40:26 +0000 |
| commit | ae7d038d33590fb24d89b876e8a266d97357299c (patch) | |
| tree | 7f0fa6a672cf3796a6e9931aad71954bc6557929 /src/dolphiniconsview.cpp | |
| parent | 7ee8ead0142802e0995674d314b1eb9589b15ae2 (diff) | |
QListView might return a wrong x-position if the decoration size decreases. I temporary bypassed this in Dolphin, as I'm not 100 % sure whether it is really a QListView issue or related to KFileItemDelegate. To reproduce this issue with Qt-only quite a lot effort is needed -> I'll wait until Qt4.4 final is released...
CCMAIL: [email protected]
svn path=/trunk/KDE/kdebase/apps/; revision=791535
Diffstat (limited to 'src/dolphiniconsview.cpp')
| -rw-r--r-- | src/dolphiniconsview.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index da1784c31..8178d062a 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -133,6 +133,25 @@ DolphinIconsView::~DolphinIconsView() m_categoryDrawer = 0; } +QRect DolphinIconsView::visualRect(const QModelIndex& index) const +{ + QRect itemRect = KCategorizedView::visualRect(index); + + KCategorizedSortFilterProxyModel* proxyModel = dynamic_cast<KCategorizedSortFilterProxyModel*>(model()); + if ((flow() == QListView::LeftToRight) && !proxyModel->isCategorizedModel()) { + // TODO: QListView might return a wrong x-position if the decoration size decreases. This is bypassed + // by the following workaround... + const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); + const int margin = settings->gridSpacing(); + const int gridWidth = gridSize().width(); + const int gridIndex = (itemRect.left() - margin + 1) / gridWidth; + const int centerInc = (m_itemSize.width() - itemRect.width()) / 2; + itemRect.moveLeft((gridIndex * gridWidth) + margin + centerInc); + } + + return itemRect; +} + QStyleOptionViewItem DolphinIconsView::viewOptions() const { QStyleOptionViewItem viewOptions = KCategorizedView::viewOptions(); |
