Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
5.0.2
-
None
-
All
Description
QFileSystemModel::dropMimeData(...) has no support for folders. Drag'n'Drop works for files only.
Code snippet:
bool QFileSystemModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) { Q_UNUSED(row); Q_UNUSED(column); if (!parent.isValid() || isReadOnly()) return false; bool success = true; QString to = filePath(parent) + QDir::separator(); QList<QUrl> urls = data->urls(); QList<QUrl>::const_iterator it = urls.constBegin(); switch (action) { case Qt::CopyAction: for (; it != urls.constEnd(); ++it) { QString path = (*it).toLocalFile(); success = QFile::copy(path, to + QFileInfo(path).fileName()) && success; } break; case Qt::LinkAction: for (; it != urls.constEnd(); ++it) { QString path = (*it).toLocalFile(); success = QFile::link(path, to + QFileInfo(path).fileName()) && success; } break; case Qt::MoveAction: for (; it != urls.constEnd(); ++it) { QString path = (*it).toLocalFile(); success = QFile::copy(path, to + QFileInfo(path).fileName()) && QFile::remove(path) && success; } break; default: return false; } return success; }
The suggestion is to add such functionality to API