chore: fix components missing-property warnings
This commit is contained in:
parent
3e52aa5fb3
commit
022d509f99
5 changed files with 87 additions and 81 deletions
|
|
@ -8,7 +8,8 @@ MouseArea {
|
||||||
property bool disabled
|
property bool disabled
|
||||||
property bool showHoverBackground: true
|
property bool showHoverBackground: true
|
||||||
property color color: Colours.palette.m3onSurface
|
property color color: Colours.palette.m3onSurface
|
||||||
property real radius: parent?.radius ?? 0
|
// Pick up radius from parent if it has one (parent can be anything with a radius property)
|
||||||
|
property real radius: parent?.radius ?? 0 // qmllint disable missing-property
|
||||||
property alias rect: hoverLayer
|
property alias rect: hoverLayer
|
||||||
|
|
||||||
function onClicked(): void {
|
function onClicked(): void {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import ".."
|
import qs.components
|
||||||
import qs.services
|
import qs.services
|
||||||
import qs.config
|
import qs.config
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import ".."
|
import qs.components
|
||||||
import "../controls"
|
import qs.components.filedialog
|
||||||
import "../images"
|
import qs.components.controls
|
||||||
|
import qs.components.images
|
||||||
import qs.services
|
import qs.services
|
||||||
import qs.config
|
import qs.config
|
||||||
import qs.utils
|
import qs.utils
|
||||||
|
|
@ -16,7 +17,7 @@ Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property var dialog
|
required property var dialog
|
||||||
property alias currentItem: view.currentItem
|
readonly property FileEntry currentItem: view.currentItem as FileEntry
|
||||||
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
@ -91,11 +92,11 @@ Item {
|
||||||
|
|
||||||
Keys.onReturnPressed: {
|
Keys.onReturnPressed: {
|
||||||
if (root.dialog.selectionValid)
|
if (root.dialog.selectionValid)
|
||||||
root.dialog.accepted(currentItem.modelData.path);
|
root.dialog.accepted((currentItem as FileEntry).modelData.path);
|
||||||
}
|
}
|
||||||
Keys.onEnterPressed: {
|
Keys.onEnterPressed: {
|
||||||
if (root.dialog.selectionValid)
|
if (root.dialog.selectionValid)
|
||||||
root.dialog.accepted(currentItem.modelData.path);
|
root.dialog.accepted((currentItem as FileEntry).modelData.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledScrollBar.vertical: StyledScrollBar {
|
StyledScrollBar.vertical: StyledScrollBar {
|
||||||
|
|
@ -112,77 +113,7 @@ Item {
|
||||||
onPathChanged: view.currentIndex = -1
|
onPathChanged: view.currentIndex = -1
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: StyledRect {
|
delegate: FileEntry {}
|
||||||
id: item
|
|
||||||
|
|
||||||
required property int index
|
|
||||||
required property FileSystemEntry modelData
|
|
||||||
|
|
||||||
readonly property real nonAnimHeight: icon.implicitHeight + name.anchors.topMargin + name.implicitHeight + Appearance.padding.normal * 2
|
|
||||||
|
|
||||||
implicitWidth: Sizes.itemWidth
|
|
||||||
implicitHeight: nonAnimHeight
|
|
||||||
|
|
||||||
radius: Appearance.rounding.normal
|
|
||||||
color: Qt.alpha(Colours.tPalette.m3surfaceContainerHighest, GridView.isCurrentItem ? Colours.tPalette.m3surfaceContainerHighest.a : 0)
|
|
||||||
z: GridView.isCurrentItem || implicitHeight !== nonAnimHeight ? 1 : 0
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
StateLayer {
|
|
||||||
function onClicked(): void {
|
|
||||||
view.currentIndex = item.index;
|
|
||||||
}
|
|
||||||
|
|
||||||
onDoubleClicked: {
|
|
||||||
if (item.modelData.isDir)
|
|
||||||
root.dialog.cwd.push(item.modelData.name);
|
|
||||||
else if (root.dialog.selectionValid)
|
|
||||||
root.dialog.accepted(item.modelData.path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CachingIconImage {
|
|
||||||
id: icon
|
|
||||||
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.topMargin: Appearance.padding.normal
|
|
||||||
|
|
||||||
implicitSize: Sizes.itemWidth - Appearance.padding.normal * 2
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
const file = item.modelData;
|
|
||||||
if (file.isImage)
|
|
||||||
source = Qt.resolvedUrl(file.path);
|
|
||||||
else if (!file.isDir)
|
|
||||||
source = Quickshell.iconPath(file.mimeType.replace("/", "-"), "application-x-zerosize");
|
|
||||||
else if (root.dialog.cwd.length === 1 && ["Desktop", "Documents", "Downloads", "Music", "Pictures", "Public", "Templates", "Videos"].includes(file.name))
|
|
||||||
source = Quickshell.iconPath(`folder-${file.name.toLowerCase()}`);
|
|
||||||
else
|
|
||||||
source = Quickshell.iconPath("inode-directory");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
id: name
|
|
||||||
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: icon.bottom
|
|
||||||
anchors.topMargin: Appearance.spacing.small
|
|
||||||
anchors.margins: Appearance.padding.normal
|
|
||||||
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
elide: item.GridView.isCurrentItem ? Text.ElideNone : Text.ElideRight
|
|
||||||
wrapMode: item.GridView.isCurrentItem ? Text.WrapAtWordBoundaryOrAnywhere : Text.NoWrap
|
|
||||||
|
|
||||||
Component.onCompleted: text = item.modelData.name
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on implicitHeight {
|
|
||||||
Anim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
add: Transition {
|
add: Transition {
|
||||||
Anim {
|
Anim {
|
||||||
|
|
@ -226,4 +157,76 @@ Item {
|
||||||
|
|
||||||
currentItem: view.currentItem
|
currentItem: view.currentItem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
component FileEntry: StyledRect {
|
||||||
|
id: item
|
||||||
|
|
||||||
|
required property int index
|
||||||
|
required property FileSystemEntry modelData
|
||||||
|
|
||||||
|
readonly property real nonAnimHeight: icon.implicitHeight + name.anchors.topMargin + name.implicitHeight + Appearance.padding.normal * 2
|
||||||
|
|
||||||
|
implicitWidth: Sizes.itemWidth
|
||||||
|
implicitHeight: nonAnimHeight
|
||||||
|
|
||||||
|
radius: Appearance.rounding.normal
|
||||||
|
color: Qt.alpha(Colours.tPalette.m3surfaceContainerHighest, GridView.isCurrentItem ? Colours.tPalette.m3surfaceContainerHighest.a : 0)
|
||||||
|
z: GridView.isCurrentItem || implicitHeight !== nonAnimHeight ? 1 : 0
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
StateLayer {
|
||||||
|
function onClicked(): void {
|
||||||
|
view.currentIndex = item.index;
|
||||||
|
}
|
||||||
|
|
||||||
|
onDoubleClicked: {
|
||||||
|
if (item.modelData.isDir)
|
||||||
|
root.dialog.cwd.push(item.modelData.name);
|
||||||
|
else if (root.dialog.selectionValid)
|
||||||
|
root.dialog.accepted(item.modelData.path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CachingIconImage {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: Appearance.padding.normal
|
||||||
|
|
||||||
|
implicitSize: Sizes.itemWidth - Appearance.padding.normal * 2
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
const file = item.modelData;
|
||||||
|
if (file.isImage)
|
||||||
|
source = Qt.resolvedUrl(file.path);
|
||||||
|
else if (!file.isDir)
|
||||||
|
source = Quickshell.iconPath(file.mimeType.replace("/", "-"), "application-x-zerosize");
|
||||||
|
else if (root.dialog.cwd.length === 1 && ["Desktop", "Documents", "Downloads", "Music", "Pictures", "Public", "Templates", "Videos"].includes(file.name))
|
||||||
|
source = Quickshell.iconPath(`folder-${file.name.toLowerCase()}`);
|
||||||
|
else
|
||||||
|
source = Quickshell.iconPath("inode-directory");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: name
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: icon.bottom
|
||||||
|
anchors.topMargin: Appearance.spacing.small
|
||||||
|
anchors.margins: Appearance.padding.normal
|
||||||
|
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
elide: item.GridView.isCurrentItem ? Text.ElideNone : Text.ElideRight
|
||||||
|
wrapMode: item.GridView.isCurrentItem ? Text.WrapAtWordBoundaryOrAnywhere : Text.NoWrap
|
||||||
|
|
||||||
|
Component.onCompleted: text = item.modelData.name
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on implicitHeight {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import ".."
|
import qs.components
|
||||||
|
import qs.components.filedialog
|
||||||
import qs.services
|
import qs.services
|
||||||
import qs.config
|
import qs.config
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@ import QtQuick
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property int status: loader.item?.status ?? Image.Null
|
// Easier (and more efficient) to ignore it than to check type and cast
|
||||||
|
readonly property int status: loader.item?.status ?? Image.Null // qmllint disable missing-property
|
||||||
readonly property real actualSize: Math.min(width, height)
|
readonly property real actualSize: Math.min(width, height)
|
||||||
property real implicitSize
|
property real implicitSize
|
||||||
property url source
|
property url source
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue