Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Frédéric Larue
CommonGUI
Commits
1d1ca3cf
Commit
1d1ca3cf
authored
Feb 28, 2019
by
Frédéric Larue
Browse files
Selection tool displayed only when cursor is inside the GLViewer widget.
parent
f26f5e43
Changes
2
Hide whitespace changes
Inline
Side-by-side
GLViewer/GLViewer.cpp
View file @
1d1ca3cf
...
...
@@ -1019,7 +1019,7 @@ void GLViewer::paintGL()
}
// Display the selection tool, if selection mode is enabled.
if
(
isSelectionEnabled
()
)
if
(
isSelectionEnabled
()
&&
m_IsCursorInside
)
{
m_SelectionCurrentTool
->
displaySelectionState
();
m_SelectionCurrentTool
->
display
();
...
...
@@ -1577,10 +1577,20 @@ bool GLViewer::imageOfCurrentDisplay( const GenericUIData *m, QImage &renderResu
void
GLViewer
::
enterEvent
(
QEvent
*
evt
)
{
setFocus
();
m_IsCursorInside
=
true
;
update
();
QOpenGLWidget
::
enterEvent
(
evt
);
}
void
GLViewer
::
leaveEvent
(
QEvent
*
evt
)
{
m_IsCursorInside
=
false
;
update
();
QOpenGLWidget
::
leaveEvent
(
evt
);
}
void
GLViewer
::
mousePressEvent
(
QMouseEvent
*
evt
)
{
if
(
dof
()
==
DISPLAY_DOF_2D
)
...
...
GLViewer/GLViewer.h
View file @
1d1ca3cf
...
...
@@ -177,6 +177,8 @@ protected:
bool
m_IsSelectionAllowed
;
bool
m_IsCursorInside
;
/*****************************\
| Constructor(s) / destructor |
\*****************************/
...
...
@@ -197,6 +199,7 @@ protected:
void
initMetricGrids
();
virtual
void
enterEvent
(
QEvent
*
evt
);
virtual
void
leaveEvent
(
QEvent
*
evt
);
virtual
void
mousePressEvent
(
QMouseEvent
*
evt
);
virtual
void
mouseReleaseEvent
(
QMouseEvent
*
evt
);
virtual
void
mouseMoveEvent
(
QMouseEvent
*
evt
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment