+ fix issue with cursor on viewer widget, prepare code for improved event handling

This commit is contained in:
wmayer
2016-03-28 00:55:37 +02:00
parent d43443a832
commit fa77887d09
3 changed files with 70 additions and 19 deletions

View File

@@ -2530,10 +2530,17 @@ void View3DInventorViewer::setCursorRepresentation(int modearg)
// won't be changed as long as the user doesn't leave and enter
// the canvas. To fix this we explicitly set Qt::WA_UnderMouse
// if the mouse is inside the canvas.
QWidget* w = this->getGLWidget();
QWidget* glWindow = this->getGLWidget();
if (w && w->rect().contains(QCursor::pos()))
w->setAttribute(Qt::WA_UnderMouse);
// When a widget is added to the QGraphicsScene and the user
// hovered over it the 'WA_SetCursor' attribute is set to the
// GL widget but never reset and thus would cause that the
// cursor on this widget won't be set.
if (glWindow)
glWindow->setAttribute(Qt::WA_SetCursor, false);
if (glWindow && glWindow->rect().contains(QCursor::pos()))
glWindow->setAttribute(Qt::WA_UnderMouse);
switch (modearg) {
case NavigationStyle::IDLE: