Warning, /frameworks/qqc2-desktop-style/org.kde.desktop/private/DefaultToolBarBackground.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2017 Marco Martin <mart@kde.org>
0003 SPDX-FileCopyrightText: 2017 The Qt Company Ltd.
0004 SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk>
0005
0006 SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later
0007 */
0008
0009 import QtQuick
0010 import QtQuick.Templates as T
0011 import org.kde.kirigami as Kirigami
0012
0013 Rectangle {
0014 id: root
0015
0016 required property T.ToolBar control
0017
0018 implicitHeight: 40
0019 color: Kirigami.Theme.backgroundColor
0020
0021 Kirigami.Separator {
0022 id: separator
0023 anchors {
0024 left: parent.left
0025 right: parent.right
0026 }
0027 }
0028
0029 // Conditional anchors are not reliable, and state machine are chunky in
0030 // terms of number of objects.
0031 function __fixup() {
0032 // Make sure to unset an old anchor before assigning a new one,
0033 // or else the separator will stuck being stretched vertically.
0034 if (control?.position === T.ToolBar.Header) {
0035 separator.anchors.top = undefined;
0036 separator.anchors.bottom = root.bottom;
0037 } else {
0038 separator.anchors.bottom = undefined;
0039 separator.anchors.top = root.top;
0040 }
0041 }
0042
0043 Component.onCompleted: __fixup()
0044
0045 Connections {
0046 target: root.control
0047
0048 function onPositionChanged() {
0049 root.__fixup();
0050 }
0051 }
0052 }