Warning, /frameworks/qqc2-desktop-style/org.kde.desktop/VerticalHeaderView.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2023 Marco Martin <mart@kde.org>
0003 SPDX-FileCopyrightText: 2020 The Qt Company Ltd.
0004
0005 SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later
0006 */
0007
0008 pragma ComponentBehavior: Bound
0009
0010 import QtQuick
0011 import QtQuick.Templates as T
0012 import org.kde.qqc2desktopstyle.private as StylePrivate
0013
0014 T.VerticalHeaderView {
0015 id: controlRoot
0016
0017 // The contentWidth of TableView will be zero at start-up, until the delegate
0018 // items have been loaded. This means that even if the implicit width of
0019 // VerticalHeaderView should be the same as the content width in the end, we
0020 // need to ensure that it has at least a width of 1 at start-up, otherwise
0021 // TableView won't bother loading any delegates at all.
0022 implicitWidth: Math.max(1, contentWidth)
0023 implicitHeight: syncView ? syncView.height : 0
0024
0025 delegate: StylePrivate.StyleItem {
0026 required property var model
0027 required property int row
0028 readonly property string headerPosition: {
0029 if (controlRoot.rows === 1) {
0030 return "only";
0031 } else if (model.row == 0) {
0032 return "beginning";
0033 } else {
0034 return "middle";
0035 }
0036 }
0037
0038 text: model[controlRoot.textRole]
0039 elementType: "header"
0040 on: {
0041 if (!controlRoot.syncView || !controlRoot.syncView.selectionModel) {
0042 return false
0043 }
0044 // This line is for property bindings
0045 void(controlRoot.syncView.selectionModel.selectedIndexes)
0046 return syncView.selectionModel.rowIntersectsSelection(model.row)
0047 }
0048 properties: {
0049 "headerpos": headerPosition,
0050 "textalignment": Text.AlignVCenter | Text.AlignHCenter,
0051 "orientation": Qt.Vertical
0052 }
0053 }
0054
0055 StylePrivate.StyleItem {
0056 parent: controlRoot
0057 anchors.fill: parent
0058 anchors.topMargin: controlRoot.contentHeight
0059 z: -1
0060 elementType: "header"
0061 properties: {
0062 "headerpos": "end",
0063 "orientation": Qt.Vertical
0064 }
0065 }
0066 }