examples: linting

Mostly basic linting changes for the example apps – duplicate ids,
non-existing signal parameters, etc.
This commit is contained in:
Christoph Wolk committed 2025-12-18 13:48:09 +00:00
1 parent 3c8f659bc4
commit adb0935ff8
10 files changed
+24 -37

No files matched your search

+2 -6
View File
@@ -66,17 +66,13 @@ Kirigami.ScrollablePage {
text: "Previous"
icon.name: "go-previous-symbolic"
displayHint: Kirigami.DisplayHint.KeepVisible
onTriggered: source => {
root.previousIcon();
}
onTriggered: root.previousIcon();
},
Kirigami.Action {
text: "Next"
icon.name: "go-next-symbolic"
displayHint: Kirigami.DisplayHint.KeepVisible
onTriggered: source => {
root.nextIcon();
}
onTriggered: root.nextIcon();
}
]
}
+3 -7
View File
@@ -70,17 +70,13 @@ QQC2.Page {
icon.name: "shuffle-symbolic"
text: "Random Image"
displayHint: Kirigami.DisplayHint.KeepVisible
onTriggered: source => {
root.randomizeSource();
}
onTriggered: root.randomizeSource();
},
Kirigami.Action {
icon.name: "insert-image-symbolic"
text: "Open Image…"
displayHint: Kirigami.DisplayHint.KeepVisible
onTriggered: source => {
root.openChooserDialog();
}
onTriggered: root.openChooserDialog();
}
]
}
@@ -90,7 +86,7 @@ QQC2.Page {
id: fileDialog
title: "Open Image"
nameFilters: "Media Files (*.jpg *.png *.svg)"
nameFilters: ["Media Files (*.jpg *.png *.svg)"]
fileMode: QtDialogs.FileDialog.OpenFile
options: QtDialogs.FileDialog.ReadOnly
+1 -3
View File
@@ -29,9 +29,7 @@ Kirigami.ScrollablePage {
text: "Update Palette"
icon.name: "view-refresh-symbolic"
displayHint: Kirigami.DisplayHint.KeepVisible
onTriggered: source => {
root.imagePalette.update();
}
onTriggered: root.imagePalette.update();
}
]
}
@@ -156,7 +156,7 @@ Kirigami.ApplicationWindow {
icon.height: Kirigami.Units.iconSizes.large
}
delegate: QQC2.ItemDelegate {
id: delegate
id: listDelegate
required property string title
required property string description
@@ -172,11 +172,11 @@ Kirigami.ApplicationWindow {
spacing: Kirigami.Units.smallSpacing
KD.TitleSubtitle {
Layout.fillWidth: true
title: delegate.title
subtitle: delegate.description
title: listDelegate.title
subtitle: listDelegate.description
}
QQC2.Button {
text: delegate.buttonText
text: listDelegate.buttonText
onClicked: sheet.close()
}
}
+1 -1
View File
@@ -13,7 +13,7 @@ Kirigami.ApplicationWindow {
title: qsTr("Hello, World")
globalDrawer: Kirigami.GlobalDrawer {
isMenu: !Kirigami.isMobile
isMenu: !Kirigami.Settings.isMobile
actions: [
Kirigami.Action {
text: qsTr("Settings")
@@ -57,12 +57,12 @@ Kirigami.AbstractApplicationWindow {
icon.name: "configure"
checkable: true
//Need to do this, otherwise it breaks the bindings
property bool current: root.pageStack.currentItem?.objectName === "settingsPage" ?? false
property bool current: (root.pageStack as QQC2.StackView).currentItem?.objectName === "settingsPage" ?? false
onCurrentChanged: {
checked = current;
}
onTriggered: {
root.pageStack.push(settingsComponent);
(root.pageStack as QQC2.StackView).push(settingsComponent);
}
}
]
@@ -87,6 +87,7 @@ Kirigami.AbstractApplicationWindow {
}
pageStack: QQC2.StackView {
id: stackView
anchors.fill: parent
property int currentIndex: 0
focus: true
@@ -110,11 +111,11 @@ Kirigami.AbstractApplicationWindow {
root.globalDrawer.close();
} else {
var backEvent = {accepted: false}
if (root.pageStack.currentIndex >= 1) {
root.pageStack.currentItem.backRequested(backEvent);
if (stackView.currentIndex >= 1) {
(stackView.currentItem as Kirigami.Page).backRequested(backEvent);
if (!backEvent.accepted) {
if (root.pageStack.depth > 1) {
root.pageStack.currentIndex = Math.max(0, root.pageStack.currentIndex - 1);
if ((root.pageStack as QQC2.StackView).depth > 1) {
(root.pageStack as QQC2.StackView).currentIndex = Math.max(0, stackView.currentIndex - 1);
backEvent.accepted = true;
} else {
Qt.quit();
@@ -50,12 +50,12 @@ Kirigami.ScrollablePage {
QQC2.Button {
text: "Push Another Page"
Layout.alignment: Qt.AlignHCenter
onClicked: applicationWindow()?.pageStack.push(Qt.resolvedUrl("MultipleColumnsGallery.qml"));
onClicked: Kirigami.PageStack.push(Qt.resolvedUrl("MultipleColumnsGallery.qml"));
}
QQC2.Button {
text: "Pop A Page"
Layout.alignment: Qt.AlignHCenter
onClicked: applicationWindow()?.pageStack.pop();
onClicked: Kirigami.PageStack.pop();
}
RowLayout {
Layout.alignment: Qt.AlignHCenter
-2
View File
@@ -29,7 +29,6 @@ Kirigami.ApplicationWindow {
Layout.alignment: Qt.AlignHCenter
text: "This is a sidebar"
Layout.fillWidth: true
width: parent.width - Kirigami.Units.smallSpacing * 2
wrapMode: Text.WordWrap
}
QQC2.Button {
@@ -59,7 +58,6 @@ Kirigami.ApplicationWindow {
Layout.alignment: Qt.AlignHCenter
text: "This is a sidebar"
Layout.fillWidth: true
width: parent.width - Kirigami.Units.smallSpacing * 2
wrapMode: Text.WordWrap
}
QQC2.Button {
@@ -27,26 +27,26 @@ Kirigami.ApplicationWindow {
Component {
id: firstPage
Kirigami.ScrollablePage {
id: root
id: rootPage
title: i18n("Sidebar")
property list<Kirigami.PagePoolAction> pageActions: [
Kirigami.PagePoolAction {
text: i18n("Page1")
icon.name: "speedometer"
pagePool: mainPagePool
basePage: root
basePage: rootPage
page: "SimplePage.qml"
},
Kirigami.PagePoolAction {
text: i18n("Page2")
icon.name: "window-duplicate"
pagePool: mainPagePool
basePage: root
basePage: rootPage
page: "MultipleColumnsGallery.qml"
}
]
ListView {
model: root.pageActions
model: rootPage.pageActions
keyNavigationEnabled: true
activeFocusOnTab: true
reuseItems: true
@@ -127,12 +127,10 @@ Kirigami.ApplicationWindow {
QQC2.ItemDelegate {
text: "Group call"
icon.name: "call-start"
width: parent.width
}
QQC2.ItemDelegate {
text: "Send Attachment"
icon.name: "mail-attachment"
width: parent.width
}
}
}