From ef9610d4ddfec380a6e519b52382578bb1495663 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Thu, 22 Jul 2021 22:52:23 +0200 Subject: [PATCH] Updating MixedMenu, now using fallback theme instead of direct path for icons when possible, for better theme integration. --- LogarithmPlotter/__init__.py | 8 +++++++- .../qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml | 3 ++- .../qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml | 1 + .../qml/eu/ad5001/LogarithmPlotter/ObjectLists.qml | 2 -- LogarithmPlotter/qml/eu/ad5001/MixedMenu | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/LogarithmPlotter/__init__.py b/LogarithmPlotter/__init__.py index 9f4a4cd..4ee4efc 100644 --- a/LogarithmPlotter/__init__.py +++ b/LogarithmPlotter/__init__.py @@ -19,7 +19,7 @@ from PySide2.QtWidgets import QApplication, QFileDialog from PySide2.QtQml import QQmlApplicationEngine, qmlRegisterType from PySide2.QtCore import Qt, QObject, Signal, Slot, Property -from PySide2.QtGui import QIcon, QImage +from PySide2.QtGui import QIcon, QImage, QKeySequence from PySide2 import __version__ as PySide2_version import os @@ -122,6 +122,12 @@ def run(): "darwin": "default" }[platform] + icon_fallbacks = QIcon.fallbackSearchPaths(); + icon_fallbacks.append(os.path.realpath(os.path.join(os.getcwd(), "qml", "eu", "ad5001", "LogarithmPlotter", "icons"))) + icon_fallbacks.append(os.path.realpath(os.path.join(os.getcwd(), "qml", "eu", "ad5001", "LogarithmPlotter", "icons", "settings"))) + icon_fallbacks.append(os.path.realpath(os.path.join(os.getcwd(), "qml", "eu", "ad5001", "LogarithmPlotter", "icons", "settings", "custom"))) + QIcon.setFallbackSearchPaths(icon_fallbacks); + app = QApplication(argv) app.setApplicationName("LogarithmPlotter") app.setOrganizationName("Ad5001") diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml index 14e26ac..a8943c3 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml @@ -23,6 +23,7 @@ import "js/objects.js" as Objects import "js/historylib.js" as HistoryLib MenuBar { + Menu { title: qsTr("&File") Action { @@ -89,7 +90,6 @@ MenuBar { text: modelData visible: Objects.types[modelData].createable() height: visible ? implicitHeight : 0 - iconSource: './icons/'+modelData+'.svg' // Default to dark version iconName: modelData iconColor: sysPalette.windowText onTriggered: { @@ -104,6 +104,7 @@ MenuBar { title: qsTr("&Help") Action { text: qsTr("&About") + shortcut: StandardKey.HelpContents iconName: 'about' onTriggered: about.open() } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml index 5f2edc6..9180032 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml @@ -41,6 +41,7 @@ ApplicationWindow { About {id: about} + Drawer { id: sidebar width: 300 diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists.qml index 00a57ae..74161d6 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists.qml @@ -129,7 +129,6 @@ ListView { anchors.right: colorPickRect.left anchors.rightMargin: 5 anchors.topMargin: 5 - icon.source: './icons/delete.svg' icon.name: 'delete' onClicked: { @@ -434,7 +433,6 @@ ListView { visible: Objects.types[modelData].createable() height: visible ? implicitHeight : 0 display: AbstractButton.TextUnderIcon - icon.source: './icons/'+modelData+'.svg' // Default to dark version icon.name: modelData icon.width: 24 icon.height: 24 diff --git a/LogarithmPlotter/qml/eu/ad5001/MixedMenu b/LogarithmPlotter/qml/eu/ad5001/MixedMenu index 092a101..66e3761 160000 --- a/LogarithmPlotter/qml/eu/ad5001/MixedMenu +++ b/LogarithmPlotter/qml/eu/ad5001/MixedMenu @@ -1 +1 @@ -Subproject commit 092a101d2d8690a9d101783e97ea4fdc54d9d0f7 +Subproject commit 66e3761b50fcc2f14eec97eaaf20fa5ef3a48300