Updating MixedMenu, now using fallback theme instead of direct path for icons when possible, for better theme integration.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adsooi 2021-07-22 22:52:23 +02:00
parent b8db13bbf2
commit ef9610d4dd
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
5 changed files with 11 additions and 5 deletions

View file

@ -19,7 +19,7 @@
from PySide2.QtWidgets import QApplication, QFileDialog from PySide2.QtWidgets import QApplication, QFileDialog
from PySide2.QtQml import QQmlApplicationEngine, qmlRegisterType from PySide2.QtQml import QQmlApplicationEngine, qmlRegisterType
from PySide2.QtCore import Qt, QObject, Signal, Slot, Property 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 from PySide2 import __version__ as PySide2_version
import os import os
@ -122,6 +122,12 @@ def run():
"darwin": "default" "darwin": "default"
}[platform] }[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 = QApplication(argv)
app.setApplicationName("LogarithmPlotter") app.setApplicationName("LogarithmPlotter")
app.setOrganizationName("Ad5001") app.setOrganizationName("Ad5001")

View file

@ -23,6 +23,7 @@ import "js/objects.js" as Objects
import "js/historylib.js" as HistoryLib import "js/historylib.js" as HistoryLib
MenuBar { MenuBar {
Menu { Menu {
title: qsTr("&File") title: qsTr("&File")
Action { Action {
@ -89,7 +90,6 @@ MenuBar {
text: modelData text: modelData
visible: Objects.types[modelData].createable() visible: Objects.types[modelData].createable()
height: visible ? implicitHeight : 0 height: visible ? implicitHeight : 0
iconSource: './icons/'+modelData+'.svg' // Default to dark version
iconName: modelData iconName: modelData
iconColor: sysPalette.windowText iconColor: sysPalette.windowText
onTriggered: { onTriggered: {
@ -104,6 +104,7 @@ MenuBar {
title: qsTr("&Help") title: qsTr("&Help")
Action { Action {
text: qsTr("&About") text: qsTr("&About")
shortcut: StandardKey.HelpContents
iconName: 'about' iconName: 'about'
onTriggered: about.open() onTriggered: about.open()
} }

View file

@ -41,6 +41,7 @@ ApplicationWindow {
About {id: about} About {id: about}
Drawer { Drawer {
id: sidebar id: sidebar
width: 300 width: 300

View file

@ -129,7 +129,6 @@ ListView {
anchors.right: colorPickRect.left anchors.right: colorPickRect.left
anchors.rightMargin: 5 anchors.rightMargin: 5
anchors.topMargin: 5 anchors.topMargin: 5
icon.source: './icons/delete.svg'
icon.name: 'delete' icon.name: 'delete'
onClicked: { onClicked: {
@ -434,7 +433,6 @@ ListView {
visible: Objects.types[modelData].createable() visible: Objects.types[modelData].createable()
height: visible ? implicitHeight : 0 height: visible ? implicitHeight : 0
display: AbstractButton.TextUnderIcon display: AbstractButton.TextUnderIcon
icon.source: './icons/'+modelData+'.svg' // Default to dark version
icon.name: modelData icon.name: modelData
icon.width: 24 icon.width: 24
icon.height: 24 icon.height: 24

@ -1 +1 @@
Subproject commit 092a101d2d8690a9d101783e97ea4fdc54d9d0f7 Subproject commit 66e3761b50fcc2f14eec97eaaf20fa5ef3a48300