-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOldImageScrollArea.qml
More file actions
146 lines (114 loc) · 3.99 KB
/
OldImageScrollArea.qml
File metadata and controls
146 lines (114 loc) · 3.99 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
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
import QtQuick 2.6
import QtQuick.Controls 2.12
import QtGraphicalEffects 1.12
Item {
id: rootImageScrollArea
anchors.fill: parent
property var currentFrame: undefined
property real surfaceViewportRatio: 1.5
property alias zoomController: zoomSlider
property string imageSrc:""
property real zoomScale: zoomSlider.value
signal imageScaled()
// onImageSrcChanged: {
// image.source = `image://Bi/img/${imageSrc}/cmap/${colorMapCmb.currentText}/min/${thresholdSlider.first.value}/max/${thresholdSlider.second.value}/t/1`;
// }
Flickable {
id: flick
anchors.fill: parent
contentWidth: width
contentHeight: height
Rectangle {
id: imgRect
// anchors.centerIn: parent
width: image.width
height: image.height
color: "transparent"
smooth: true
antialiasing: true
Component.onCompleted: {
x = (rootImageScrollArea.width/2) - (image.width / 2)
y = (rootImageScrollArea.height/2) - (image.height / 2)
}
scale: zoomScale
Image {
id: image
cache: false
source: imageSrc
anchors.centerIn: parent
fillMode: Image.PreserveAspectFit
antialiasing: true
visible: true
}
// BrightnessContrast {
// id: image
// anchors.fill: image_src
// source: image_src
// brightness: 0.0
// contrast: 0.0
// antialiasing: true
// }
/*MouseArea {
id: dragArea
hoverEnabled: true
anchors.fill: parent
drag.target: imgRect
scrollGestureEnabled: true // 2-finger-flick gesture should pass through to the Flickable
onPositionChanged: {
let x = Math.round(mouse.x);
let y = Math.round(mouse.y);
let val = Manager.intensity(x, y);
// let posInfo = ` X: ${x}, Y: ${y}, Value: ${val}`;
// appRoot.statusBar.positionInfo = posInfo;
}
onWheel: {
if (wheel.modifiers & Qt.ControlModifier) {
if(wheel.angleDelta.y < 0) {
zoomSlider.decrease();
// rootImageScrollArea.imageScaled();
} else {
zoomSlider.increase();
// rootImageScrollArea.imageScaled();
}
}
}
}*/
}
Row {
x: (parent.width - childrenRect.width) -50
y: parent.height - 60
spacing: 10
ControlSlider {
id: zoomSlider
from: 0.7
value: 1.0
to: 15.0
title:"Zoom"
}
ThresholdSlider {
id: thresholdSlider
from:0
to: 255
first.value: 0
// first.onMoved: thresholdImage();
second.value: 255
// second.onMoved: thresholdImage();
}
ComboBox {
id: colorMapCmb
model: Manager.availableColorMaps();
onActivated: changeColorMap()
background: Rectangle {
implicitWidth: 120
implicitHeight: 40
radius: 2
}
function updateDefaultSelection() {
colorMapCmb.currentIndex = colorMapCmb.find("Greys", Qt.MatchExactly)
}
Component.onCompleted: updateDefaultSelection()
onModelChanged: updateDefaultSelection()
}
}
}
}