// case QTreeView does no selection at all, which is not the wanted behavior
// in Dolphin -> select all items within the elastic band rectangle
clearSelection();
- if (mousePos.x() < header()->sectionSize(DolphinModel::Name)) {
- setSelection(QRect(m_elasticBandOrigin, m_elasticBandDestination),
- QItemSelectionModel::Select);
- }
+
+ const int nameColumnWidth = header()->sectionSize(DolphinModel::Name);
+ QRect selRect = QRect(m_elasticBandOrigin, m_elasticBandDestination).normalized();
+ const QRect nameColumnsRect(0, 0, nameColumnWidth, viewport()->height());
+ selRect = nameColumnsRect.intersected(selRect);
+
+ setSelection(selRect, QItemSelectionModel::Select);
}
QTreeView::mouseMoveEvent(event);
}
setDirtyRegion(m_dropRect);
}
+
+ if (event->mimeData()->hasUrls()) {
+ // accept url drops, independently from the destination item
+ event->acceptProposedAction();
+ }
}
void DolphinDetailsView::dropEvent(QDropEvent* event)
// TODO: remove this code when the issue #160611 is solved in Qt 4.4
if (m_dragging) {
const QBrush& brush = viewOptions().palette.brush(QPalette::Normal, QPalette::Highlight);
- DragAndDropHelper::drawHoverIndication(viewport(), m_dropRect, brush);
+ DragAndDropHelper::drawHoverIndication(this, m_dropRect, brush);
}
}
void DolphinDetailsView::updateElasticBand()
{
- Q_ASSERT(m_showElasticBand);
- QRect dirtyRegion(elasticBandRect());
- m_elasticBandDestination = viewport()->mapFromGlobal(QCursor::pos());
- dirtyRegion = dirtyRegion.united(elasticBandRect());
- setDirtyRegion(dirtyRegion);
+ if (m_showElasticBand) {
+ QRect dirtyRegion(elasticBandRect());
+ m_elasticBandDestination = viewport()->mapFromGlobal(QCursor::pos());
+ dirtyRegion = dirtyRegion.united(elasticBandRect());
+ setDirtyRegion(dirtyRegion);
+ }
}
QRect DolphinDetailsView::elasticBandRect() const