-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRefreshView.qml
More file actions
50 lines (45 loc) · 1.28 KB
/
Copy pathRefreshView.qml
File metadata and controls
50 lines (45 loc) · 1.28 KB
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
import QtQuick 2.11
import QtQuick.Controls 2.4
Item {
id:control
height: visible? viewHeight:0
width: parent.width
visible: false
property int viewHeight:60
property Item controlObj: parent.parent
property bool viewDragging: controlObj.dragging
property bool hasRefresh: true
property string tips:"tips"
readonly property bool isHeader: controlObj.headerItem.toString()===control.toString()
signal refeash()
Row{
spacing: 8
anchors.centerIn: parent
BusyIndicator{
width: 32
height: 32
running: visible
}
Label{
font.pixelSize: 14
anchors.verticalCenter: parent.verticalCenter
text: tips
}
}
onViewDraggingChanged: {
if(!viewDragging){
if(hasRefresh&&isHeader&&controlObj.contentY<-viewHeight){
visible=true
refeash()
}
if(hasRefresh&&!isHeader&&controlObj.contentY>0&&
controlObj.contentY>controlObj.contentHeight+viewHeight-controlObj.height){
visible=true
refeash()
}
}
}
function hideView(){
visible=false
}
}