internal: fix null errors

This commit is contained in:
2 * r + 2 * t 2025-05-24 13:47:45 +08:00
parent 72101f4e86
commit 4ca23da8e1
5 changed files with 14 additions and 15 deletions

View file

@ -11,14 +11,14 @@ Item {
implicitHeight: LauncherConfig.sizes.itemHeight
anchors.left: parent.left
anchors.right: parent.right
anchors.left: parent?.left
anchors.right: parent?.right
StateLayer {
radius: Appearance.rounding.full
function onClicked(): void {
root.modelData.onClicked(root.list);
root.modelData?.onClicked(root.list);
}
}
@ -31,7 +31,7 @@ Item {
MaterialIcon {
id: icon
text: root.modelData.icon
text: root.modelData?.icon ?? ""
font.pointSize: Appearance.font.size.extraLarge
anchors.verticalCenter: parent.verticalCenter
@ -48,12 +48,12 @@ Item {
StyledText {
id: name
text: root.modelData.name
text: root.modelData?.name ?? ""
font.pointSize: Appearance.font.size.normal
}
StyledText {
text: root.modelData.desc
text: root.modelData?.desc ?? ""
font.pointSize: Appearance.font.size.small
color: Colours.alpha(Colours.palette.m3outline, true)

View file

@ -13,8 +13,8 @@ Item {
implicitHeight: LauncherConfig.sizes.itemHeight
anchors.left: parent.left
anchors.right: parent.right
anchors.left: parent?.left
anchors.right: parent?.right
StateLayer {
radius: Appearance.rounding.full
@ -34,7 +34,7 @@ Item {
IconImage {
id: icon
source: Quickshell.iconPath(root.modelData.icon, "image-missing")
source: Quickshell.iconPath(root.modelData?.icon, "image-missing")
implicitSize: parent.height * 0.8
anchors.verticalCenter: parent.verticalCenter
@ -51,12 +51,12 @@ Item {
StyledText {
id: name
text: root.modelData.name
text: root.modelData?.name ?? ""
font.pointSize: Appearance.font.size.normal
}
StyledText {
text: root.modelData.comment || root.modelData.genericName || root.modelData.name
text: (root.modelData?.comment || root.modelData?.genericName || root.modelData?.name) ?? ""
font.pointSize: Appearance.font.size.small
color: Colours.alpha(Colours.palette.m3outline, true)

View file

@ -124,8 +124,8 @@ Item {
Item {
id: empty
opacity: root.currentList.count === 0 ? 1 : 0
scale: root.currentList.count === 0 ? 1 : 0.5
opacity: root.currentList?.count === 0 ? 1 : 0
scale: root.currentList?.count === 0 ? 1 : 0.5
implicitWidth: icon.width + text.width + Appearance.spacing.small
implicitHeight: icon.height

View file

@ -13,7 +13,7 @@ StyledRect {
scale: 0.5
opacity: 0
z: PathView.z
z: PathView.z ?? 0
Component.onCompleted: {
scale = Qt.binding(() => PathView.isCurrentItem ? 1 : PathView.onPath ? 0.8 : 0);

View file

@ -51,7 +51,6 @@ PathView {
preferredHighlightBegin: 0.5
preferredHighlightEnd: 0.5
highlightRangeMode: PathView.StrictlyEnforceRange
highlightMoveDuration: Appearance.anim.durations.short
delegate: WallpaperItem {
visibilities: root.visibilities