Warning, /frameworks/qqc2-desktop-style/org.kde.desktop/HorizontalHeaderView.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.HorizontalHeaderView {
0015 id: controlRoot
0016
0017 implicitWidth: syncView ? syncView.width : 0
0018 // The contentHeight of TableView will be zero at start-up, until the delegate
0019 // items have been loaded. This means that even if the implicit height of
0020 // HorizontalHeaderView should be the same as the content height in the end, we
0021 // need to ensure that it has at least a height of 1 at start-up, otherwise
0022 // TableView won't bother loading any delegates at all.
0023 implicitHeight: Math.max(1, contentHeight)
0024
0025 delegate: StylePrivate.StyleItem {
0026 required property var model
0027 required property int column
0028 readonly property string headerPosition: {
0029 if (controlRoot.columns === 1) {
0030 return "only";
0031 } else if (model.column === 0) {
0032 return LayoutMirroring.enabled ? "end" : "beginning";
0033 } else {
0034 return "middle";
0035 }
0036 }
0037
0038 text: model[controlRoot.textRole]
0039 elementType: "header"
0040 on: {
0041 let selectionModel = controlRoot.selectionModel
0042 if (!selectionModel && controlRoot.syncView) {
0043 selectionModel = controlRoot.syncView.selectionModel
0044 }
0045 if (!selectionModel) {
0046 return false
0047 }
0048
0049 // This line is for property bindings
0050 void(selectionModel.selectedIndexes);
0051 return selectionModel.columnIntersectsSelection(model.column)
0052 }
0053 //FIXME: this is not usable as we don't have ways to query the sort column
0054 //activeControl: orderQuery ? (filteredMimeTypesModel.sortOrder == Qt.AscendingOrder ? "down" : "up") : ""
0055 activeControl: {
0056 if (model.sort !== undefined) {
0057 return model.sort == Qt.AscendingOrder ? "down" : "up"
0058 }
0059 return ""
0060 }
0061 properties: {
0062 "headerpos": headerPosition,
0063 "textalignment": Text.AlignVCenter | Text.AlignHCenter,
0064 "orientation": Qt.Horizontal
0065 }
0066 }
0067
0068 StylePrivate.StyleItem {
0069 parent: controlRoot
0070 anchors.fill: parent
0071 anchors.leftMargin: controlRoot.contentWidth
0072 z: -1
0073 elementType: "header"
0074 properties: {
0075 "headerpos": LayoutMirroring.enabled ? "beginning" : "end",
0076 "orientation": Qt.Horizontal
0077 }
0078 }
0079 }