Warning, /frameworks/kirigami/src/controls/ItemViewHeader.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2017 Marco Martin <mart@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.5 0008 import QtQuick.Templates 2.0 as T2 0009 import QtGraphicalEffects 1.0 as GE 0010 import org.kde.kirigami 2.4 as Kirigami 0011 import "private" as P 0012 0013 /** 0014 * An item that can be used as an header for a ListView. 0015 * It will play nice with the margin policies of ScrollablePage and can 0016 * automatically shrink when the list is scrolled, like the behavior 0017 * of list headers in many mobile applications. 0018 * It provides some default content: a title and an optional background image 0019 * @since org.kde.kirigami 2.1 0020 * @inherit kirigami::AbstractItemViewHeader 0021 * @deprecated This will be removed in KF6. 0022 * 0023 * TODO KF6 remove 0024 */ 0025 Kirigami.AbstractItemViewHeader { 0026 id: root 0027 property alias title: heading.text 0028 property alias color: heading.color 0029 0030 property alias backgroundImage: image 0031 0032 Component.onCompleted: console.warn( "ItemViewHeader is deprecated (since 5.97): No replacemant is available.", (new Error).stack) 0033 0034 maximumHeight: (backgroundImage.hasImage ? 10 : 6) * Kirigami.Units.gridUnit - (applicationWindow().header ? applicationWindow().header.height : 0) - bottomPadding 0035 bottomPadding: Kirigami.Units.smallSpacing 0036 leftPadding: Kirigami.Units.smallSpacing 0037 0038 background: Rectangle { 0039 id: backgroundItem 0040 color: Kirigami.Theme.backgroundColor 0041 Image { 0042 id: image 0043 anchors.fill: parent 0044 readonly property bool hasImage: backgroundImage.status === Image.Ready || backgroundImage.status === Image.Loading 0045 fillMode: Image.PreserveAspectCrop 0046 asynchronous: true 0047 } 0048 P.EdgeShadow { 0049 edge: root.view.headerPositioning === ListView.InlineHeader ? Qt.BottomEdge : Qt.TopEdge 0050 anchors { 0051 right: parent.right 0052 left: parent.left 0053 top: root.view.headerPositioning === ListView.InlineHeader ? undefined : parent.bottom 0054 bottom: root.view.headerPositioning === ListView.InlineHeader ? parent.top : undefined 0055 } 0056 } 0057 0058 readonly property Page page: { 0059 let obj = root.view; 0060 while(obj && !obj.hasOwnProperty("title") && !obj.hasOwnProperty("isCurrentPage")) { 0061 obj = obj.parent 0062 } 0063 return obj; 0064 } 0065 Rectangle { 0066 id: rect 0067 color: backgroundItem.page && backgroundItem.page.isCurrentPage ? Kirigami.Theme.highlightColor : Kirigami.Theme.disabledTextColor 0068 height: root.bottomPadding 0069 anchors { 0070 left: parent.left 0071 right: parent.right 0072 bottom: parent.bottom 0073 } 0074 } 0075 } 0076 0077 contentItem: Item { 0078 Kirigami.Heading { 0079 id: heading 0080 anchors { 0081 fill: parent 0082 margins: Kirigami.Units.smallSpacing 0083 } 0084 0085 height: undefined 0086 text: page.title 0087 fontSizeMode: Text.Fit 0088 minimumPointSize: 10 0089 font.pointSize: 30 0090 horizontalAlignment: Text.AlignRight 0091 verticalAlignment: Text.AlignBottom 0092 //with an image it needs to be white regardless of system palette 0093 color: root.backgroundImage.hasImage ? "white" : Kirigami.Theme.highlightColor 0094 opacity: 1 0095 elide: Text.ElideRight 0096 0097 layer.enabled: root.backgroundImage.hasImage 0098 layer.effect: GE.DropShadow { 0099 horizontalOffset: 0 0100 verticalOffset: 2 0101 radius: Kirigami.Units.smallSpacing*2 0102 samples: 32 0103 color: Qt.rgba(0, 0, 0, 0.7) 0104 } 0105 } 0106 } 0107 }