From 4b28366c9fe8490eac5c88a63142a33459767207 Mon Sep 17 00:00:00 2001 From: cutefishd Date: Fri, 16 Apr 2021 22:04:01 +0800 Subject: [PATCH] Optimize dialog --- debian/control | 1 + src/blurhelper/windowblur.cpp | 2 ++ src/controls/Theme.qml | 1 + src/controls/Window.qml | 1 - src/fish-style/Dialog.qml | 10 +++++----- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/debian/control b/debian/control index 56208e7..ccf8f1f 100644 --- a/debian/control +++ b/debian/control @@ -5,6 +5,7 @@ Maintainer: CutefishOS Build-Depends: cmake, debhelper (>= 9), extra-cmake-modules, + libxcb1-dev, libkf5windowsystem-dev, libqt5x11extras5-dev, qtbase5-dev, diff --git a/src/blurhelper/windowblur.cpp b/src/blurhelper/windowblur.cpp index d33445f..903bd48 100644 --- a/src/blurhelper/windowblur.cpp +++ b/src/blurhelper/windowblur.cpp @@ -25,6 +25,8 @@ #include #include +#include +#include WindowBlur::WindowBlur(QObject *parent) noexcept : QObject(parent) diff --git a/src/controls/Theme.qml b/src/controls/Theme.qml index 72968df..ae4b442 100644 --- a/src/controls/Theme.qml +++ b/src/controls/Theme.qml @@ -37,6 +37,7 @@ QtObject { property real smallRadius: 8.0 property real mediumRadius: 10.0 property real bigRadius: 12.0 + property real hugeRadius: 14.0 property font defaultFont: fontMetrics.font property font smallFont: { diff --git a/src/controls/Window.qml b/src/controls/Window.qml index 1cb426f..0c04934 100644 --- a/src/controls/Window.qml +++ b/src/controls/Window.qml @@ -209,7 +209,6 @@ Window { ColumnLayout { anchors.fill: parent - // anchors.margins: !isMaximized && !isFullScreen ? 1 : 0 anchors.margins: 0 spacing: 0 diff --git a/src/fish-style/Dialog.qml b/src/fish-style/Dialog.qml index cda32fb..9ad8965 100644 --- a/src/fish-style/Dialog.qml +++ b/src/fish-style/Dialog.qml @@ -34,9 +34,8 @@ T.Dialog { contentWidth > 0 ? contentHeight + topPadding + bottomPadding : 0) contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) - contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) + header.implicitHeight + footer.implicitHeight - - padding: FishUI.Units.largeSpacing + contentHeight: contentItem.implicitHeight + header.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) + header.implicitHeight + footer.implicitHeight + padding: FishUI.Theme.hugeRadius enter: Transition { NumberAnimation { @@ -61,7 +60,7 @@ T.Dialog { contentItem: Item {} background: Rectangle { - radius: FishUI.Theme.mediumRadius + radius: FishUI.Theme.hugeRadius color: FishUI.Theme.backgroundColor border.width: 1 border.color: FishUI.Theme.darkMode ? Qt.rgba(255, 255, 255, 0.2) : Qt.rgba(0, 0, 0, 0.1) @@ -78,7 +77,8 @@ T.Dialog { } header: Item { - height: _headerLabel.visible ? _headerLabel.height + FishUI.Units.largeSpacing : 0 + id: _headerItem + implicitHeight: _headerLabel.visible ? _headerLabel.implicitHeight + FishUI.Units.largeSpacing : 0 Label { id: _headerLabel