Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions qt6/src/qml/DialogWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ Window {
D.DWindow.wmWindowTypes: D.WindowManagerHelper.DialogType
flags: Qt.Dialog | Qt.WindowCloseButtonHint | Qt.MSWindowsFixedSizeDialogHint
D.ColorSelector.family: D.Palette.CrystalColor
color: "transparent"
height: content.height
width: content.width
property bool enableBehindWindowBlur: true
color: enableBehindWindowBlur ? "transparent" : palette.base
height: content.implicitHeight
width: content.implicitWidth

property alias header: titleBar.sourceComponent
property string icon
Expand All @@ -33,31 +34,40 @@ Window {
property real rightPadding: DS.Style.dialogWindow.contentHMargin
property real topPadding: title === "" ? 0 : DS.Style.dialogWindow.contentVMargin

D.StyledBehindWindowBlur {
control: control
Loader {
anchors.fill: parent
blendColor: {
if (valid) {
active: control.enableBehindWindowBlur
sourceComponent: D.StyledBehindWindowBlur {
control: Window.window
anchors.fill: parent
blendColor: {
if (valid) {
return DS.Style.control.selectColor(undefined,
Qt.rgba(235 / 255.0, 235 / 255.0, 235 / 255.0, 0.6),
Qt.rgba(10 / 255.0, 10 / 255.0, 10 / 255.0, 85 / 255.0))
}
return DS.Style.control.selectColor(undefined,
Qt.rgba(235 / 255.0, 235 / 255.0, 235 / 255.0, 0.6),
Qt.rgba(10 / 255.0, 10 / 255.0, 10 / 255.0, 85 / 255.0))
DS.Style.behindWindowBlur.lightNoBlurColor,
DS.Style.behindWindowBlur.darkNoBlurColor)
}
return DS.Style.control.selectColor(undefined,
DS.Style.behindWindowBlur.lightNoBlurColor,
DS.Style.behindWindowBlur.darkNoBlurColor)
}
}

Item {
id: content
anchors.fill: parent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样写真的没有循环的问题么?
测下其它的场景吧,

implicitWidth: layout.implicitWidth
implicitHeight: layout.implicitHeight
palette: control.active ? D.DTK.palette : D.DTK.inactivePalette
implicitHeight: childrenRect.height
ColumnLayout {
id: layout
anchors.fill: parent
spacing: 0

Loader {
id: titleBar
Layout.fillWidth: true
Layout.preferredWidth: item ? item.implicitWidth : 0
z: D.DTK.TopOrder
sourceComponent: DialogTitleBar {
enableInWindowBlendBlur: false
Expand All @@ -67,6 +77,7 @@ Window {

Loader {
active: title !== ""
visible: active
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
sourceComponent: Component {
Expand All @@ -82,6 +93,7 @@ Window {
Item {
id: contentLoader
Layout.fillWidth: true
Layout.fillHeight: true
Layout.preferredHeight: childrenRect.height
Layout.leftMargin: control.leftPadding
Layout.rightMargin: control.rightPadding
Expand Down
110 changes: 63 additions & 47 deletions qt6/src/qml/settings/SettingsDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

import QtQuick
import QtQuick.Layouts
import org.deepin.dtk 1.0 as D
import org.deepin.dtk.style 1.0 as DS
import org.deepin.dtk.settings 1.0 as Settings
import org.deepin.dtk 1.0

DialogWindow {
id: control
enableBehindWindowBlur: false

property list<Settings.SettingsGroup> groups
property QtObject config
Expand All @@ -28,60 +30,74 @@ DialogWindow {
property alias navigationView: navigationView
property alias contentView: contentView

ScrollView {
id: navigationBg
clip: true
width: DS.Style.settings.navigation.width
background: Rectangle {
anchors.fill: parent
color: palette.base
}
RowLayout {
anchors.fill: parent
spacing: 0

ListView {
id: navigationView
model: container.navigationModel
leftMargin: DS.Style.settings.navigation.margin
rightMargin: DS.Style.settings.navigation.margin
currentIndex: 0
onCurrentIndexChanged: {
contentView.currentIndex = currentIndex
}
}
}
ScrollView {
id: navigationBg
clip: true
Layout.preferredWidth: DS.Style.settings.navigation.width
Layout.fillHeight: true

ScrollView {
id: contentBg
clip: true
anchors {
right: parent.right
left: navigationBg.right
top: control.top
}
padding: DS.Style.settings.content.margin
background: Rectangle {
anchors.fill: parent
color: palette.base
ListView {
id: navigationView
clip: true
model: container.navigationModel
leftMargin: DS.Style.settings.navigation.margin
rightMargin: DS.Style.settings.navigation.margin
currentIndex: 0
onCurrentIndexChanged: {
contentView.currentIndex = currentIndex
}
}
}

ListView {
id: contentView
model: container.contentModel
highlightRangeMode: ListView.StrictlyEnforceRange
currentIndex: 0
onCurrentIndexChanged: {
navigationView.currentIndex = currentIndex
ScrollView {
id: contentBg
Layout.fillWidth: true
Layout.fillHeight: true
leftPadding: DS.Style.settings.content.margin
rightPadding: DS.Style.settings.content.margin
topPadding: DS.Style.settings.content.margin
bottomPadding: DS.Style.settings.content.margin
background: Rectangle {
anchors.fill: parent
color: palette.window
radius: DS.Style.control.radius
Rectangle {
anchors {
fill: parent
leftMargin: contentBg.leftPadding
rightMargin: contentBg.rightPadding
topMargin: contentBg.topPadding
bottomMargin: contentBg.bottomPadding
}
color: palette.base
}
}
footer: Item {
width: parent.width
height: DS.Style.settings.content.resetButtonHeight

Button {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
text: qsTr("Restore Defaults")
ListView {
id: contentView
model: container.contentModel
clip: true
highlightRangeMode: ListView.StrictlyEnforceRange
currentIndex: 0
onCurrentIndexChanged: {
navigationView.currentIndex = currentIndex
}
footer: Item {
width: parent.width
height: DS.Style.settings.content.resetButtonHeight

Button {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
text: qsTr("Restore Defaults")

onClicked: {
settingsContainer.resetSettings();
onClicked: {
settingsContainer.resetSettings();
}
}
}
}
Expand Down
Loading