1
0

qml: define a common Heading component for page section headings

This commit is contained in:
Sander van Grieken
2023-01-17 00:34:01 +01:00
parent aac0e4f693
commit b7964253a8
12 changed files with 56 additions and 154 deletions

View File

@@ -0,0 +1,38 @@
import QtQuick 2.6
import QtQuick.Layouts 1.0
import QtQuick.Controls 2.1
RowLayout {
id: root
property string text
property alias font: label.font
Layout.fillWidth: true
Layout.topMargin: constants.paddingMedium
Layout.bottomMargin: constants.paddingMedium
spacing: constants.paddingLarge
Rectangle {
color: constants.mutedForeground
height: 1
Layout.fillWidth: true
}
Label {
id: label
Layout.leftMargin: constants.paddingMedium
Layout.rightMargin: constants.paddingMedium
text: root.text
color: constants.mutedForeground
font.pixelSize: constants.fontSizeLarge
}
Rectangle {
color: constants.mutedForeground
height: 1
Layout.fillWidth: true
}
}

View File

@@ -2,34 +2,9 @@ import QtQuick 2.6
import QtQuick.Layouts 1.0
import QtQuick.Controls 2.1
RowLayout {
Heading {
id: root
property string text
Layout.fillWidth: true
Layout.topMargin: constants.paddingXLarge
spacing: constants.paddingLarge
Rectangle {
color: constants.mutedForeground
height: 1
Layout.fillWidth: true
}
Label {
Layout.leftMargin: constants.paddingMedium
Layout.rightMargin: constants.paddingMedium
text: root.text
color: constants.mutedForeground
font.pixelSize: constants.fontSizeLarge
}
Rectangle {
color: constants.mutedForeground
height: 1
Layout.fillWidth: true
}
Layout.bottomMargin: constants.paddingMedium
}

View File

@@ -44,16 +44,8 @@ Item {
ColumnLayout {
Label {
Heading {
text: qsTr('Servers')
font.pixelSize: constants.fontSizeLarge
color: Material.accentColor
}
Rectangle {
Layout.fillWidth: true
height: 1
color: Material.accentColor
}
Frame {