Warning, /frameworks/kitemmodels/tests/proxymodeltestapp/selection.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2015 Stephen Kelly <steveire@gmail.com>
0003
0004 SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006
0007 import QtQuick 2.4
0008
0009 import KF5ItemModels 1.0
0010
0011 Item {
0012 width: 600
0013 height: 500
0014
0015 Component {
0016 id: labelledSelectionView
0017
0018 Column {
0019 id: column
0020 width : 200
0021 property var filterBehavior
0022 property var filterBehaviorName
0023 Text {
0024 id: label
0025 width: parent.width
0026 horizontalAlignment: Text.AlignHCenter
0027 font.bold: true
0028 font.pointSize: 10
0029 text: column.filterBehaviorName
0030 }
0031 SelectionProxyModel {
0032 id: selection
0033 sourceModel: _model
0034 selectionModel: _selectionModel
0035 filterBehavior: column.filterBehavior
0036 }
0037 Rectangle {
0038 height: parent.height - label.height
0039 width: parent.width
0040 border.width : 1
0041 border.color: "black"
0042 radius: 5
0043 ListView {
0044 width: parent.width
0045 height: parent.height
0046 y: 5
0047 x: 5
0048 model: selection
0049 delegate: Rectangle {
0050 x: 1
0051 y: 1
0052 height: 30
0053 width: 100
0054 color: model.index % 2 == 0 ? "lightsteelblue" : "white"
0055 Text {
0056 x: 5
0057 y: 5
0058 text: model.display
0059 }
0060 }
0061 }
0062 }
0063 }
0064 }
0065
0066 Loader {
0067 id: loaderExactSelection
0068 width : 200
0069 height: 300
0070 sourceComponent: labelledSelectionView
0071 Binding {
0072 target: loaderExactSelection.item
0073 property: "filterBehavior"
0074 value: SelectionProxyModel.ExactSelection
0075 when: loaderExactSelection.status == Loader.Ready
0076 }
0077 Binding {
0078 target: loaderExactSelection.item
0079 property: "filterBehaviorName"
0080 value: "ExactSelection"
0081 when: loaderExactSelection.status == Loader.Ready
0082 }
0083 }
0084
0085 Loader {
0086 id: loaderChildrenOfExactSelection
0087 x: 200
0088 width : 200
0089 height: 300
0090 sourceComponent: labelledSelectionView
0091 Binding {
0092 target: loaderChildrenOfExactSelection.item
0093 property: "filterBehavior"
0094 value: SelectionProxyModel.ChildrenOfExactSelection
0095 when: loaderChildrenOfExactSelection.status == Loader.Ready
0096 }
0097 Binding {
0098 target: loaderChildrenOfExactSelection.item
0099 property: "filterBehaviorName"
0100 value: "ChildrenOfExactSelection"
0101 when: loaderChildrenOfExactSelection.status == Loader.Ready
0102 }
0103 }
0104
0105 Loader {
0106 id: loaderSubTreeRoots
0107 x: 400
0108 width : 200
0109 height: 300
0110 sourceComponent: labelledSelectionView
0111 Binding {
0112 target: loaderSubTreeRoots.item
0113 property: "filterBehavior"
0114 value: SelectionProxyModel.SubTreeRoots
0115 when: loaderSubTreeRoots.status == Loader.Ready
0116 }
0117 Binding {
0118 target: loaderSubTreeRoots.item
0119 property: "filterBehaviorName"
0120 value: "SubTreeRoots"
0121 when: loaderSubTreeRoots.status == Loader.Ready
0122 }
0123 }
0124
0125 }