[TD]Navigation Styles - context menu handling & std cursors
This commit is contained in:
committed by
WandererFan
parent
60b79e0d72
commit
203b9bb26c
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user