-
-
Notifications
You must be signed in to change notification settings - Fork 166
Updated orientation example #505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Updated orientation example #505
Conversation
thp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating the code! I've added some comments. Please have a look.
| SIGNAL(orientation(qreal,qreal,qreal,qreal,qreal,qreal,qreal)), | ||
| &view, | ||
| SLOT(orientation(qreal,qreal,qreal,qreal,qreal,qreal,qreal))); | ||
| &Orientation::orientation, // new function-pointer syntax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good change, but the comment is more for explaining the PR and not the code:
| &Orientation::orientation, // new function-pointer syntax | |
| &Orientation::orientation, |
| #ifndef ORIENTATION_H | ||
| #define ORIENTATION_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we are at it, might as well change it to #pragma once at the top (same for orientationview.h).
|
|
||
| if (move == NULL) { | ||
| fprintf(stderr, "Could not connect to controller.\n"); | ||
| QMetaObject::invokeMethod(qApp, "quit", Qt::QueuedConnection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this also use the function pointer style syntax?
template <typename Functor, typename FunctorReturnType>
bool QMetaObject::invokeMethod(QObject *context, Functor function,
Qt::ConnectionType type = Qt::AutoConnection,
FunctorReturnType *ret = nullptr);Invokes the function in the event loop of context. function can be a functor or a pointer to a member function. Returns true if the function could be invoked. Returns false if there is no such function or the parameters did not match. The return value of the function call is placed in ret.
https://doc.qt.io/archives/qt-5.15/qmetaobject.html#invokeMethod-4
|
|
||
| psmove_tracker_free(tracker); | ||
| psmove_disconnect(move); | ||
| QMetaObject::invokeMethod(qApp, "quit", Qt::QueuedConnection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, this can possibly use a function pointer/Functor instead of a C string "quit".
| # NEW: where your psmove landed | ||
| INCLUDEPATH += /usr/local/include | ||
| # Sometimes headers live in a nested folder, add this too if needed: | ||
| INCLUDEPATH += /usr/local/include/psmoveapi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is a good idea, we have the headers above and link against a local build. The headers in /usr/local might very well be a different version. Remove this...
| CONFIG += link_pkgconfig | ||
| PKGCONFIG += opencv4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This currently isn't used by the code, so can be commented out by default?
No description provided.