From b639b318ce264927e8586ca464ce4bf5985d1caf Mon Sep 17 00:00:00 2001 From: youdiansaodongxi Date: Sat, 11 May 2024 15:49:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(libappdata):=20=E6=B7=BB=E5=8A=A0=E6=9C=80?= =?UTF-8?q?=E8=BF=91=E5=AE=89=E8=A3=85=E8=93=9D=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qml/AppControls2/AppItem.qml | 26 ++++++++++++++++----- qml/AppUI/AppList.qml | 1 + src/libappdata/recently-installed-model.cpp | 4 ++++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/qml/AppControls2/AppItem.qml b/qml/AppControls2/AppItem.qml index 0058130..2e14b09 100644 --- a/qml/AppControls2/AppItem.qml +++ b/qml/AppControls2/AppItem.qml @@ -9,6 +9,7 @@ import org.ukui.quick.items 1.0 as UkuiItems MouseArea { id: control property bool isSelect: false + property bool isRecentInstalled: false hoverEnabled: true states: State { when: control.activeFocus @@ -51,17 +52,30 @@ MouseArea { spacing: 12 } - Extension.EditModeFlag { + Item { Layout.alignment: Qt.AlignRight | Qt.AlignVCenter Layout.fillWidth: true Layout.fillHeight: true - Layout.maximumWidth: visible ? 28 : 0 + Layout.maximumWidth: tagLabel.visible ? 28 : isRecentInstalled ? 8 : 0 Layout.maximumHeight: width - Layout.rightMargin: visible ? 4 : 0 + Layout.rightMargin: tagLabel.visible ? 4 : 0 - isFavorited: favorite - onClicked: { - appManager.changeFavoriteState(id, !isFavorited); + Extension.EditModeFlag { + id: tagLabel + anchors.fill: parent + isFavorited: favorite + onClicked: { + appManager.changeFavoriteState(id, !isFavorited); + } + } + + Rectangle { + id: tagPoint + visible: tagLabel.sourceComponent != null ? false : isRecentInstalled + anchors.centerIn: parent + width: 8; height: width + radius: width / 2 + color: Platform.Theme.highlight() } } } diff --git a/qml/AppUI/AppList.qml b/qml/AppUI/AppList.qml index e6ca705..ccb5813 100644 --- a/qml/AppUI/AppList.qml +++ b/qml/AppUI/AppList.qml @@ -61,6 +61,7 @@ AppListView { height: appListView.itemHeight anchors.centerIn: parent acceptedButtons: Qt.LeftButton | Qt.RightButton + isRecentInstalled: model.recentInstall Drag.hotSpot.x: 48 / 2 Drag.hotSpot.y: 48 / 2 diff --git a/src/libappdata/recently-installed-model.cpp b/src/libappdata/recently-installed-model.cpp index 240c374..006fbb8 100644 --- a/src/libappdata/recently-installed-model.cpp +++ b/src/libappdata/recently-installed-model.cpp @@ -97,6 +97,10 @@ QVariant RecentlyInstalledModel::data(const QModelIndex &index, int role) const return tr("Recently Installed"); } + if (role == DataEntity::RecentInstall) { + return true; + } + return QSortFilterProxyModel::data(index, role); }