forked from qt-creator/qt-creator
QmlDesigner: Add drag support to empty asset library placeholder item
Fixes: QDS-6430 Change-Id: I561f4ed51ccb1e47472adb9baa6e5594eb93eafb Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -469,6 +469,17 @@ Item {
|
||||
visible: assetsModel.isEmpty && searchBox.isEmpty()
|
||||
clip: true
|
||||
|
||||
DropArea { // handles external drop (goes into default folder based on suffix)
|
||||
anchors.fill: parent
|
||||
|
||||
onEntered: (drag)=> {
|
||||
root.updateDropExtFiles(drag)
|
||||
}
|
||||
|
||||
onDropped: {
|
||||
rootView.handleExtFilesDrop(root.dropSimpleExtFiles, root.dropComplexExtFiles)
|
||||
}
|
||||
|
||||
Column {
|
||||
id: colNoAssets
|
||||
|
||||
@@ -515,6 +526,7 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView { // TODO: experiment using ListView instead of ScrollView + Column
|
||||
id: assetsView
|
||||
|
@@ -218,13 +218,18 @@ void AssetsLibraryWidget::handleExtFilesDrop(const QStringList &simpleFilesPaths
|
||||
const QString &targetDirPath)
|
||||
{
|
||||
if (!simpleFilesPaths.isEmpty()) {
|
||||
AddFilesResult result = ModelNodeOperations::addFilesToProject(simpleFilesPaths, targetDirPath);
|
||||
if (targetDirPath.isEmpty()) {
|
||||
addResources(simpleFilesPaths);
|
||||
} else {
|
||||
AddFilesResult result = ModelNodeOperations::addFilesToProject(simpleFilesPaths,
|
||||
targetDirPath);
|
||||
if (result == AddFilesResult::Failed) {
|
||||
Core::AsynchronousMessageBox::warning(tr("Failed to Add Files"),
|
||||
tr("Could not add %1 to project.")
|
||||
.arg(simpleFilesPaths.join(' ')));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!complexFilesPaths.empty())
|
||||
addResources(complexFilesPaths);
|
||||
|
@@ -82,7 +82,7 @@ public:
|
||||
Q_INVOKABLE void handleSearchfilterChanged(const QString &filterText);
|
||||
Q_INVOKABLE void handleExtFilesDrop(const QStringList &simpleFilesPaths,
|
||||
const QStringList &complexFilesPaths,
|
||||
const QString &targetDirPath);
|
||||
const QString &targetDirPath = {});
|
||||
Q_INVOKABLE QSet<QString> supportedAssetSuffixes(bool complex);
|
||||
|
||||
signals:
|
||||
|
Reference in New Issue
Block a user