Brève interruption de service ce midi pour augmentation de la mémoire 🤞

Commit 4a558998 authored by Frédéric Larue's avatar Frédéric Larue

Bug fixed in the reinitialization of the GLViewer when a project is...

Bug fixed in the reinitialization of the GLViewer when a project is created/opened or when the last project has been closed.
parent 86f0713f
...@@ -221,6 +221,12 @@ void UIMainWindow::init() ...@@ -221,6 +221,12 @@ void UIMainWindow::init()
initializeCentralWidgetStack(); initializeCentralWidgetStack();
setViewerMode( DISPLAY_DOF_3D ); setViewerMode( DISPLAY_DOF_3D );
//QGroupBox *groupBox = new QGroupBox("plop");
//groupBox->setLayout( new QHBoxLayout() );
//groupBox->layout()->addWidget( new QPushButton("yop") );
//groupBox->layout()->addWidget( new QPushButton("zap") );
//ui->toolBar->addWidget( groupBox );
ui->comboProject->setContextMenuPolicy( Qt::CustomContextMenu ); ui->comboProject->setContextMenuPolicy( Qt::CustomContextMenu );
connect( ui->comboProject, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showProjectContextMenu(QPoint)) ); connect( ui->comboProject, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showProjectContextMenu(QPoint)) );
connect( ui->comboProject, SIGNAL(currentIndexChanged(int)), this, SLOT(currentProjectChanged()) ); connect( ui->comboProject, SIGNAL(currentIndexChanged(int)), this, SLOT(currentProjectChanged()) );
...@@ -499,7 +505,7 @@ void UIMainWindow::newProject() ...@@ -499,7 +505,7 @@ void UIMainWindow::newProject()
ui->comboProject->addItem( pHndl->project->Name(), QVariant::fromValue<void*>(pHndl) ); ui->comboProject->addItem( pHndl->project->Name(), QVariant::fromValue<void*>(pHndl) );
ui->comboProject->setCurrentIndex( ui->comboProject->count()-1 ); ui->comboProject->setCurrentIndex( ui->comboProject->count()-1 );
m_CurrentViewer->init( DISPLAY_DOF_3D ); setViewerMode( DISPLAY_DOF_3D, true );
} }
} }
...@@ -642,7 +648,7 @@ bool UIMainWindow::closeCurrentProject() ...@@ -642,7 +648,7 @@ bool UIMainWindow::closeCurrentProject()
// Last project closed? Restore the default application view mode. // Last project closed? Restore the default application view mode.
if( !m_CurrentProject ) if( !m_CurrentProject )
m_CurrentViewer->init( DISPLAY_DOF_3D ); setViewerMode( DISPLAY_DOF_3D, true );
} }
return true; return true;
...@@ -1367,7 +1373,7 @@ void UIMainWindow::popCentralWidget() ...@@ -1367,7 +1373,7 @@ void UIMainWindow::popCentralWidget()
} }
void UIMainWindow::setViewerMode( DisplayDoF mode ) void UIMainWindow::setViewerMode( DisplayDoF mode, bool forceReinitialization )
{ {
if( !m_CurrentViewer ) if( !m_CurrentViewer )
{ {
...@@ -1393,7 +1399,7 @@ void UIMainWindow::setViewerMode( DisplayDoF mode ) ...@@ -1393,7 +1399,7 @@ void UIMainWindow::setViewerMode( DisplayDoF mode )
// m_CurrentViewer->show(); // m_CurrentViewer->show();
//} //}
if( m_CurrentViewer->dof() == mode ) if( m_CurrentViewer->dof() == mode && !forceReinitialization )
return; return;
m_CurrentViewer->removeAllDisplayables(); m_CurrentViewer->removeAllDisplayables();
...@@ -2048,7 +2054,7 @@ bool UIMainWindow::loadProject( const QString& filename ) ...@@ -2048,7 +2054,7 @@ bool UIMainWindow::loadProject( const QString& filename )
updateCurrentProjectContent(); updateCurrentProjectContent();
updateRecentListEntry( filename ); updateRecentListEntry( filename );
m_CurrentViewer->init( DISPLAY_DOF_3D ); setViewerMode( DISPLAY_DOF_3D, true );
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
return true; return true;
......
...@@ -88,7 +88,7 @@ public: ...@@ -88,7 +88,7 @@ public:
UIMainWindow( QWidget *parent = NULL ); UIMainWindow( QWidget *parent = NULL );
~UIMainWindow(); ~UIMainWindow();
void setViewerMode( DisplayDoF mode ); void setViewerMode( DisplayDoF mode, bool forceReinitialization = false );
inline GLViewer* getCurrentViewer() const { return m_CurrentViewer; } inline GLViewer* getCurrentViewer() const { return m_CurrentViewer; }
UIProject* getCurrentProject() const; UIProject* getCurrentProject() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment