mirror of
https://github.com/leozide/leocad
synced 2024-12-27 21:58:37 +01:00
Removed GetViews().
This commit is contained in:
parent
95fbc13247
commit
4a77391c6b
3 changed files with 27 additions and 23 deletions
|
@ -1654,10 +1654,10 @@ void lcMainWindow::ResetCameras()
|
||||||
if (!CurrentTab)
|
if (!CurrentTab)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const lcArray<lcView*>* Views = CurrentTab->GetViews();
|
const QList<lcViewWidget*> ViewWidgets = CurrentTab->findChildren<lcViewWidget*>();
|
||||||
|
|
||||||
for (int ViewIdx = 0; ViewIdx < Views->GetSize(); ViewIdx++)
|
for (lcViewWidget* ViewWidget : ViewWidgets)
|
||||||
(*Views)[ViewIdx]->SetDefaultCamera();
|
ViewWidget->GetView()->SetDefaultCamera();
|
||||||
|
|
||||||
lcGetActiveModel()->DeleteAllCameras();
|
lcGetActiveModel()->DeleteAllCameras();
|
||||||
}
|
}
|
||||||
|
@ -2590,6 +2590,23 @@ lcModel* lcMainWindow::GetActiveModel() const
|
||||||
return ActiveView ? ActiveView->GetActiveModel() : nullptr;
|
return ActiveView ? ActiveView->GetActiveModel() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lcModelTabWidget* lcMainWindow::GetTabForView(lcView* View) const
|
||||||
|
{
|
||||||
|
QWidget* Widget = View->GetWidget();
|
||||||
|
|
||||||
|
while (Widget)
|
||||||
|
{
|
||||||
|
lcModelTabWidget* TabWidget = qobject_cast<lcModelTabWidget*>(Widget);
|
||||||
|
|
||||||
|
if (TabWidget)
|
||||||
|
return TabWidget;
|
||||||
|
else
|
||||||
|
Widget = Widget->parentWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void lcMainWindow::HandleCommand(lcCommandId CommandId)
|
void lcMainWindow::HandleCommand(lcCommandId CommandId)
|
||||||
{
|
{
|
||||||
lcView* ActiveView = GetActiveView();
|
lcView* ActiveView = GetActiveView();
|
||||||
|
|
|
@ -98,11 +98,6 @@ public:
|
||||||
mModel = Model;
|
mModel = Model;
|
||||||
}
|
}
|
||||||
|
|
||||||
const lcArray<lcView*>* GetViews() const
|
|
||||||
{
|
|
||||||
return &mViews;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
lcModel* mModel;
|
lcModel* mModel;
|
||||||
lcView* mActiveView;
|
lcView* mActiveView;
|
||||||
|
@ -196,6 +191,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
lcModel* GetActiveModel() const;
|
lcModel* GetActiveModel() const;
|
||||||
|
lcModelTabWidget* GetTabForView(lcView* View) const;
|
||||||
|
|
||||||
lcModel* GetCurrentTabModel() const
|
lcModel* GetCurrentTabModel() const
|
||||||
{
|
{
|
||||||
|
@ -203,20 +199,6 @@ public:
|
||||||
return CurrentTab ? CurrentTab->GetModel() : nullptr;
|
return CurrentTab ? CurrentTab->GetModel() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcModelTabWidget* GetTabForView(lcView* View) const
|
|
||||||
{
|
|
||||||
for (int TabIdx = 0; TabIdx < mModelTabWidget->count(); TabIdx++)
|
|
||||||
{
|
|
||||||
lcModelTabWidget* TabWidget = (lcModelTabWidget*)mModelTabWidget->widget(TabIdx);
|
|
||||||
|
|
||||||
const int ViewIndex = TabWidget->GetViews()->FindIndex(View);
|
|
||||||
if (ViewIndex != -1)
|
|
||||||
return TabWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
lcPartSelectionWidget* GetPartSelectionWidget() const
|
lcPartSelectionWidget* GetPartSelectionWidget() const
|
||||||
{
|
{
|
||||||
return mPartSelectionWidget;
|
return mPartSelectionWidget;
|
||||||
|
|
|
@ -40,7 +40,10 @@ lcView::lcView(lcViewType ViewType, lcModel* Model)
|
||||||
if (ActiveView)
|
if (ActiveView)
|
||||||
SetCamera(ActiveView->mCamera, false);
|
SetCamera(ActiveView->mCamera, false);
|
||||||
else
|
else
|
||||||
SetDefaultCamera();
|
{
|
||||||
|
mCamera = new lcCamera(true);
|
||||||
|
mCamera->SetViewpoint(lcViewpoint::Home);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lcView::~lcView()
|
lcView::~lcView()
|
||||||
|
@ -2228,6 +2231,8 @@ void lcView::SetDefaultCamera()
|
||||||
mCamera = new lcCamera(true);
|
mCamera = new lcCamera(true);
|
||||||
|
|
||||||
mCamera->SetViewpoint(lcViewpoint::Home);
|
mCamera->SetViewpoint(lcViewpoint::Home);
|
||||||
|
ZoomExtents();
|
||||||
|
Redraw();
|
||||||
|
|
||||||
emit CameraChanged();
|
emit CameraChanged();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue