0001087: Inventor Navigation continues with released Mouse Button

This commit is contained in:
wmayer 2013-04-27 22:10:59 +02:00
parent 9f0b1ac66e
commit 859cf78dba
5 changed files with 13 additions and 2 deletions

View File

@ -1437,10 +1437,16 @@ void StdCmdToggleNavigation::activated(int iMsg)
bool StdCmdToggleNavigation::isActive(void)
{
//#0001087: Inventor Navigation continues with released Mouse Button
//This happens because 'Esc' is also used to close the task dialog.
//Add also new method 'isRedirectToSceneGraphEnabled' to explicitly
//check if this is allowed.
if (Gui::Control().activeDialog())
return false;
Gui::MDIView* view = Gui::getMainWindow()->activeWindow();
if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) {
Gui::View3DInventorViewer* viewer = static_cast<Gui::View3DInventor*>(view)->getViewer();
return viewer->isEditing();
return viewer->isEditing() && viewer->isRedirectToSceneGraphEnabled();
}
return false;
}

View File

@ -138,7 +138,7 @@ SOQT_OBJECT_ABSTRACT_SOURCE(View3DInventorViewer);
View3DInventorViewer::View3DInventorViewer (QWidget *parent, const char *name,
SbBool embed, Type type, SbBool build)
: inherited (parent, name, embed, type, build), editViewProvider(0),navigation(0),
editing(FALSE), redirected(FALSE)
editing(FALSE), redirected(FALSE), allowredir(FALSE)
{
Gui::Selection().Attach(this);

View File

@ -182,6 +182,8 @@ public:
void setEditingCursor (const QCursor& cursor);
void setRedirectToSceneGraph(SbBool redirect) { this->redirected = redirect; }
SbBool isRedirectedToSceneGraph() const { return this->redirected; }
void setRedirectToSceneGraphEnabled(SbBool enable) { this->allowredir = enable; }
SbBool isRedirectToSceneGraphEnabled(void) const { return this->allowredir; }
//@}
/** @name Pick actions */
@ -311,6 +313,7 @@ private:
SbBool editing;
QCursor editCursor;
SbBool redirected;
SbBool allowredir;
void setCursorRepresentation(int mode);

View File

@ -87,6 +87,7 @@ void CmdInspectElement::activated(int iMsg)
if (view) {
Gui::View3DInventorViewer* viewer = view->getViewer();
viewer->setEditing(true);
viewer->setRedirectToSceneGraphEnabled(true);
viewer->setRedirectToSceneGraph(true);
viewer->setEditingCursor(QCursor(Gui::BitmapFactory().pixmap("mesh_pipette"),4,29));
viewer->addEventCallback(SoButtonEvent::getClassTypeId(),

View File

@ -436,6 +436,7 @@ void ViewProviderInspection::inspectCallback(void * ud, SoEventCallback * n)
view->setEditing(false);
view->getWidget()->setCursor(QCursor(Qt::ArrowCursor));
view->setRedirectToSceneGraph(false);
view->setRedirectToSceneGraphEnabled(false);
view->removeEventCallback(SoButtonEvent::getClassTypeId(), inspectCallback);
}
}