plasmoid: Assign margins in consistency with official Plasmoids

For instance, the NetworkManager Plasmoid uses these margins for its
ListView. It looks probably better than without margins (after removing
paddings with scroll page).
This commit is contained in:
Martchus 2022-09-01 22:32:17 +02:00
parent ae35d28494
commit 36e9e98424
6 changed files with 19 additions and 6 deletions

View File

@ -21,7 +21,7 @@ Item {
delegate: TopLevelItem {
id: item
width: deviceView.width
width: deviceView.effectiveWidth()
readonly property string devName: name
readonly property string devID: devId
property alias resumePauseButton: resumePauseButton

View File

@ -12,6 +12,9 @@ ColumnLayout {
objectName: "DirectoriesPage"
PlasmaComponents3.TextField {
Layout.topMargin: PlasmaCore.Units.smallSpacing * 2
Layout.leftMargin: PlasmaCore.Units.smallSpacing * 2
Layout.rightMargin: PlasmaCore.Units.smallSpacing * 2
property bool explicitelyShown: false
id: filter
clearButtonShown: true
@ -34,7 +37,7 @@ ColumnLayout {
delegate: TopLevelItem {
id: item
width: directoryView.width
width: directoryView.effectiveWidth()
readonly property string dirName: name
readonly property string dirPath: path
property alias errorsButton: errorsButton

View File

@ -21,7 +21,7 @@ Item {
delegate: TopLevelItem {
id: item
width: downloadView.width
width: downloadView.effectiveWidth()
readonly property string downloadName: name
property alias openButton: openButton

View File

@ -222,8 +222,8 @@ PlasmaExtras.Representation {
// global statistics and traffic
GridLayout {
id: infoLayout
Layout.leftMargin: 5
Layout.bottomMargin: 2
Layout.leftMargin: PlasmaCore.Units.smallSpacing * 2
Layout.rightMargin: PlasmaCore.Units.smallSpacing * 2
Layout.fillWidth: true
Layout.fillHeight: false
Layout.maximumWidth: parent.width

View File

@ -19,7 +19,7 @@ Item {
id: recentChangesView
model: plasmoid.nativeInterface.recentChangesModel
delegate: TopLevelItem {
width: recentChangesView.width
width: recentChangesView.effectiveWidth()
ColumnLayout {
width: parent.width
spacing: 0

View File

@ -1,4 +1,5 @@
import QtQuick 2.7
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents // for Highlight and DialogStatus.Closed (used with Menu and MenuItem)
ListView {
@ -13,6 +14,15 @@ ListView {
highlight: PlasmaComponents.Highlight {
}
topMargin: PlasmaCore.Units.smallSpacing * 2
bottomMargin: PlasmaCore.Units.smallSpacing * 2
leftMargin: PlasmaCore.Units.smallSpacing * 2
rightMargin: PlasmaCore.Units.smallSpacing * 2
function effectiveWidth() {
return width - leftMargin - rightMargin
}
function activate(index) {
if (typeof contextMenu !== "undefined"
&& contextMenu.status !== PlasmaComponents.DialogStatus.Closed) {