Commit bb363f62 authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Add an option on Columns to remove the background margins

This allows faces to occupy the entire contents of the column. To avoid
ugly artifacts we cut off the corners using an opacity mask.
parent 5bf7ad15
......@@ -116,13 +116,23 @@ Container {
]
toolbar.moveAxis: Qt.XAxis
toolbar.extraActions: Action {
icon.name: "view-visible"
text: i18nc("@action", "Show Background")
checkable: true
checked: control.columnData.showBackground
onTriggered: control.columnData.showBackground = !control.columnData.showBackground
}
toolbar.extraActions: [
Action {
icon.name: "view-visible"
text: i18nc("@action", "Show Background")
checkable: true
checked: control.columnData.showBackground
onTriggered: control.columnData.showBackground = !control.columnData.showBackground
},
Action {
icon.name: "trim-margins"
text: i18nc("@action", "Remove Background Margins")
enabled: control.columnData.showBackground
checkable: true
checked: control.columnData.noMargins
onTriggered: control.columnData.noMargins = !control.columnData.noMargins
}
]
function addSection(index) {
control.columnData.insertChild(index, {name: "section-" + index, isSeparator: false})
......
......@@ -8,6 +8,8 @@ import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.0
import org.kde.kirigami 2.12 as Kirigami
import org.kde.ksysguard.faces 1.0 as Faces
import org.kde.ksysguard.page 1.0
......@@ -82,9 +84,19 @@ ColumnLayout {
id: columnContents
anchors.fill: parent
anchors.margins: model.data.showBackground ? Kirigami.Units.largeSpacing : 0
anchors.margins: !model.data.showBackground ? 0 : (model.data.noMargins ? 1 : Kirigami.Units.largeSpacing)
spacing: Kirigami.Units.largeSpacing
layer.enabled: model.data.showBackground && model.data.noMargins
layer.effect: OpacityMask {
maskSource: Kirigami.ShadowedRectangle {
width: columnContents.width
height: columnContents.height
radius: Kirigami.Units.smallSpacing
}
}
Repeater {
model: PageDataModel { data: model.data }
......
......@@ -47,6 +47,7 @@ Title=
[page][row-0][column-0]
name=column-0
showBackground=false
noMargins=false
[page][row-0][column-0][section-0]
face=Face-94920553440704
......
......@@ -131,6 +131,7 @@ Title[zh_CN]=否
[page][row-1][column-0]
name=column-0
showBackground=true
noMargins=false
[page][row-1][column-0][section-0]
face=Face-94107109903664
......@@ -207,6 +208,7 @@ Title[zh_CN]=否
[page][row-3][column-0]
name=column-0
showBackground=true
noMargins=false
[page][row-3][column-0][section-0]
face=Face-94107115022400
......@@ -283,6 +285,7 @@ Title[zh_CN]=否
[page][row-5][column-0]
name=column-0
showBackground=true
noMargins=false
[page][row-5][column-0][section-0]
face=Face-94107150101264
......
......@@ -290,6 +290,7 @@ Title=
[page][row-0][column-0]
name=column-0
showBackground=true
noMargins=false
[page][row-0][column-0][section-0]
face=Face-94410222150464
......@@ -299,6 +300,7 @@ name=section-0
[page][row-0][column-1]
name=column-1
showBackground=true
noMargins=false
[page][row-0][column-1][section-0]
face=Face-94410261307168
......@@ -308,6 +310,7 @@ name=section-0
[page][row-0][column-2]
name=column-2
showBackground=true
noMargins=false
[page][row-0][column-2][section-0]
face=Face-94410266684256
......@@ -356,6 +359,7 @@ Title=
[page][row-2][column-0]
name=column-0
showBackground=true
noMargins=false
[page][row-2][column-0][section-0]
face=Face-94410238879984
......@@ -424,6 +428,7 @@ Title=
[page][row-4][column-0]
name=column-0
showBackground=true
noMargins=true
[page][row-4][column-0][section-0]
face=Face-94410254040128
......
......@@ -47,6 +47,7 @@ Title=
[page][row-0][column-0]
name=column-0
showBackground=false
noMargins=false
[page][row-0][column-0][section-0]
face=Face-94051759765872
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment