1

QML: Add WIP example extension for QML Windows

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2022-04-15 13:54:11 +02:00
parent 14b9de4016
commit 0a22091f19
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B
2 changed files with 120 additions and 0 deletions

View File

@ -0,0 +1,109 @@
import org.kde.falkon 1.0 as Falkon
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.0
import QtQuick 2.3
Falkon.PluginInterface {
QtObject {
id: objectTutorial9
property ListModel windows: ListModel {}
}
init: function(state, settingsPath) {
console.log(i18n('"Tutorial9" plugin loaded'))
Falkon.Windows.created.connect(function(window) {
objectTutorial9.windows.append({
"id": window.id.toString()
})
})
console.log(Falkon.PluginInterface.LateInitState)
if (state == 1) {
var windowsAll = Falkon.Windows.getAll()
console.log("Creating windows")
for (var i = 0; i < windowsAll.length; ++i) {
objectTutorial9.windows.append({
"id": windowsAll[i].id.toString()
})
}
}
}
testPlugin: function() {
return true
}
unload: function() {
console.log(i18n('"Tutorial9" plugin unloaded'))
}
Falkon.SideBar {
name: 'qml-tutorial9-sidebar'
title: i18n('Tutorial 9 - QML SideBar')
icon: 'falkon'
checkable: true
shortcut: 'Ctrl+Shift+Alt+W'
Rectangle {
ScrollView {
id: scroll_windows
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: button_add.top
ScrollBar.horizontal.policy: ScrollBar.AlwaysOn
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
ListView {
Component {
id: contactsDelegate
ColumnLayout {
id: wrapper
spacing: 2
CheckBox {
id: checkSelected
text: "Window " + id
}
}
}
model: objectTutorial9.windows
delegate: contactsDelegate
focus: true
}
}
Button {
id: button_add
text: i18n('Add Window')
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: button_remove.top
onClicked: function() {
;
}
}
Button {
id: button_remove
text: i18n('Remove Selected Windows')
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
onClicked: function() {
;
}
}
}
}
}

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=Tutorial9 QML
Comment=Example QML extension with windows example is sidebar
Icon=
Type=Service
X-Falkon-Type=Extension/Qml
X-Falkon-Author=Juraj Oravec
X-Falkon-Email=jurajoravec@mailo.com
X-Falkon-Version=1.0.0
X-Falkon-Settings=false