From 581e3efb9e8bdd2d471c9202708bc28c5286adbc Mon Sep 17 00:00:00 2001 From: Anmol Gautam Date: Sat, 16 Jun 2018 18:32:11 +0530 Subject: [PATCH] Added GUI in HelloQML Plugin --- src/scripts/helloqml/helloqml.qml | 71 ++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/src/scripts/helloqml/helloqml.qml b/src/scripts/helloqml/helloqml.qml index c7a5e2d0e..5689a1df1 100644 --- a/src/scripts/helloqml/helloqml.qml +++ b/src/scripts/helloqml/helloqml.qml @@ -1,8 +1,11 @@ import org.kde.falkon 1.0 as Falkon +import QtQuick.Window 2.3 +import QtQuick.Controls 2.3 +import QtQuick 2.3 Falkon.PluginInterface { init: function(state, settingsPath){ - console.log("'Hello Qml' plugin loaded") + console.log('"Hello QML" plugin loaded') } testPlugin: function() { @@ -10,6 +13,70 @@ Falkon.PluginInterface { } unload: function() { - console.log("Bye!") + console.log('Bye!') + } + + browserAction: Falkon.BrowserAction { + name: 'helloqml-button' + identity: 'helloqml-id' + title: 'Testing QML Title' + toolTip: 'Testing QML Tooltip' + icon: Qt.resolvedUrl('qrc:/icons/preferences/extensions.svg') + location: Falkon.BrowserAction.NavigationToolBar | Falkon.BrowserAction.StatusBar + popup: Window { + property var borderMargin: 1 + property var imageWidth: 256 + property var imageHeight: 200 + property var buttonHeight: 40 + + width: imageWidth + 2 * borderMargin + height: imageHeight + buttonHeight + 2 * borderMargin + color: 'black' + Rectangle { + anchors.fill: parent + anchors.leftMargin: borderMargin + anchors.rightMargin: borderMargin + anchors.topMargin: borderMargin + anchors.bottomMargin: borderMargin + color: 'white' + Image { + id: image + source: Qt.resolvedUrl('qrc:/icons/other/startpage.svg') + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + } + + Button { + text: 'Click Me!' + height: buttonHeight + anchors.top: image.bottom + anchors.left: parent.left + anchors.right: parent.right + } + } + } + } + + sideBar: Falkon.SideBar { + name: 'helloqml-sidebar' + title: 'Testing QML SideBar' + icon: Qt.resolvedUrl('qrc:/icons/preferences/extensions.svg') + checkable: true + Window { + Image { + source: Qt.resolvedUrl('qrc:/icons/other/startpage.svg') + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.right: parent.right + } + + Button { + text: 'Hello Qml Plugin' + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + } + } } } \ No newline at end of file