summaryrefslogtreecommitdiff
path: root/src/outputwindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/outputwindow.cc')
-rw-r--r--src/outputwindow.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/outputwindow.cc b/src/outputwindow.cc
index 815da8c..b7b1a51 100644
--- a/src/outputwindow.cc
+++ b/src/outputwindow.cc
@@ -29,6 +29,7 @@
#include <QPixmap>
#include <QPainter>
+#include <QWheelEvent>
#include <math.h>
@@ -72,7 +73,11 @@ void OutputWindow::loadPen(QString file)
void OutputWindow::setScale(double s)
{
scale = s;
- sem.acquire();
+}
+
+double OutputWindow::getScale() const
+{
+ return scale;
}
void OutputWindow::setSpeed(int s)
@@ -107,11 +112,22 @@ void OutputWindow::timeout()
timer.start(25);
}
+
+void OutputWindow::wheelEvent(QWheelEvent* event)
+{
+ double delta = event->delta() / 120.0 * scale;
+ scale += delta / 10.0;
+ printf("%f\n", scale);
+ if(scale < 0.3)
+ {
+ scale = 0.3;
+ }
+}
+
void OutputWindow::paintEvent(QPaintEvent *)
{
//sem.acquire();
QPainter p(this);
- //QTransform tp; tp.scale(3, 3); p.setTransform(tp);
if(loadpen)
{
@@ -180,7 +196,6 @@ void OutputWindow::paintEvent(QPaintEvent *)
void OutputWindow::reset()
{
- scale = 2.0;
speed = 50;
penfile = "gfx/kaiman.png";
loadpen = true;