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 8ee67bea authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Stack mechanism added to UIMainWindow in order to change its central widget by...

Stack mechanism added to UIMainWindow in order to change its central widget by saving and restoring the previous one.
parent 5dd5dd29
......@@ -174,8 +174,8 @@ void UIMainWindow::init()
connect( ui->tableCurrentProjContent, SIGNAL(askForReframing()), this, SLOT(reframeScene()) );
connect( ui->tableCurrentProjContent, SIGNAL(exportLaunched(ExportInterface*,int,QString)), this, SLOT(launchExport(ExportInterface*,int,QString)) );
setViewerMode( DISPLAY_DOF_3D );
initializeCentralWidgetStack();
setViewerMode( DISPLAY_DOF_3D );
connect( ui->actionLoadImage, SIGNAL(triggered()), this, SLOT(addToCurrentProject()) );
connect( ui->actionNewProject, SIGNAL(triggered()), this, SLOT(newProject()) );
......@@ -1000,6 +1000,41 @@ void UIMainWindow::saveCurrentProject()
}
void UIMainWindow::initializeCentralWidgetStack()
{
QWidget *w = new QWidget();
w->setLayout( new QVBoxLayout() );
w->layout()->setContentsMargins( 0, 0, 0, 0 );
w->layout()->setSpacing( 0 );
setCentralWidget( w );
}
void UIMainWindow::pushCentralWidget( QWidget* widget )
{
if( !m_CentralWidgetStack.isEmpty() )
m_CentralWidgetStack.last()->hide();
m_CentralWidgetStack.append( widget );
centralWidget()->layout()->addWidget( widget );
widget->show();
}
void UIMainWindow::popCentralWidget()
{
QWidget *widget = m_CentralWidgetStack.takeLast();
widget->hide();
if( !m_CentralWidgetStack.isEmpty() )
m_CentralWidgetStack.last()->show();
centralWidget()->layout()->removeWidget( widget );
widget->deleteLater();
}
void UIMainWindow::setViewerMode( DisplayDoF mode )
{
if( !m_CurrentViewer )
......@@ -1008,9 +1043,7 @@ void UIMainWindow::setViewerMode( DisplayDoF mode )
m_CurrentViewer = new GLViewer( mode );
m_CurrentViewer->setUpdateBehavior( QOpenGLWidget::NoPartialUpdate );
setCentralWidget( m_CurrentViewer );
m_CurrentViewer->show();
pushCentralWidget( m_CurrentViewer );
// Update UI consequently.
......@@ -1021,11 +1054,11 @@ void UIMainWindow::setViewerMode( DisplayDoF mode )
{
// If the viewer is created but not set to the central widget, it means that the graph editor is currently running.
// In that case, restore the OpenGL viewer.
if( centralWidget() != m_CurrentViewer )
{
setCentralWidget( m_CurrentViewer );
m_CurrentViewer->show();
}
//if( centralWidget() != m_CurrentViewer )
//{
// setCentralWidget( m_CurrentViewer );
// m_CurrentViewer->show();
//}
if( m_CurrentViewer->dof() == mode )
return;
......
......@@ -75,6 +75,8 @@ class GUIMAIN_API UIMainWindow : public QMainWindow
static const int RECENT_PROJECT_MAX_LIST_SIZE = 8;
QList< QAction* > m_RecentProjects;
QList< QWidget* > m_CentralWidgetStack;
public:
UIMainWindow(QWidget *parent = 0);
~UIMainWindow();
......@@ -123,10 +125,12 @@ private:
bool loadUISettings();
void updateRecentListEntry( const QString& path );
inline void setCentralWidget( QWidget *widget ) { QMainWindow::setCentralWidget(widget); }
void initializeCentralWidgetStack();
private slots:
void loadRecent();
void keyPressedInGLViewer( QKeyEvent *evt ) { additionalGLViewerHotkeys( evt ); }
void keyPressedInGLViewer( QKeyEvent *evt ) { additionalGLViewerHotkeys( evt ); }
void customMenuActionTriggered();
void selectionChanged();
......@@ -164,8 +168,11 @@ public slots:
void execExportAction();
void reframeScene();
void tableItemsContentDropped(QDropEvent* evt);
void tableItemsContentDropped(QDropEvent* evt);
void projectListContentDropped(QDropEvent* evt);
void pushCentralWidget( QWidget* widget );
void popCentralWidget();
};
......
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