Skip to content

Commit

Permalink
Added function setupDefaultCursors() to allow users with a custom nav…
Browse files Browse the repository at this point in the history
…igation file to set default cursors quickly
  • Loading branch information
githubuser0xFFFF authored and VolkerEnderlein committed Apr 25, 2024
1 parent f0b59a5 commit 84b21c5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
1 change: 1 addition & 0 deletions include/Quarter/QuarterWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class QUARTER_DLL_API QuarterWidget : public QUARTER_GL_WIDGET {
void resetNavigationModeFile(void);
void setNavigationModeFile(const QUrl & url = QUrl(DEFAULT_NAVIGATIONFILE));
const QUrl & navigationModeFile(void) const;
void setupDefaultCursors();

void setContextMenuEnabled(bool yes);
bool contextMenuEnabled(void) const;
Expand Down
29 changes: 19 additions & 10 deletions src/Quarter/QuarterWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,24 @@ QuarterWidget::resetNavigationModeFile(void) {
this->setNavigationModeFile(QUrl());
}


/**
* Sets up the default cursors for the widget.
*/
void QuarterWidget::setupDefaultCursors()
{
this->setStateCursor("interact", Qt::ArrowCursor);
this->setStateCursor("idle", Qt::OpenHandCursor);
#if QT_VERSION >= 0x040200
this->setStateCursor("rotate", Qt::ClosedHandCursor);
#endif
this->setStateCursor("pan", Qt::SizeAllCursor);
this->setStateCursor("zoom", Qt::SizeVerCursor);
this->setStateCursor("dolly", Qt::SizeVerCursor);
this->setStateCursor("seek", Qt::CrossCursor);
this->setStateCursor("spin", Qt::OpenHandCursor);
}

/*!
Sets a navigation mode file. Supports the schemes "coin" and "file"
Expand Down Expand Up @@ -1084,16 +1102,7 @@ QuarterWidget::setNavigationModeFile(const QUrl & url)
// set up default cursors for the examiner navigation states
//FIXME: It may be overly restrictive to not do this for arbitrary
//navigation systems? - BFG 20090117
this->setStateCursor("interact", Qt::ArrowCursor);
this->setStateCursor("idle", Qt::OpenHandCursor);
#if QT_VERSION >= 0x040200
this->setStateCursor("rotate", Qt::ClosedHandCursor);
#endif
this->setStateCursor("pan", Qt::SizeAllCursor);
this->setStateCursor("zoom", Qt::SizeVerCursor);
this->setStateCursor("dolly", Qt::SizeVerCursor);
this->setStateCursor("seek", Qt::CrossCursor);
this->setStateCursor("spin", Qt::OpenHandCursor);
setupDefaultCursors();
}
}

Expand Down

0 comments on commit 84b21c5

Please sign in to comment.