From 63d9b5692b8110b60b5ffa56afdb47044a7678b8 Mon Sep 17 00:00:00 2001 From: Ruslan Garifullin Date: Mon, 25 Oct 2021 23:36:26 +0300 Subject: [PATCH] Add the ability to flip the image --- reference/reference.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/reference/reference.py b/reference/reference.py index e5a7cce..820fae8 100644 --- a/reference/reference.py +++ b/reference/reference.py @@ -167,6 +167,13 @@ def __init__(self): openButton.setDefaultAction(self.open) buttonLayout.addWidget(openButton) + self.flip = QAction(self) + self.flip.setIconText("Flip") + self.flip.triggered.connect(self.flipImage) + flipButton = QToolButton() + flipButton.setDefaultAction(self.flip) + buttonLayout.addWidget(flipButton) + layout.addLayout(buttonLayout) self.setWidget(widget) @@ -188,6 +195,10 @@ def openImage(self): Application.writeSetting('referenceDocker', 'lastdir', self.currentDir) self.viewer.setImage(QImage(fileName)) + + def flipImage(self): + self.viewer.image = self.viewer.image.mirrored(True, False) + self.viewer.update() @pyqtSlot(QColor) def changeColor(self, color):