[TD]Navigation Styles - context menu handling & std cursors

This commit is contained in:
Wanderer Fan
2022-06-26 15:03:38 -04:00
committed by WandererFan
parent 60b79e0d72
commit 203b9bb26c
25 changed files with 588 additions and 251 deletions

View File

@@ -34,7 +34,8 @@ using namespace TechDrawGui;
namespace TechDrawGui {
QGVNavStyleGesture::QGVNavStyleGesture()
QGVNavStyleGesture::QGVNavStyleGesture(QGVPage* qgvp) :
QGVNavStyle(qgvp)
{
}
@@ -45,10 +46,8 @@ QGVNavStyleGesture::~QGVNavStyleGesture()
void QGVNavStyleGesture::handleMousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::RightButton) {
startPan(event->pos());
event->accept();
startClick(Qt::RightButton);
}
}
void QGVNavStyleGesture::handleMouseMoveEvent(QMouseEvent *event)
@@ -57,8 +56,19 @@ void QGVNavStyleGesture::handleMouseMoveEvent(QMouseEvent *event)
getViewer()->setBalloonCursorPos(event->pos());
}
if (panningActive) {
pan(event->pos());
//if the mouse moves between press and release, then it isn't a click
if (m_clickPending) {
stopClick();
return;
}
if (QGuiApplication::mouseButtons() & Qt::RightButton) {
//pan mode 1 - RMB + move
if (panningActive) {
pan(event->pos());
} else {
startPan(event->pos());
}
event->accept();
}
}
@@ -69,10 +79,28 @@ void QGVNavStyleGesture::handleMouseReleaseEvent(QMouseEvent *event)
placeBalloon(event->pos());
}
if ((event->button() == Qt::RightButton) &&
m_clickPending &&
(m_clickButton == Qt::RightButton)) {
stopClick();
pseudoContextEvent();
event->accept();
return;
}
if (event->button() == Qt::RightButton) {
stopPan();
event->accept();
}
}
//RMB for pan conflicts with RMB for context menu
bool QGVNavStyleGesture::allowContextMenu(QContextMenuEvent *event)
{
if (event->reason() == QContextMenuEvent::Mouse) {
return false;
}
return true;
}
} // namespace TechDrawGui