From 786aa7f4d2038750d7e6c58b65e240b06b290044 Mon Sep 17 00:00:00 2001 From: Wang Zichong Date: Wed, 24 Jan 2024 11:08:08 +0800 Subject: [PATCH] chore: use DciIcon from dtkdeclarative MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用 DciIcon 来展示图标。 Log: --- qml/FullscreenFrame.qml | 6 +++--- qml/IconItemDelegate.qml | 8 ++++---- qml/WindowedFrame.qml | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/qml/FullscreenFrame.qml b/qml/FullscreenFrame.qml index 63078bed..fffc2167 100644 --- a/qml/FullscreenFrame.qml +++ b/qml/FullscreenFrame.qml @@ -303,7 +303,7 @@ Control { "text/x-dde-launcher-dnd-desktopId": model.desktopId } visible: dndItem.currentlyDraggedId !== model.desktopId - iconSource: "image://app-icon/" + DTK.platformTheme.iconThemeName + "/" + iconName + iconSource: iconName icons: folderIcons padding: 5 onItemClicked: { @@ -342,7 +342,7 @@ Control { id: delegateSearchResultModel model: SearchFilterProxyModel delegate: IconItemDelegate { - iconSource: "image://app-icon/" + DTK.platformTheme.iconThemeName + "/" + iconName + iconSource: iconName width: searchResultGridViewContainer.cellSize height: searchResultGridViewContainer.cellSize padding: 5 @@ -515,7 +515,7 @@ Control { "text/x-dde-launcher-dnd-desktopId": model.desktopId } visible: dndItem.currentlyDraggedId !== model.desktopId - iconSource: "image://app-icon/" + DTK.platformTheme.iconThemeName + "/" + iconName + iconSource: iconName padding: 5 onItemClicked: { diff --git a/qml/IconItemDelegate.qml b/qml/IconItemDelegate.qml index 1419c410..e6b9118d 100644 --- a/qml/IconItemDelegate.qml +++ b/qml/IconItemDelegate.qml @@ -92,10 +92,10 @@ Control { Component { id: imageComponent - Image { - id: iconImage + DciIcon { + objectName: "appIcon" anchors.fill: parent - source: iconSource + name: iconSource sourceSize: Qt.size(parent.width, parent.height) } } @@ -158,7 +158,7 @@ Control { // to that property here dndItem.currentlyDraggedId = parent.Drag.mimeData["text/x-dde-launcher-dnd-desktopId"] // TODO: This way we couldn't give it an image size hint, - dndItem.Drag.imageSource = icons ? ("image://folder-icon/" + icons.join(':')) : parent.iconSource + dndItem.Drag.imageSource = icons ? ("image://folder-icon/" + icons.join(':')) : ("image://app-icon/" + DTK.platformTheme.iconThemeName + "/" + parent.iconSource) Qt.callLater(function() { dndItem.Drag.mimeData = parent.Drag.mimeData dndItem.Drag.active = true diff --git a/qml/WindowedFrame.qml b/qml/WindowedFrame.qml index 8a174f96..b74d23fd 100644 --- a/qml/WindowedFrame.qml +++ b/qml/WindowedFrame.qml @@ -161,7 +161,7 @@ StackView { id: delegateFavorateModel model: FavoritedProxyModel delegate: IconItemDelegate { - iconSource: "image://app-icon/" + DTK.platformTheme.iconThemeName + "/" + iconName + iconSource: iconName width: favoriteGridViewContainer.cellSize height: favoriteGridViewContainer.cellSize onItemClicked: { @@ -198,7 +198,7 @@ StackView { id: delegateAllAppsModel model: SearchFilterProxyModel delegate: IconItemDelegate { - iconSource: "image://app-icon/" + DTK.platformTheme.iconThemeName + "/" + iconName + iconSource: iconName width: allAppsGridContainer.cellSize height: allAppsGridContainer.cellSize onItemClicked: {