Sketcher: Encapsulate function to ensure MDI focus
This commit is contained in:
committed by
abdullahtahiriyo
parent
247afe2a99
commit
2f40dd34c8
@@ -25,7 +25,6 @@
|
||||
|
||||
#include <Base/Tools2D.h>
|
||||
#include <Gui/EditableDatumLabel.h>
|
||||
#include <Gui/MDIView.h>
|
||||
|
||||
#include "DrawSketchDefaultHandler.h"
|
||||
#include "SketcherToolDefaultWidget.h"
|
||||
@@ -280,8 +279,7 @@ public:
|
||||
void resetControls()
|
||||
{
|
||||
// Make sure we do not loose focus if next methode does not have OVP that take focus.
|
||||
Gui::MDIView* mdi = Gui::Application::Instance->activeDocument()->getActiveView();
|
||||
mdi->setFocus();
|
||||
handler->ensureFocus();
|
||||
|
||||
doResetControls(); // NVI
|
||||
|
||||
|
||||
@@ -111,6 +111,11 @@ ViewProviderSketchDrawSketchHandlerAttorney::moveCursorToSketchPoint(ViewProvide
|
||||
vp.moveCursorToSketchPoint(point);
|
||||
}
|
||||
|
||||
inline void ViewProviderSketchDrawSketchHandlerAttorney::ensureFocus(ViewProviderSketch& vp)
|
||||
{
|
||||
vp.ensureFocus();
|
||||
}
|
||||
|
||||
inline void ViewProviderSketchDrawSketchHandlerAttorney::preselectAtPoint(ViewProviderSketch& vp,
|
||||
Base::Vector2d point)
|
||||
{
|
||||
@@ -1189,6 +1194,11 @@ void DrawSketchHandler::moveCursorToSketchPoint(Base::Vector2d point)
|
||||
ViewProviderSketchDrawSketchHandlerAttorney::moveCursorToSketchPoint(*sketchgui, point);
|
||||
}
|
||||
|
||||
void DrawSketchHandler::ensureFocus()
|
||||
{
|
||||
ViewProviderSketchDrawSketchHandlerAttorney::ensureFocus(*sketchgui);
|
||||
}
|
||||
|
||||
void DrawSketchHandler::preselectAtPoint(Base::Vector2d point)
|
||||
{
|
||||
ViewProviderSketchDrawSketchHandlerAttorney::preselectAtPoint(*sketchgui, point);
|
||||
|
||||
@@ -104,6 +104,7 @@ private:
|
||||
unsigned int augmentationlevel = 0);
|
||||
static inline void setAxisPickStyle(ViewProviderSketch& vp, bool on);
|
||||
static inline void moveCursorToSketchPoint(ViewProviderSketch& vp, Base::Vector2d point);
|
||||
static inline void ensureFocus(ViewProviderSketch& vp);
|
||||
static inline void preselectAtPoint(ViewProviderSketch& vp, Base::Vector2d point);
|
||||
static inline void setAngleSnapping(ViewProviderSketch& vp,
|
||||
bool enable,
|
||||
@@ -276,6 +277,7 @@ protected:
|
||||
|
||||
void setAxisPickStyle(bool on);
|
||||
void moveCursorToSketchPoint(Base::Vector2d point);
|
||||
void ensureFocus();
|
||||
void preselectAtPoint(Base::Vector2d point);
|
||||
|
||||
void drawPositionAtCursor(const Base::Vector2d& position);
|
||||
|
||||
@@ -657,6 +657,13 @@ void ViewProviderSketch::moveCursorToSketchPoint(Base::Vector2d point)
|
||||
QCursor::setPos(newPos);
|
||||
}
|
||||
|
||||
void ViewProviderSketch::ensureFocus()
|
||||
{
|
||||
|
||||
Gui::MDIView* mdi = Gui::Application::Instance->activeDocument()->getActiveView();
|
||||
mdi->setFocus();
|
||||
}
|
||||
|
||||
void ViewProviderSketch::preselectAtPoint(Base::Vector2d point)
|
||||
{
|
||||
if (Mode != STATUS_SELECT_Point && Mode != STATUS_SELECT_Edge
|
||||
|
||||
@@ -876,6 +876,7 @@ private:
|
||||
void setAxisPickStyle(bool on);
|
||||
|
||||
void moveCursorToSketchPoint(Base::Vector2d point);
|
||||
void ensureFocus();
|
||||
|
||||
void preselectAtPoint(Base::Vector2d point);
|
||||
//@}
|
||||
|
||||
Reference in New Issue
Block a user