개정판 c50d7036
Add command property to imageviewer
DTI_PID/DTI_PID/QtImageViewer.py | ||
---|---|---|
78 | 78 |
# Flags for enabling/disabling mouse interaction. |
79 | 79 |
self.canZoom = True |
80 | 80 |
self.canPan = True |
81 |
self.setMouseTracking(True) |
|
81 | 82 |
|
82 | 83 |
def hasImage(self): |
83 | 84 |
""" Returns whether or not the scene contains an image pixmap. |
... | ... | |
163 | 164 |
""" |
164 | 165 |
self.updateViewer() |
165 | 166 |
|
167 |
''' |
|
168 |
@brief mouse move event |
|
169 |
''' |
|
170 |
def mouseMoveEvent(self, event): |
|
171 |
super(QtImageViewer, self).mouseMoveEvent(event) |
|
172 |
print(event.pos()) |
|
173 |
|
|
166 | 174 |
def mousePressEvent(self, event): |
167 | 175 |
""" Start mouse pan or zoom mode. |
168 | 176 |
""" |
... | ... | |
172 | 180 |
self.setDragMode(QGraphicsView.ScrollHandDrag) |
173 | 181 |
elif self.currentMenuTool == self.MENU_CROP_TOOL: |
174 | 182 |
self.setDragMode(QGraphicsView.RubberBandDrag) |
183 |
''' |
|
184 |
if self.command is not None: |
|
185 |
self.command.execute(['mousePressEvent', event.pos(), scenePos]) |
|
186 |
''' |
|
175 | 187 |
self.leftMouseButtonPressed.emit(scenePos.x(), scenePos.y()) |
176 | 188 |
elif event.button() == Qt.RightButton: |
177 | 189 |
if self.canZoom: |
... | ... | |
191 | 203 |
|
192 | 204 |
croppedImage = self.image().copy(selectionBBox.toAlignedRect()) |
193 | 205 |
self.setImage(croppedImage) |
206 |
''' |
|
207 |
if self.command is not None: |
|
208 |
self.command.execute(['mouseReleaseEvent', event.pos(), scenePos]) |
|
209 |
''' |
|
210 |
|
|
194 | 211 |
self.setDragMode(QGraphicsView.NoDrag) |
195 | 212 |
self.leftMouseButtonReleased.emit(scenePos.x(), scenePos.y()) |
196 | 213 |
elif event.button() == Qt.RightButton: |
내보내기 Unified diff