diff options
| author | Peter Penz <[email protected]> | 2007-11-15 22:20:40 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-11-15 22:20:40 +0000 |
| commit | e8bc9f1072bfc43d7605315c8df69f37bfc71cc3 (patch) | |
| tree | d387e0341681cc64cb7d3fa077fd4b62e0cd74fa /src/dolphiniconsview.cpp | |
| parent | 8e1f288d3a15dd9a851b12853322422755cb9d2d (diff) | |
Bypass a layout issue in QListView::visualRect(), where the horizontal position of items might get calculated in a wrong manner when the item name is too long. I'll try create a patch for Qt but as Dolphin must also work with Qt 4.3.0 this workaround must get applied at least for KDE 4.0.
BUG: 152293
svn path=/trunk/KDE/kdebase/apps/; revision=737265
Diffstat (limited to 'src/dolphiniconsview.cpp')
| -rw-r--r-- | src/dolphiniconsview.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index eb3aa13c6..ed2593c97 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -22,9 +22,9 @@ #include "dolphincategorydrawer.h" #include "dolphincontroller.h" #include "dolphinsettings.h" - #include "dolphin_iconsmodesettings.h" +#include <kcategorizedsortfilterproxymodel.h> #include <kdialog.h> #include <kdirmodel.h> @@ -45,6 +45,7 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle setViewMode(QListView::IconMode); setResizeMode(QListView::Adjust); setSpacing(KDialog::spacingHint()); + setMovement(QListView::Snap); setMouseTracking(true); viewport()->setAttribute(Qt::WA_Hover); @@ -137,6 +138,20 @@ QRect DolphinIconsView::visualRect(const QModelIndex& index) const itemRect.setHeight(maxHeight); } + KCategorizedSortFilterProxyModel* proxyModel = dynamic_cast<KCategorizedSortFilterProxyModel*>(model()); + if (leftToRightFlow && !proxyModel->isCategorizedModel()) { + // TODO: This workaround bypasses a layout issue in QListView::visualRect(), where + // the horizontal position of items might get calculated in a wrong manner when the item + // name is too long. I'll try create a patch for Qt but as Dolphin must also work with + // Qt 4.3.0 this workaround must get applied at least for KDE 4.0. + const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); + const int margin = settings->gridSpacing() / 2; + const int gridWidth = gridSize().width(); + int left = itemRect.left(); + left = ((left - margin + 1) / gridWidth) * gridWidth + margin; + itemRect.moveLeft(left); + } + return itemRect; } |
