From 2d5ba84e35d047d58170569d5aa116fa9ed4a8e1 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Fri, 10 Feb 2023 14:11:31 +0100 Subject: [PATCH] qml: styling InfoTextArea --- electrum/gui/qml/components/Constants.qml | 6 +- .../qml/components/controls/InfoTextArea.qml | 66 ++++++++----------- 2 files changed, 30 insertions(+), 42 deletions(-) diff --git a/electrum/gui/qml/components/Constants.qml b/electrum/gui/qml/components/Constants.qml index d4a24e6e3..1852d4a46 100644 --- a/electrum/gui/qml/components/Constants.qml +++ b/electrum/gui/qml/components/Constants.qml @@ -35,9 +35,11 @@ Item { property color colorCredit: "#ff80ff80" property color colorDebit: "#ffff8080" - property color colorMine: "yellow" - property color colorError: '#ffff8080' + property color colorInfo: Material.accentColor property color colorWarning: 'yellow' + property color colorError: '#ffff8080' + + property color colorMine: "yellow" property color colorLightningLocal: "blue" property color colorLightningRemote: "yellow" property color colorChannelOpen: "#ff80ff80" diff --git a/electrum/gui/qml/components/controls/InfoTextArea.qml b/electrum/gui/qml/components/controls/InfoTextArea.qml index 0bca39421..eb64c5aa9 100644 --- a/electrum/gui/qml/components/controls/InfoTextArea.qml +++ b/electrum/gui/qml/components/controls/InfoTextArea.qml @@ -3,7 +3,7 @@ import QtQuick.Layouts 1.0 import QtQuick.Controls 2.1 import QtQuick.Controls.Material 2.0 -Item { +TextHighlightPane { enum IconStyle { None, Info, @@ -15,50 +15,36 @@ Item { property int iconStyle: InfoTextArea.IconStyle.Info property alias textFormat: infotext.textFormat - implicitHeight: layout.height - - ColumnLayout { - id: layout - - spacing: 0 + // borderColor: constants.colorWarning + borderColor: iconStyle == InfoTextArea.IconStyle.Info + ? constants.colorInfo + : iconStyle == InfoTextArea.IconStyle.Warn + ? constants.colorWarning + : iconStyle == InfoTextArea.IconStyle.Error + ? constants.colorError + : constants.colorInfo + padding: constants.paddingXLarge + + RowLayout { width: parent.width - - Rectangle { - height: 2 - Layout.fillWidth: true - color: Qt.rgba(1,1,1,0.25) + Image { + source: iconStyle == InfoTextArea.IconStyle.Info + ? "../../../icons/info.png" + : iconStyle == InfoTextArea.IconStyle.Warn + ? "../../../icons/warning.png" + : iconStyle == InfoTextArea.IconStyle.Error + ? "../../../icons/expired.png" + : "" + Layout.preferredWidth: constants.iconSizeMedium + Layout.preferredHeight: constants.iconSizeMedium } + Label { - TextArea { id: infotext Layout.fillWidth: true - Layout.minimumHeight: constants.iconSizeLarge + 2*constants.paddingLarge - readOnly: true - rightPadding: constants.paddingLarge - leftPadding: 2*constants.iconSizeLarge - wrapMode: TextInput.Wrap - textFormat: TextEdit.RichText - background: Rectangle { - color: Qt.rgba(1,1,1,0.05) // whiten 5% - } - - Image { - source: iconStyle == InfoTextArea.IconStyle.Info ? "../../../icons/info.png" : iconStyle == InfoTextArea.IconStyle.Warn ? "../../../icons/warning.png" : iconStyle == InfoTextArea.IconStyle.Error ? "../../../icons/expired.png" : "" - anchors.left: parent.left - anchors.top: parent.top - anchors.leftMargin: constants.paddingLarge - anchors.topMargin: constants.paddingLarge - height: constants.iconSizeLarge - width: constants.iconSizeLarge - fillMode: Image.PreserveAspectCrop - } - - } - - Rectangle { - height: 2 - Layout.fillWidth: true - color: Qt.rgba(0,0,0,0.25) + width: parent.width + text: invoice.userinfo + wrapMode: Text.Wrap } } }