Commit 8e6e514f authored by Nate Graham's avatar Nate Graham
Browse files

[sidebar view] Fix sidebar header alignment and height

The search field's header has a totally custom view. This custom view
did not make any attempt to match the height of adjacent headers, nor to
vertically align its contents, relying on items' sizes never changing.
As a result, the header could become mis-aligned with adjacent headers,
and the search field had unequal top and bottom badding with certain
font sizes and scaling settings.

This commit fixes these issues by explicitly handling those cases.

It also does the same thing for the subcategory header to make sure they
match.


(cherry picked from commit 2c180c62)
parent ff659d1e
......@@ -28,14 +28,30 @@ Kirigami.ScrollablePage {
readonly property bool searchMode: searchField.text.length > 0
header: Kirigami.AbstractApplicationHeader {
id: pageHeader
leftPadding: Kirigami.Units.smallSpacing
rightPadding: Kirigami.Units.smallSpacing
implicitHeight: topPadding + sizeHelper.implicitHeight + bottomPadding
// Not visible; just to get its size so we can match this custom header
// with the height of a standard header
Kirigami.Heading {
id: sizeHelper
// otherwise it gets parented to the content item which we don't want
parent: pageHeader
text: "Placeholder"
visible: false
}
contentItem: RowLayout {
// FIXME: left and right anchors shouldn't ne needed here, but if
// they're rmeoved, the layout doesn't span the full width
anchors {
left: parent.left
leftMargin: Kirigami.Units.smallSpacing
right: parent.right
rightMargin: Kirigami.Units.smallSpacing
}
QQC2.ToolButton {
id: menuButton
icon.name: "application-menu"
......
......@@ -28,11 +28,24 @@ Kirigami.ScrollablePage {
title: systemsettings.subCategoryModel.title
header: Kirigami.AbstractApplicationHeader {
id: pageHeader
topPadding: Kirigami.Units.smallSpacing
bottomPadding: Kirigami.Units.smallSpacing
leftPadding: Kirigami.Units.smallSpacing
rightPadding: Kirigami.Units.smallSpacing
preferredHeight: toolBarLayout.implicitHeight + topPadding + bottomPadding
implicitHeight: topPadding + sizeHelper.implicitHeight + bottomPadding
// Not visible; just to get its size so we can match this custom header
// with the height of a standard header
Kirigami.Heading {
id: sizeHelper
// otherwise it gets parented to the content item which we don't want
parent: pageHeader
text: "Placeholder"
visible: false
}
contentItem: RowLayout {
id: toolBarLayout
......
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