mirror of
https://github.com/leozide/leocad
synced 2024-12-27 21:58:37 +01:00
Use events for view focus changes.
This commit is contained in:
parent
e28b7d29e5
commit
c2d1b5ce7c
6 changed files with 13 additions and 10 deletions
|
@ -55,7 +55,11 @@ lcModel* lcGLWidget::GetActiveModel() const
|
|||
void lcGLWidget::SetFocus(bool Focus)
|
||||
{
|
||||
if (Focus)
|
||||
{
|
||||
mLastFocusedView = this;
|
||||
|
||||
emit FocusReceived();
|
||||
}
|
||||
}
|
||||
|
||||
void lcGLWidget::SetMousePosition(int MouseX, int MouseY)
|
||||
|
|
|
@ -196,6 +196,7 @@ public:
|
|||
lcContext* mContext = nullptr;
|
||||
|
||||
signals:
|
||||
void FocusReceived();
|
||||
void CameraChanged();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -773,6 +773,7 @@ View* lcMainWindow::CreateView(lcModel* Model)
|
|||
View* NewView = new View(Model);
|
||||
|
||||
connect(NewView, SIGNAL(CameraChanged()), this, SLOT(ViewCameraChanged()));
|
||||
connect(NewView, SIGNAL(FocusReceived()), this, SLOT(ViewFocusReceived()));
|
||||
|
||||
return NewView;
|
||||
}
|
||||
|
@ -2146,6 +2147,11 @@ void lcMainWindow::UpdateUndoRedo(const QString& UndoText, const QString& RedoTe
|
|||
}
|
||||
}
|
||||
|
||||
void lcMainWindow::ViewFocusReceived()
|
||||
{
|
||||
SetActiveView(dynamic_cast<View*>(sender()));
|
||||
}
|
||||
|
||||
void lcMainWindow::ViewCameraChanged()
|
||||
{
|
||||
lcGLWidget* View = dynamic_cast<lcGLWidget*>(sender());
|
||||
|
|
|
@ -285,7 +285,6 @@ public:
|
|||
void ResetCameras();
|
||||
void AddView(View* View);
|
||||
void RemoveView(View* View);
|
||||
void SetActiveView(View* ActiveView);
|
||||
|
||||
void SetTool(lcTool Tool);
|
||||
void SetTransformType(lcTransformType TransformType);
|
||||
|
@ -360,6 +359,7 @@ public slots:
|
|||
void TogglePreviewWidget(bool);
|
||||
|
||||
protected slots:
|
||||
void ViewFocusReceived();
|
||||
void ViewCameraChanged();
|
||||
void UpdateDockWidgetActions();
|
||||
void UpdateGamepads();
|
||||
|
@ -384,6 +384,7 @@ protected:
|
|||
void CreateToolBars();
|
||||
void CreateStatusBar();
|
||||
View* CreateView(lcModel* Model);
|
||||
void SetActiveView(View* ActiveView);
|
||||
void ToggleDockWidget(QWidget* DockWidget);
|
||||
void SplitView(Qt::Orientation Orientation);
|
||||
void ShowSearchDialog();
|
||||
|
|
|
@ -2425,8 +2425,6 @@ void View::OnLeftButtonDown()
|
|||
return;
|
||||
}
|
||||
|
||||
gMainWindow->SetActiveView(this);
|
||||
|
||||
if (mViewSphere.OnLeftButtonDown())
|
||||
return;
|
||||
|
||||
|
@ -2451,8 +2449,6 @@ void View::OnLeftButtonUp()
|
|||
|
||||
void View::OnLeftButtonDoubleClick()
|
||||
{
|
||||
gMainWindow->SetActiveView(this);
|
||||
|
||||
lcObjectSection ObjectSection = FindObjectUnderPointer(false, false);
|
||||
lcModel* ActiveModel = GetActiveModel();
|
||||
|
||||
|
@ -2472,7 +2468,6 @@ void View::OnMiddleButtonDown()
|
|||
return;
|
||||
}
|
||||
|
||||
gMainWindow->SetActiveView(this);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
||||
lcTrackTool OverrideTool = GetOverrideTrackTool(Qt::MiddleButton);
|
||||
|
||||
|
@ -2498,8 +2493,6 @@ void View::OnRightButtonDown()
|
|||
return;
|
||||
}
|
||||
|
||||
gMainWindow->SetActiveView(this);
|
||||
|
||||
lcTrackTool OverrideTool = GetOverrideTrackTool(Qt::RightButton);
|
||||
|
||||
if (OverrideTool != lcTrackTool::None)
|
||||
|
|
|
@ -13,9 +13,7 @@ public:
|
|||
~View();
|
||||
|
||||
View(const View&) = delete;
|
||||
View(View&&) = delete;
|
||||
View& operator=(const View&) = delete;
|
||||
View& operator=(View&&) = delete;
|
||||
|
||||
void Clear()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue