Removed GetViews().

This commit is contained in:
Leonardo Zide 2021-02-27 11:32:52 -08:00
parent 95fbc13247
commit 4a77391c6b
3 changed files with 27 additions and 23 deletions

View file

@ -1654,10 +1654,10 @@ void lcMainWindow::ResetCameras()
if (!CurrentTab)
return;
const lcArray<lcView*>* Views = CurrentTab->GetViews();
const QList<lcViewWidget*> ViewWidgets = CurrentTab->findChildren<lcViewWidget*>();
for (int ViewIdx = 0; ViewIdx < Views->GetSize(); ViewIdx++)
(*Views)[ViewIdx]->SetDefaultCamera();
for (lcViewWidget* ViewWidget : ViewWidgets)
ViewWidget->GetView()->SetDefaultCamera();
lcGetActiveModel()->DeleteAllCameras();
}
@ -2590,6 +2590,23 @@ lcModel* lcMainWindow::GetActiveModel() const
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)
{
lcView* ActiveView = GetActiveView();

View file

@ -98,11 +98,6 @@ public:
mModel = Model;
}
const lcArray<lcView*>* GetViews() const
{
return &mViews;
}
protected:
lcModel* mModel;
lcView* mActiveView;
@ -196,6 +191,7 @@ public:
}
lcModel* GetActiveModel() const;
lcModelTabWidget* GetTabForView(lcView* View) const;
lcModel* GetCurrentTabModel() const
{
@ -203,20 +199,6 @@ public:
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
{
return mPartSelectionWidget;

View file

@ -40,7 +40,10 @@ lcView::lcView(lcViewType ViewType, lcModel* Model)
if (ActiveView)
SetCamera(ActiveView->mCamera, false);
else
SetDefaultCamera();
{
mCamera = new lcCamera(true);
mCamera->SetViewpoint(lcViewpoint::Home);
}
}
lcView::~lcView()
@ -2228,6 +2231,8 @@ void lcView::SetDefaultCamera()
mCamera = new lcCamera(true);
mCamera->SetViewpoint(lcViewpoint::Home);
ZoomExtents();
Redraw();
emit CameraChanged();
}