Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 85f8cc05 authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Bug related to the conflict between the deletions of UIData and GLViewer...

Bug related to the conflict between the deletions of UIData and GLViewer solved by the mean of Qt signal/slot mechanism.
parent d03bf3aa
......@@ -127,13 +127,7 @@ GLViewer::GLViewer( DisplayDoF dof,
GLViewer::~GLViewer()
{
// Avoid the destruction of UIParamSet objects.
for( auto m : m_Displayables )
if( m.first->GetDisplayOptions() )
{
m_DisplayOptionsLayout->removeWidget( m.first->GetDisplayOptions() );
m.first->GetDisplayOptions()->setParent( NULL );
}
removeAllDisplayables();
for( std::vector<SelectionTool*>::iterator tool=m_SelectionTools.begin(); tool!=m_SelectionTools.end(); ++tool )
delete *tool;
......@@ -679,6 +673,7 @@ GLViewer::DisplayableMap::iterator GLViewer::removeDisplayable_Internal( Display
{
item->GetDisplayOptions()->hide();
m_DisplayOptionsLayout->removeWidget( item->GetDisplayOptions() );
item->GetDisplayOptions()->setParent( NULL );
}
for( auto mngr : dinfo.selectionMgr )
......
......@@ -301,9 +301,6 @@ public:
void populateDisplayerFactories( DisplayableFactoryInterface *plugin );
void populateDisplayerFactories( QList<DisplayableFactoryInterface*> &plugins );
virtual bool addDisplayable( GenericUIData *m );
virtual void removeDisplayable( GenericUIData *m );
virtual void removeAllDisplayables();
inline bool isDisplayed( GenericUIData *m ) const { return m_Displayables.find(m) != m_Displayables.end(); }
inline bool isAbleToDisplay( GenericUIData *m ) const { return m_Factories.find(m->GetTypeString()) != m_Factories.end(); }
inline DisplayableFactoryInterface* getFactory( const QString &type ) { FactoryMap::iterator f=m_Factories.find(type); return f==m_Factories.end()? NULL : f->second; }
......@@ -360,6 +357,10 @@ signals:
| QT slot(s) |
\************/
public slots:
virtual bool addDisplayable( GenericUIData *m );
virtual void removeDisplayable( GenericUIData *m );
virtual void removeAllDisplayables();
void centerView();
void setSpeedFactor( const float speedFactor,
......
......@@ -224,8 +224,7 @@ void UIMainWindow::release()
{
saveUISettings();
if( m_CurrentViewer )
m_CurrentViewer->removeAllDisplayables();
releaseCentralWidgetStack();
closeAllProjects();
......@@ -617,7 +616,9 @@ bool UIMainWindow::closeCurrentProject()
if( !onClosingProject(m_CurrentProject->project) )
return false;
m_CurrentViewer->removeAllDisplayables();
for( auto d : m_CurrentProject->project->GetAll() )
emit aboutToDelete( d );
m_CurrentProject->project->RemoveAndDeleteAll();
delete m_CurrentProject->project;
delete m_CurrentProject; m_CurrentProject = NULL;
......@@ -946,7 +947,7 @@ void UIMainWindow::removeFromCurrentProject()
for( auto i=toRemove.begin(); i!=toRemove.end(); ++i )
{
m_CurrentViewer->removeDisplayable( *i );
emit aboutToDelete( *i );
getCurrentProject()->RemoveAndDelete( *i );
}
......@@ -1010,6 +1011,13 @@ void UIMainWindow::initializeCentralWidgetStack()
}
void UIMainWindow::releaseCentralWidgetStack()
{
while( !m_CentralWidgetStack.isEmpty() )
popCentralWidget();
}
void UIMainWindow::pushCentralWidget( QWidget* widget )
{
if( !m_CentralWidgetStack.isEmpty() )
......@@ -1031,7 +1039,8 @@ void UIMainWindow::popCentralWidget()
m_CentralWidgetStack.last()->show();
centralWidget()->layout()->removeWidget( widget );
widget->deleteLater();
widget->setParent( NULL );
delete widget;
}
......@@ -1049,6 +1058,7 @@ void UIMainWindow::setViewerMode( DisplayDoF mode )
connect( ui->actionIncreasePointSize, SIGNAL(triggered()), m_CurrentViewer, SLOT(increasePointSize()) );
connect( ui->actionDecreasePointSize, SIGNAL(triggered()), m_CurrentViewer, SLOT(decreasePointSize()) );
connect( this, SIGNAL(aboutToDelete(GenericUIData*)), m_CurrentViewer, SLOT(removeDisplayable(GenericUIData*)) );
}
else
{
......
......@@ -125,8 +125,13 @@ private:
bool loadUISettings();
void updateRecentListEntry( const QString& path );
inline void setCentralWidget( QWidget *widget ) { QMainWindow::setCentralWidget(widget); }
void initializeCentralWidgetStack();
void releaseCentralWidgetStack();
signals:
void aboutToDelete( GenericUIData *d );
private slots:
void loadRecent();
......
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