fix(libappdata): 添加最近安装蓝点

This commit is contained in:
youdiansaodongxi 2024-05-11 15:49:56 +08:00
parent ee7fc97053
commit b639b318ce
3 changed files with 25 additions and 6 deletions

View File

@ -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,19 +52,32 @@ 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
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()
}
}
}
}
}

View File

@ -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

View File

@ -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);
}