mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 20:44:14 +02:00
Allow changing the edit voxel size using the mouse wheel.
This commit is contained in:
parent
a5e7fdeacd
commit
537686d541
2 changed files with 22 additions and 0 deletions
|
@ -24,6 +24,7 @@
|
|||
#include <QMainWindow>
|
||||
#include <QMenuBar>
|
||||
#include <QMouseEvent>
|
||||
#include <QWheelEvent>
|
||||
#include <QShortcut>
|
||||
#include <QTimer>
|
||||
#include <QtDebug>
|
||||
|
@ -82,6 +83,8 @@ protected:
|
|||
virtual void mouseMoveEvent(QMouseEvent* event);
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event);
|
||||
|
||||
virtual void wheelEvent(QWheelEvent* event);
|
||||
};
|
||||
|
||||
void GLCanvas::initializeGL() {
|
||||
|
@ -116,6 +119,10 @@ void GLCanvas::mouseReleaseEvent(QMouseEvent* event) {
|
|||
static_cast<Application*>(QCoreApplication::instance())->mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void GLCanvas::wheelEvent(QWheelEvent* event) {
|
||||
static_cast<Application*>(QCoreApplication::instance())->wheelEvent(event);
|
||||
}
|
||||
|
||||
Application::Application(int& argc, char** argv) :
|
||||
QApplication(argc, argv),
|
||||
_window(new QMainWindow(desktop())),
|
||||
|
@ -720,6 +727,18 @@ void Application::mouseReleaseEvent(QMouseEvent* event) {
|
|||
_mousePressed = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Application::wheelEvent(QWheelEvent* event) {
|
||||
if (_mouseMode == NO_EDIT_MODE) {
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
if (event->delta() > 0) {
|
||||
_mouseVoxelScale *= 2;
|
||||
} else {
|
||||
_mouseVoxelScale /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Every second, check the frame rates and other stuff
|
||||
void Application::timer() {
|
||||
|
|
|
@ -34,6 +34,7 @@ class QGLWidget;
|
|||
class QKeyEvent;
|
||||
class QMainWindow;
|
||||
class QMouseEvent;
|
||||
class QWheelEvent;
|
||||
|
||||
class Agent;
|
||||
class ProgramObject;
|
||||
|
@ -55,6 +56,8 @@ public:
|
|||
void mousePressEvent(QMouseEvent* event);
|
||||
void mouseReleaseEvent(QMouseEvent* event);
|
||||
|
||||
void wheelEvent(QWheelEvent* event);
|
||||
|
||||
private slots:
|
||||
|
||||
void timer();
|
||||
|
|
Loading…
Reference in a new issue