diff --git a/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryUserView.qml b/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryUserView.qml
index 6b34d44bebe..8269589ffe3 100644
--- a/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryUserView.qml
+++ b/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryUserView.qml
@@ -104,6 +104,7 @@ Item {
bottomPadding: StudioTheme.Values.sectionPadding
caption: categoryTitle
+ dropEnabled: true
category: "ContentLib_User"
function expandSection() {
@@ -114,6 +115,24 @@ Item {
onCountChanged: root.assignMaxCount()
+ onDropEnter: (drag) => {
+ drag.accepted = categoryTitle === "Textures"
+ && drag.formats[0] === "application/vnd.qtdesignstudio.assets"
+
+ section.highlight = drag.accepted
+ }
+
+ onDropExit: {
+ section.highlight = false
+ }
+
+ onDrop: (drag) => {
+ section.highlight = false
+ ContentLibraryBackend.rootView.acceptTexturesDrop(drag.urls)
+ drag.accept()
+ section.expandSection()
+ }
+
Grid {
width: section.width - section.leftPadding - section.rightPadding
spacing: StudioTheme.Values.sectionGridSpacing
@@ -182,7 +201,7 @@ Item {
qsTr("Content Library is not supported in Qt5 projects.")
else if (!ContentLibraryBackend.rootView.hasQuick3DImport && categoryTitle !== "Textures")
qsTr("To use " + categoryName + ", first add the QtQuick3D module in the Components view.")
- else if (!ContentLibraryBackend.rootView.hasMaterialLibrary)
+ else if (!ContentLibraryBackend.rootView.hasMaterialLibrary && categoryTitle !== "Textures")
qsTr("Content Library is disabled inside a non-visual component.")
else if (categoryEmpty)
qsTr("There are no "+ categoryName + " in the User Assets.")
diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibraryview.cpp b/src/plugins/qmldesigner/components/contentlibrary/contentlibraryview.cpp
index 25069854698..2f8d5e4e6cb 100644
--- a/src/plugins/qmldesigner/components/contentlibrary/contentlibraryview.cpp
+++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibraryview.cpp
@@ -87,6 +87,19 @@ WidgetInfo ContentLibraryView::widgetInfo()
m_draggedBundleItem = item;
});
+ connect(m_widget, &ContentLibraryWidget::acceptTexturesDrop, this,
+ [this](const QList &urls) {
+ QStringList paths;
+
+ for (const QUrl &url : urls) {
+ QString path = url.toLocalFile();
+
+ if (Asset(path).isImage())
+ paths.append(path);
+ }
+ addLibAssets(paths);
+ });
+
connect(m_widget,
&ContentLibraryWidget::addTextureRequested,
this,
diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarywidget.h b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarywidget.h
index ca380fe57e5..cfcff404db7 100644
--- a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarywidget.h
+++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarywidget.h
@@ -124,6 +124,7 @@ signals:
void hasModelSelectionChanged();
void importBundle();
void requestTab(int tabIndex);
+ void acceptTexturesDrop(const QList &urls);
protected:
bool eventFilter(QObject *obj, QEvent *event) override;