aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-photo/PhotoView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils/lumina-photo/PhotoView.cpp')
-rw-r--r--src-qt5/desktop-utils/lumina-photo/PhotoView.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src-qt5/desktop-utils/lumina-photo/PhotoView.cpp b/src-qt5/desktop-utils/lumina-photo/PhotoView.cpp
new file mode 100644
index 00000000..def476b5
--- /dev/null
+++ b/src-qt5/desktop-utils/lumina-photo/PhotoView.cpp
@@ -0,0 +1,30 @@
+
+#include "PhotoView.h"
+
+PhotoView::PhotoView (QWidget *parent) : QGraphicsView (parent)
+{
+ setCacheMode (CacheBackground);
+ setViewportUpdateMode (BoundingRectViewportUpdate);
+ setRenderHint (QPainter::HighQualityAntialiasing);
+ setTransformationAnchor (AnchorUnderMouse);
+}
+
+void PhotoView::zoomIn ()
+{
+ scale (scaleFactor, scaleFactor);
+}
+
+void PhotoView::zoomOut ()
+{
+ scale (invScaleFactor, invScaleFactor);
+}
+
+void PhotoView::zoomNormal ()
+{
+ resetMatrix ();
+}
+
+void PhotoView::zoomFit ()
+{
+ fitInView (sceneRect (), Qt::KeepAspectRatio);
+}
bgstack15