From 82d2ee84b711ce43a32f2580c219b21fd97b1e49 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Mon, 31 Jan 2022 17:15:33 +0100 Subject: [PATCH] Fixing black icons when using dark theme on KDE SDK --- .../ObjectLists/ObjectCreationGrid.qml | 43 +++++++++++++++---- .../ObjectLists/ObjectLists.qml | 15 +++++-- 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectCreationGrid.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectCreationGrid.qml index 0711d17..f07f7cf 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectCreationGrid.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectCreationGrid.qml @@ -20,6 +20,8 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 import "../js/objects.js" as Objects import "../js/historylib.js" as HistoryLib +import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting + /*! \qmltype ObjectCreationGrid @@ -48,19 +50,42 @@ Column { Button { id: createBtn - text: Objects.types[modelData].displayType() width: parent.width/3 visible: Objects.types[modelData].createable() - height: visible ? implicitHeight : 0 - display: AbstractButton.TextUnderIcon - icon.name: modelData - icon.source: '../icons/objects/' + modelData + '.svg' - icon.width: 24 - icon.height: 24 - icon.color: sysPalette.windowText + height: visible ? width*0.6 : 0 + // The KDE SDK is kinda buggy, so it respects neither specified color nor display propreties. + //display: AbstractButton.TextUnderIcon + + Setting.Icon { + id: icon + width: 24 + height: 24 + anchors.left: parent.left + anchors.leftMargin: (parent.width-width)/2 + anchors.top: parent.top + anchors.topMargin: 8 + + color: sysPalette.windowText + source: '../icons/objects/'+modelData+'.svg' + } + + Label { + id: label + anchors.bottom: parent.bottom + anchors.bottomMargin: 5 + anchors.left: parent.left + anchors.leftMargin: 4 + anchors.right: parent.right + anchors.rightMargin: 4 + horizontalAlignment: Text.AlignHCenter + font.pixelSize: 14 + text: Objects.types[modelData].displayType() + clip: true + } + ToolTip.visible: hovered ToolTip.delay: 200 - ToolTip.text: text + ToolTip.text: label.text onClicked: { var newObj = Objects.createNewRegisteredObject(modelData) diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml index e953e37..7c008f8 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml @@ -19,6 +19,7 @@ import QtQuick 2.12 import QtQuick.Dialogs 1.3 as D import QtQuick.Controls 2.12 +import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting import "../js/objects.js" as Objects import "../js/historylib.js" as HistoryLib @@ -139,9 +140,17 @@ ListView { anchors.right: deleteButton.left anchors.rightMargin: 5 anchors.topMargin: 5 - icon.name: 'position' - icon.source: '../icons/common/position.svg' - icon.color: sysPalette.buttonText + + Setting.Icon { + id: icon + width: 18 + height: 18 + anchors.centerIn: parent + + color: sysPalette.windowText + source: '../icons/common/position.svg' + } + property bool hasXProp: Objects.types[objType].properties().hasOwnProperty('x') property bool hasYProp: Objects.types[objType].properties().hasOwnProperty('y') visible: hasXProp || hasYProp