-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageFlickArea.qml
More file actions
107 lines (94 loc) · 3.24 KB
/
ImageFlickArea.qml
File metadata and controls
107 lines (94 loc) · 3.24 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
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
import QtQuick 2.0
import QtQuick.Controls 1.4
Rectangle {
property real currentZoomLevel: 1.0
width: 600
height: 800
clip: true
// Create a flickable to view a large image.
Flickable {
id: view
anchors.fill: parent
contentWidth: image.width
contentHeight: image.height
Image {
id: image
source: "file:///C:/Users/abhis/OneDrive/Pictures/me.png"
asynchronous: true
scale: currentZoomLevel
}
// Only show the scrollbars when the view is moving.
states: State {
name: "ShowBars"
when: view.movingVertically || view.movingHorizontally
PropertyChanges { target: verticalScrollBar; opacity: 1 }
PropertyChanges { target: horizontalScrollBar; opacity: 1 }
}
transitions: Transition {
NumberAnimation { properties: "opacity"; duration: 400 }
}
}
Rectangle {
id:footer
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
height: 60
/*ControlSlider {
anchors.centerIn: parent
id: zoomSlider
title: "Zoom"
from:0.7
to:15.0
value: 1.0
}*/
Row{
x: parent.width/2 - childrenRect.width/2
y: 10
spacing: 10
ToolButton {
iconSource: "qrc:/icons/zoom_in.png"
onClicked: {
currentZoomLevel = Math.min(currentZoomLevel+0.5, 20)
}
}
ToolButton {
iconSource: "qrc:/icons/zoom_out.png"
onClicked: {
currentZoomLevel -= 0.5
}
}
ToolButton {
iconSource: "qrc:/icons/zoom_reset.png"
onClicked: {
currentZoomLevel = 1.0
}
}
// ToolButton {
// iconSource: "qrc:/icons/reset.png"
// onClicked: {
// imageR.updateImageLocation()
// imageT.updateImageLocation()
// }
// }
}
}
// Attach scrollbars to the right and bottom edges of the view.
ScrollBar {
id: verticalScrollBar
width: 12; height: view.height-12
anchors.right: view.right
opacity: 0
orientation: Qt.Vertical
position: view.visibleArea.yPosition
pageSize: view.visibleArea.heightRatio
}
ScrollBar {
id: horizontalScrollBar
width: view.width-12; height: 12
anchors.bottom: view.bottom
opacity: 0
orientation: Qt.Horizontal
position: view.visibleArea.xPosition
pageSize: view.visibleArea.widthRatio
}
}