From 61bcce08d358c36d6e1cd9d9908229589a0eb374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Thu, 30 Mar 2023 14:24:28 +0800 Subject: Simplify & reuse menu item background --- Header.ui.qml | 82 +++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/Header.ui.qml b/Header.ui.qml index 4cc507d..54eae75 100644 --- a/Header.ui.qml +++ b/Header.ui.qml @@ -46,22 +46,23 @@ ToolBar { } Component { - id: image - Image { - source: imageSource - sourceSize { - width: size - height: size + id: background + + Item { + implicitWidth: width + + Rectangle { + id: rectangle + anchors.fill: parent + radius: 5.2 + color: Eduport.mode + ? Eduport.bsDark + : Eduport.bsBodyBg } - layer { - enabled: true - effect: OpacityMask { - maskSource: Rectangle { - width: size - height: size - radius: size - } - } + + DrpShdw.Box { + source: rectangle + anchors.fill: rectangle } } } @@ -120,6 +121,35 @@ ToolBar { width: 1 } } + + Menu { + y: parent.height + background: Loader { + width: 256 + sourceComponent: background + } + } + } + + Component { + id: image + Image { + source: imageSource + sourceSize { + width: size + height: size + } + layer { + enabled: true + effect: OpacityMask { + maskSource: Rectangle { + width: size + height: size + radius: size + } + } + } + } } ToolButton { @@ -142,6 +172,10 @@ ToolBar { y: parent.height horizontalPadding: 10 verticalPadding: 16 + background: Loader { + width: 260.734 + sourceComponent: background + } delegate: MenuItem { id: menuItem font: Eduport.bsBtnFont @@ -186,24 +220,6 @@ ToolBar { radius: 5.2 } } - background: Item { - implicitWidth: 260.734 - implicitHeight: 295.406 - - Rectangle { - id: rectangle - anchors.fill: parent - radius: 5.2 - color: Eduport.mode - ? Eduport.bsDark - : Eduport.bsBodyBg - } - - DrpShdw.Box { - source: rectangle - anchors.fill: rectangle - } - } Item { id: info -- cgit v1.2.3