mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
fix some drag & drop issues
svn path=/trunk/KDE/kdebase/apps/; revision=693766
This commit is contained in:
parent
14783157ba
commit
83e0633d35
1 changed files with 16 additions and 19 deletions
|
@ -165,23 +165,24 @@ void ColumnWidget::updateSelection(const KUrl& url)
|
|||
setSelectionMode(SingleSelection);
|
||||
QItemSelectionModel* selModel = selectionModel();
|
||||
if (url.isEmpty()) {
|
||||
selModel->clear();
|
||||
return;
|
||||
}
|
||||
if (!m_active) {
|
||||
selModel->clear();
|
||||
}
|
||||
} else {
|
||||
const QAbstractProxyModel* proxyModel = static_cast<const QAbstractProxyModel*>(m_view->model());
|
||||
const KDirModel* dirModel = static_cast<const KDirModel*>(proxyModel->sourceModel());
|
||||
const QModelIndex dirIndex = dirModel->indexForUrl(url);
|
||||
const QModelIndex proxyIndex = proxyModel->mapFromSource(dirIndex);
|
||||
|
||||
const QAbstractProxyModel* proxyModel = static_cast<const QAbstractProxyModel*>(m_view->model());
|
||||
const KDirModel* dirModel = static_cast<const KDirModel*>(proxyModel->sourceModel());
|
||||
const QModelIndex dirIndex = dirModel->indexForUrl(url);
|
||||
const QModelIndex proxyIndex = proxyModel->mapFromSource(dirIndex);
|
||||
const QItemSelection selection = selModel->selection();
|
||||
const bool isIndexSelected = selModel->isSelected(proxyIndex);
|
||||
|
||||
const QItemSelection selection = selModel->selection();
|
||||
const bool isIndexSelected = selModel->isSelected(proxyIndex);
|
||||
|
||||
if (!m_active && ((selection.count() > 1) || !isIndexSelected)) {
|
||||
selModel->clear();
|
||||
}
|
||||
if (!isIndexSelected) {
|
||||
selModel->select(proxyIndex, QItemSelectionModel::Select);
|
||||
if (!m_active && ((selection.count() > 1) || !isIndexSelected)) {
|
||||
selModel->clear();
|
||||
}
|
||||
if (!isIndexSelected) {
|
||||
selModel->select(proxyIndex, QItemSelectionModel::Select);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,10 +235,6 @@ void ColumnWidget::dropEvent(QDropEvent* event)
|
|||
|
||||
void ColumnWidget::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (m_active) {
|
||||
selectionModel()->clear();
|
||||
}
|
||||
|
||||
QListView::mousePressEvent(event);
|
||||
|
||||
const QModelIndex index = indexAt(event->pos());
|
||||
|
|
Loading…
Reference in a new issue