File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,23 @@ void Figure2D::wheelEvent(QWheelEvent *event)
7575// fitInView(sceneRect());
7676}
7777
78+ void Figure2D::keyPressEvent (QKeyEvent *event)
79+ {
80+ switch (event->key ())
81+ {
82+ case Qt::Key_Plus:
83+ case Qt::Key_Q:
84+ this ->scale (1.25 ,1.25 );
85+ break ;
86+ case Qt::Key_Minus:
87+ case Qt::Key_W:
88+ this ->scale (0.8 ,0.8 );
89+ break ;
90+ default :
91+ QGraphicsView::keyPressEvent (event);
92+ }
93+ }
94+
7895void Figure2D::exportGraphics (QString fileName)
7996{
8097 // Open file save dialog if no filename given
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ class Figure2D : public QGraphicsView
1919protected:
2020 void drawForeground (QPainter *painter, const QRectF &rect);
2121 void wheelEvent (QWheelEvent *event);
22+ void keyPressEvent (QKeyEvent *event);
2223
2324signals:
2425
You can’t perform that action at this time.
0 commit comments