mirror of
https://github.com/leozide/leocad
synced 2025-02-07 08:45:49 +01:00
Always keep 1 context valid.
This commit is contained in:
parent
6cc91c0f20
commit
80adb54acf
2 changed files with 7 additions and 5 deletions
|
@ -83,9 +83,6 @@ void lcModelTabWidget::Clear()
|
||||||
View->Clear();
|
View->Clear();
|
||||||
mViews.RemoveAll();
|
mViews.RemoveAll();
|
||||||
mActiveView = nullptr;
|
mActiveView = nullptr;
|
||||||
lcViewWidget* Widget = (lcViewWidget*)layout()->itemAt(0)->widget();
|
|
||||||
delete Widget->GetView();
|
|
||||||
Widget->SetView(nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lcMainWindow::lcMainWindow()
|
lcMainWindow::lcMainWindow()
|
||||||
|
|
|
@ -51,12 +51,14 @@ QSize lcViewWidget::sizeHint() const
|
||||||
|
|
||||||
void lcViewWidget::SetView(lcView* View)
|
void lcViewWidget::SetView(lcView* View)
|
||||||
{
|
{
|
||||||
mView = View;
|
|
||||||
|
|
||||||
if (View)
|
if (View)
|
||||||
{
|
{
|
||||||
if (context())
|
if (context())
|
||||||
|
{
|
||||||
|
makeCurrent();
|
||||||
View->mContext->SetGLContext(context());
|
View->mContext->SetGLContext(context());
|
||||||
|
}
|
||||||
|
|
||||||
View->SetWidget(this);
|
View->SetWidget(this);
|
||||||
const float Scale = GetDeviceScale();
|
const float Scale = GetDeviceScale();
|
||||||
View->SetSize(width() * Scale, height() * Scale);
|
View->SetSize(width() * Scale, height() * Scale);
|
||||||
|
@ -64,6 +66,9 @@ void lcViewWidget::SetView(lcView* View)
|
||||||
if (hasFocus())
|
if (hasFocus())
|
||||||
View->SetFocus(true);
|
View->SetFocus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete mView;
|
||||||
|
mView = View;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcViewWidget::SetPreviewPosition(const QRect& ParentRect)
|
void lcViewWidget::SetPreviewPosition(const QRect& ParentRect)
|
||||||
|
|
Loading…
Add table
Reference in a new issue