mirror of
https://github.com/leozide/leocad
synced 2025-01-30 20:34:56 +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();
|
||||
mViews.RemoveAll();
|
||||
mActiveView = nullptr;
|
||||
lcViewWidget* Widget = (lcViewWidget*)layout()->itemAt(0)->widget();
|
||||
delete Widget->GetView();
|
||||
Widget->SetView(nullptr);
|
||||
}
|
||||
|
||||
lcMainWindow::lcMainWindow()
|
||||
|
|
|
@ -51,12 +51,14 @@ QSize lcViewWidget::sizeHint() const
|
|||
|
||||
void lcViewWidget::SetView(lcView* View)
|
||||
{
|
||||
mView = View;
|
||||
|
||||
if (View)
|
||||
{
|
||||
if (context())
|
||||
{
|
||||
makeCurrent();
|
||||
View->mContext->SetGLContext(context());
|
||||
}
|
||||
|
||||
View->SetWidget(this);
|
||||
const float Scale = GetDeviceScale();
|
||||
View->SetSize(width() * Scale, height() * Scale);
|
||||
|
@ -64,6 +66,9 @@ void lcViewWidget::SetView(lcView* View)
|
|||
if (hasFocus())
|
||||
View->SetFocus(true);
|
||||
}
|
||||
|
||||
delete mView;
|
||||
mView = View;
|
||||
}
|
||||
|
||||
void lcViewWidget::SetPreviewPosition(const QRect& ParentRect)
|
||||
|
|
Loading…
Add table
Reference in a new issue