Commit 1d1ca3cf authored by Frédéric Larue's avatar Frédéric Larue

Selection tool displayed only when cursor is inside the GLViewer widget.

parent f26f5e43
......@@ -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 )
......
......@@ -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 );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment