-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.qml
159 lines (142 loc) · 4.36 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Window 2.2
import QtQuick.Layouts 1.1
import "./Component"
Window {
id: window
title: qsTr("Hello World")
width: 640
height: 480
SideBar {
id: sideBarArea
window: window
sideBar: Rectangle {
width: sideBarArea.width / 2
height: sideBarArea.height
color: "blue"
ListView {
anchors.fill: parent
model: 10
delegate: Rectangle {
width: parent.width
height: 70
border.width: 1
border.color: "#ccc"
Text {
anchors.centerIn: parent
text: index
}
}
}
}
}
function showSideBar() {
sideBarArea.state = "show";
}
StackView {
id: stackView
anchors.fill: parent
initialItem: MainListView {
id: mainView
width: stackView.width
height: stackView.height
onRightSideBarIsOpenChanged: {
if(rightSideBarIsOpen) {
highlightRangeMode = ListView.ApplyRange // 焦点Item允许停止的位置
} else {
highlightRangeMode = ListView.StrictlyEnforceRange
}
}
onLeftSideBarIsOpenChanged: {
if(leftSideBarIsOpen) {
showSideBar();
}
}
header: Rectangle {
height: mainView.height
width: 1
}
model:itemsModel
footerPositioning: ListView.InlineFooter
footer: Rectangle {
width: 200
height: mainView.height
color: "yellow"
ListView {
anchors.fill: parent
model: 10
header: Rectangle {
border.color: "#ccc"
border.width: 2
width: parent.width
height: 70
Text { anchors.centerIn: parent; text:"side menu" }
}
delegate: Rectangle {
border.color: "#ccc"
border.width: 2
width: parent.width
height: 70
Text { anchors.centerIn: parent; text:index }
}
}
}
}
VisualItemModel {
id: itemsModel
MyPage {
id:page
width: stackView.width
height: stackView.height
statusBar: StatusBar {
RowLayout {
anchors.fill: parent
Label { text: "statusBar" }
}
}
toolBar: ToolBar {
RowLayout {
anchors.fill: parent
Item { Layout.fillWidth: true }
Button { text: "nothing"}
}
}
}
Page {
width: stackView.width
height: stackView.height
Button {
text: "openABigImage"
anchors.centerIn: parent
onClicked: {
stackView.push({item: openABigImage.createObject(), destroyOnPop:true})
}
}
}
}
}
Component {
id: openABigImage
Page {
width: stackView.width
height: stackView.height
toolBar: ToolBar {
RowLayout {
anchors.fill: parent
Button {text: "back"; onClicked: stackView.pop(); }
Item { Layout.fillWidth: true }
}
}
ScrollView {
anchors.fill: parent
// 设置可以使用鼠标拖动
flickableItem.interactive: true
Image {
source: "./images/bigPic.png"
fillMode: Image.PreserveAspectCrop
}
}
}
}
}