setSpacing(KDialog::spacingHint());
setMovement(QListView::Static);
setDragEnabled(true);
+ setEditTriggers(QAbstractItemView::NoEditTriggers);
viewport()->setAcceptDrops(true);
setMouseTracking(true);
m_categoryDrawer = 0;
}
-QRect DolphinIconsView::visualRect(const QModelIndex& index) const
+void DolphinIconsView::dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight)
{
- QRect itemRect = KCategorizedView::visualRect(index);
+ KCategorizedView::dataChanged(topLeft, bottomRight);
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);
+ // bypass a QListView issue that items are not layout correctly if the decoration size of
+ // an index changes
+ scheduleDelayedItemsLayout();
}
-
- return itemRect;
}
QStyleOptionViewItem DolphinIconsView::viewOptions() const