Skip to content

modified how 3D mouse buttons work - #381

Open
githubdoe wants to merge 5 commits into
masterfrom
3dmouse
Open

modified how 3D mouse buttons work#381
githubdoe wants to merge 5 commits into
masterfrom
3dmouse

Conversation

@githubdoe

@githubdoe githubdoe commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Modified what 3D graph mouse button and wheel does. Left rotates, right pans, wheel zooms.

Closes #380

Comment thread surfacegraph.cpp
Comment on lines +47 to +48
#include <Q3DInputHandler>
#include <QMouseEvent>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those are not needed. they are managed by #include "custom3dinputhandler.h" and ony needed by itself.

Remove from here.

Suggested change
#include <Q3DInputHandler>
#include <QMouseEvent>

Comment thread custom3dinputhandler.h
@github-actions

Copy link
Copy Markdown

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-tidy (v21.1.8) reports: 6 concern(s)
  • custom3dinputhandler.cpp:23:51: warning: [clang-diagnostic-deprecated-declarations]

    'localPos' is deprecated: Use position()

       23 |     QMouseEvent customEvent(event->type(), event->localPos(), event->globalPos(),
          |                                                   ^
    /usr/include/x86_64-linux-gnu/qt6/QtGui/qevent.h:226:5: note: 'localPos' has been explicitly marked deprecated here
      226 |     QT_DEPRECATED_VERSION_X_6_0("Use position()")
          |     ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:326:44: note: expanded from macro 'QT_DEPRECATED_VERSION_X_6_0'
      326 | # define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text)
          |                                            ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:238:33: note: expanded from macro 'QT_DEPRECATED_X'
      238 | #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
          |                                 ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qcompilerdetection.h:956:36: note: expanded from macro 'Q_DECL_DEPRECATED_X'
      956 | #  define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
          |                                    ^
  • custom3dinputhandler.cpp:23:70: warning: [clang-diagnostic-deprecated-declarations]

    'globalPos' is deprecated: Use globalPosition()

       23 |     QMouseEvent customEvent(event->type(), event->localPos(), event->globalPos(),
          |                                                                      ^
    /usr/include/x86_64-linux-gnu/qt6/QtGui/qevent.h:215:5: note: 'globalPos' has been explicitly marked deprecated here
      215 |     QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
          |     ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:326:44: note: expanded from macro 'QT_DEPRECATED_VERSION_X_6_0'
      326 | # define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text)
          |                                            ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:238:33: note: expanded from macro 'QT_DEPRECATED_X'
      238 | #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
          |                                 ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qcompilerdetection.h:956:36: note: expanded from macro 'Q_DECL_DEPRECATED_X'
      956 | #  define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
          |                                    ^
  • custom3dinputhandler.cpp:41:51: warning: [clang-diagnostic-deprecated-declarations]

    'localPos' is deprecated: Use position()

       41 |     QMouseEvent customEvent(event->type(), event->localPos(), event->globalPos(),
          |                                                   ^
    /usr/include/x86_64-linux-gnu/qt6/QtGui/qevent.h:226:5: note: 'localPos' has been explicitly marked deprecated here
      226 |     QT_DEPRECATED_VERSION_X_6_0("Use position()")
          |     ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:326:44: note: expanded from macro 'QT_DEPRECATED_VERSION_X_6_0'
      326 | # define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text)
          |                                            ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:238:33: note: expanded from macro 'QT_DEPRECATED_X'
      238 | #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
          |                                 ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qcompilerdetection.h:956:36: note: expanded from macro 'Q_DECL_DEPRECATED_X'
      956 | #  define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
          |                                    ^
  • custom3dinputhandler.cpp:41:70: warning: [clang-diagnostic-deprecated-declarations]

    'globalPos' is deprecated: Use globalPosition()

       41 |     QMouseEvent customEvent(event->type(), event->localPos(), event->globalPos(),
          |                                                                      ^
    /usr/include/x86_64-linux-gnu/qt6/QtGui/qevent.h:215:5: note: 'globalPos' has been explicitly marked deprecated here
      215 |     QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
          |     ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:326:44: note: expanded from macro 'QT_DEPRECATED_VERSION_X_6_0'
      326 | # define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text)
          |                                            ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:238:33: note: expanded from macro 'QT_DEPRECATED_X'
      238 | #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
          |                                 ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qcompilerdetection.h:956:36: note: expanded from macro 'Q_DECL_DEPRECATED_X'
      956 | #  define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
          |                                    ^
  • custom3dinputhandler.cpp:70:51: warning: [clang-diagnostic-deprecated-declarations]

    'localPos' is deprecated: Use position()

       70 |     QMouseEvent customEvent(event->type(), event->localPos(), event->globalPos(),
          |                                                   ^
    /usr/include/x86_64-linux-gnu/qt6/QtGui/qevent.h:226:5: note: 'localPos' has been explicitly marked deprecated here
      226 |     QT_DEPRECATED_VERSION_X_6_0("Use position()")
          |     ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:326:44: note: expanded from macro 'QT_DEPRECATED_VERSION_X_6_0'
      326 | # define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text)
          |                                            ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:238:33: note: expanded from macro 'QT_DEPRECATED_X'
      238 | #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
          |                                 ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qcompilerdetection.h:956:36: note: expanded from macro 'Q_DECL_DEPRECATED_X'
      956 | #  define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
          |                                    ^
  • custom3dinputhandler.cpp:70:70: warning: [clang-diagnostic-deprecated-declarations]

    'globalPos' is deprecated: Use globalPosition()

       70 |     QMouseEvent customEvent(event->type(), event->localPos(), event->globalPos(),
          |                                                                      ^
    /usr/include/x86_64-linux-gnu/qt6/QtGui/qevent.h:215:5: note: 'globalPos' has been explicitly marked deprecated here
      215 |     QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
          |     ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:326:44: note: expanded from macro 'QT_DEPRECATED_VERSION_X_6_0'
      326 | # define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text)
          |                                            ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:238:33: note: expanded from macro 'QT_DEPRECATED_X'
      238 | #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
          |                                 ^
    /usr/include/x86_64-linux-gnu/qt6/QtCore/qcompilerdetection.h:956:36: note: expanded from macro 'Q_DECL_DEPRECATED_X'
      956 | #  define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
          |                                    ^

Have any feedback or feature suggestions? Share it here.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-linter Review

Used clang-tidy v21.1.8

Only 3 out of 6 clang-tidy concerns fit within this pull request's diff.

Have any feedback or feature suggestions? Share it here.

Comment thread custom3dinputhandler.cpp
mappedButtons = (mappedButtons & ~Qt::LeftButton) | Qt::RightButton;
}

QMouseEvent customEvent(event->type(), event->localPos(), event->globalPos(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostic

custom3dinputhandler.cpp:23:51: warning: [clang-diagnostic-deprecated-declarations]

'localPos' is deprecated: Use position()

   23 |     QMouseEvent customEvent(event->type(), event->localPos(), event->globalPos(),
      |                                                   ^
/usr/include/x86_64-linux-gnu/qt6/QtGui/qevent.h:226:5: note: 'localPos' has been explicitly marked deprecated here
  226 |     QT_DEPRECATED_VERSION_X_6_0("Use position()")
      |     ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:326:44: note: expanded from macro 'QT_DEPRECATED_VERSION_X_6_0'
  326 | # define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text)
      |                                            ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:238:33: note: expanded from macro 'QT_DEPRECATED_X'
  238 | #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
      |                                 ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qcompilerdetection.h:956:36: note: expanded from macro 'Q_DECL_DEPRECATED_X'
  956 | #  define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
      |                                    ^

clang-tidy diagnostic

custom3dinputhandler.cpp:23:70: warning: [clang-diagnostic-deprecated-declarations]

'globalPos' is deprecated: Use globalPosition()

   23 |     QMouseEvent customEvent(event->type(), event->localPos(), event->globalPos(),
      |                                                                      ^
/usr/include/x86_64-linux-gnu/qt6/QtGui/qevent.h:215:5: note: 'globalPos' has been explicitly marked deprecated here
  215 |     QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
      |     ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:326:44: note: expanded from macro 'QT_DEPRECATED_VERSION_X_6_0'
  326 | # define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text)
      |                                            ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:238:33: note: expanded from macro 'QT_DEPRECATED_X'
  238 | #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
      |                                 ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qcompilerdetection.h:956:36: note: expanded from macro 'Q_DECL_DEPRECATED_X'
  956 | #  define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
      |                                    ^

Comment thread custom3dinputhandler.cpp
mappedButtons = (mappedButtons & ~Qt::LeftButton) | Qt::RightButton;
}

QMouseEvent customEvent(event->type(), event->localPos(), event->globalPos(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostic

custom3dinputhandler.cpp:41:51: warning: [clang-diagnostic-deprecated-declarations]

'localPos' is deprecated: Use position()

   41 |     QMouseEvent customEvent(event->type(), event->localPos(), event->globalPos(),
      |                                                   ^
/usr/include/x86_64-linux-gnu/qt6/QtGui/qevent.h:226:5: note: 'localPos' has been explicitly marked deprecated here
  226 |     QT_DEPRECATED_VERSION_X_6_0("Use position()")
      |     ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:326:44: note: expanded from macro 'QT_DEPRECATED_VERSION_X_6_0'
  326 | # define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text)
      |                                            ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:238:33: note: expanded from macro 'QT_DEPRECATED_X'
  238 | #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
      |                                 ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qcompilerdetection.h:956:36: note: expanded from macro 'Q_DECL_DEPRECATED_X'
  956 | #  define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
      |                                    ^

clang-tidy diagnostic

custom3dinputhandler.cpp:41:70: warning: [clang-diagnostic-deprecated-declarations]

'globalPos' is deprecated: Use globalPosition()

   41 |     QMouseEvent customEvent(event->type(), event->localPos(), event->globalPos(),
      |                                                                      ^
/usr/include/x86_64-linux-gnu/qt6/QtGui/qevent.h:215:5: note: 'globalPos' has been explicitly marked deprecated here
  215 |     QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
      |     ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:326:44: note: expanded from macro 'QT_DEPRECATED_VERSION_X_6_0'
  326 | # define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text)
      |                                            ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:238:33: note: expanded from macro 'QT_DEPRECATED_X'
  238 | #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
      |                                 ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qcompilerdetection.h:956:36: note: expanded from macro 'Q_DECL_DEPRECATED_X'
  956 | #  define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
      |                                    ^

Comment thread custom3dinputhandler.cpp
mappedButtons = (mappedButtons & ~Qt::LeftButton) | Qt::RightButton;
}

QMouseEvent customEvent(event->type(), event->localPos(), event->globalPos(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostic

custom3dinputhandler.cpp:70:51: warning: [clang-diagnostic-deprecated-declarations]

'localPos' is deprecated: Use position()

   70 |     QMouseEvent customEvent(event->type(), event->localPos(), event->globalPos(),
      |                                                   ^
/usr/include/x86_64-linux-gnu/qt6/QtGui/qevent.h:226:5: note: 'localPos' has been explicitly marked deprecated here
  226 |     QT_DEPRECATED_VERSION_X_6_0("Use position()")
      |     ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:326:44: note: expanded from macro 'QT_DEPRECATED_VERSION_X_6_0'
  326 | # define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text)
      |                                            ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:238:33: note: expanded from macro 'QT_DEPRECATED_X'
  238 | #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
      |                                 ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qcompilerdetection.h:956:36: note: expanded from macro 'Q_DECL_DEPRECATED_X'
  956 | #  define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
      |                                    ^

clang-tidy diagnostic

custom3dinputhandler.cpp:70:70: warning: [clang-diagnostic-deprecated-declarations]

'globalPos' is deprecated: Use globalPosition()

   70 |     QMouseEvent customEvent(event->type(), event->localPos(), event->globalPos(),
      |                                                                      ^
/usr/include/x86_64-linux-gnu/qt6/QtGui/qevent.h:215:5: note: 'globalPos' has been explicitly marked deprecated here
  215 |     QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
      |     ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:326:44: note: expanded from macro 'QT_DEPRECATED_VERSION_X_6_0'
  326 | # define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text)
      |                                            ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:238:33: note: expanded from macro 'QT_DEPRECATED_X'
  238 | #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
      |                                 ^
/usr/include/x86_64-linux-gnu/qt6/QtCore/qcompilerdetection.h:956:36: note: expanded from macro 'Q_DECL_DEPRECATED_X'
  956 | #  define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
      |                                    ^

@github-actions

Copy link
Copy Markdown

🚀 New build available for commit f1375c4
Download installer here

@atsju

atsju commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Hi Dale,
Congrats on the git usage. Looks like you are mastering it.

I fixed automated build. There are some remaining deprecation warnings that need to be fixed but the build is OK.

The feature is absolutely amazing and I love it.

Being used to 3D sodftwares, there is one flaw though:
right click + up/down or left/right motion always moves allong Y and X repectively. This is only good when you look from top.
If you ever rotated the 3D, all movements become more or less nonsensical.

Here is a capture of the "problem". Video was too large so there are 2 parts.

https://github.com/user-attachments/assets/fb927c69-8c56-433d-a345-d49c009ad9e4
https://github.com/user-attachments/assets/acf36f8c-24e5-4996-b945-d96e075e2ea5

But to be honnest I like this that much that I would like to get it merged and enhanced in a different PR.

One last note: I would advocate to make the right click "orbit". Because this is the way it was in the past. And while I don't care which click does what, I think it's better to keep some some of backcompatiblity and only modify/enhance what left click is doing.

@githubdoe

Copy link
Copy Markdown
Owner Author

The older versions use to be left click orbit. So that just restored to the old way and the way I find much 3D apps that I use.

@githubdoe

Copy link
Copy Markdown
Owner Author

Yes pan gets a little weird if you rotate too much. I bet we could get AI to fix that by remembering the current rotation.

@githubdoe

Copy link
Copy Markdown
Owner Author

Currently have the pan fixed in my local temp branch. Now trying on my local master.

@atsju

atsju commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Dale, do no forget to git pull your branch before you start modifications. That'"s because I made 2 commits on your remote branch for the .pro files and QT5 compatibility.

I do not expect any conflicts. But it's easier it you pull from the start than doing after you modified/commited on your local copy

@githubdoe

Copy link
Copy Markdown
Owner Author

Yes I finally got the pull figured out and the push is now done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3D view mouse controls revamp

2 participants