mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-17 01:54:42 +00:00
- experimental version of the MainWindow class using a current multiviewer container member
This commit is contained in:
parent
17e416dc1f
commit
767da232da
@ -235,6 +235,7 @@ private slots:
|
||||
void sendHistory();
|
||||
///////////Solt Wrapper for QMdiArea //////////////////
|
||||
void wrapSetActiveSubWindow(QWidget* window);
|
||||
void switchCurrentContainer(QMdiSubWindow *);
|
||||
void scriptCodeExecuted(const QScriptValue& val,const int time,const QString& output);
|
||||
|
||||
void updateGPUMemBar(int,int);
|
||||
@ -329,26 +330,26 @@ public:
|
||||
}
|
||||
|
||||
MultiViewer_Container* currentViewContainer() const {
|
||||
/* MultiViewer_Container *mvc = dynamic_cast<MultiViewer_Container *>(mdiarea->currentSubWindow());
|
||||
if(mvc) return mvc;*/
|
||||
if(mdiarea->currentSubWindow()!=0 )
|
||||
{
|
||||
Splitter* split = reinterpret_cast<Splitter*>(mdiarea->currentSubWindow()->widget());
|
||||
if (split->isMultiViewerContainer())
|
||||
return reinterpret_cast<MultiViewer_Container*>(split);
|
||||
}
|
||||
/*QList<QMdiSubWindow *> subwinList=mdiarea->subWindowList();
|
||||
foreach(QMdiSubWindow *subwinPtr,subwinList)
|
||||
{
|
||||
MultiViewer_Container *mvc = dynamic_cast<MultiViewer_Container *>(subwinPtr);
|
||||
if(mvc) return mvc;
|
||||
if(mvc==0 && subwinPtr!=0){
|
||||
mvc = dynamic_cast<MultiViewer_Container *>(subwinPtr->widget());
|
||||
if(mvc) return mvc;
|
||||
}
|
||||
}*/
|
||||
// /* MultiViewer_Container *mvc = dynamic_cast<MultiViewer_Container *>(mdiarea->currentSubWindow());
|
||||
// if(mvc) return mvc;*/
|
||||
// if(mdiarea->currentSubWindow()!=0 )
|
||||
//{
|
||||
// Splitter* split = reinterpret_cast<Splitter*>(mdiarea->currentSubWindow()->widget());
|
||||
// if (split->isMultiViewerContainer())
|
||||
// return reinterpret_cast<MultiViewer_Container*>(split);
|
||||
// }
|
||||
// /*QList<QMdiSubWindow *> subwinList=mdiarea->subWindowList();
|
||||
// foreach(QMdiSubWindow *subwinPtr,subwinList)
|
||||
// {
|
||||
// MultiViewer_Container *mvc = dynamic_cast<MultiViewer_Container *>(subwinPtr);
|
||||
// if(mvc) return mvc;
|
||||
// if(mvc==0 && subwinPtr!=0){
|
||||
// mvc = dynamic_cast<MultiViewer_Container *>(subwinPtr->widget());
|
||||
// if(mvc) return mvc;
|
||||
// }
|
||||
// }*/
|
||||
|
||||
return 0;
|
||||
return _currviewcontainer;
|
||||
}
|
||||
|
||||
const PluginManager& pluginManager() const { return PM; }
|
||||
@ -512,6 +513,8 @@ private:
|
||||
QAction *checkUpdatesAct;
|
||||
////////////////////////////////////////////////////
|
||||
static QString getDecoratedFileName(const QString& name);
|
||||
|
||||
MultiViewer_Container* _currviewcontainer;
|
||||
};
|
||||
|
||||
/// Event filter that is installed to intercept the open events sent directly by the Operative System
|
||||
|
||||
@ -53,6 +53,7 @@ QProgressBar *MainWindow::qb;
|
||||
MainWindow::MainWindow()
|
||||
:mwsettings(), xmlfiltertimer(), wama(), gpumeminfo(NULL)
|
||||
{
|
||||
_currviewcontainer = NULL;
|
||||
//xmlfiltertimer will be called repeatedly, so like Qt documentation suggests, the first time start function should be called.
|
||||
//Subsequently restart function will be invoked.
|
||||
setContextMenuPolicy(Qt::NoContextMenu);
|
||||
@ -64,6 +65,7 @@ MainWindow::MainWindow()
|
||||
layerDialog = new LayerDialog(this);
|
||||
connect(layerDialog, SIGNAL(toBeShow()), this, SLOT(updateLayerDialog()));
|
||||
layerDialog->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
layerDialog->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
||||
addDockWidget(Qt::RightDockWidgetArea, layerDialog);
|
||||
|
||||
|
||||
@ -73,6 +75,7 @@ MainWindow::MainWindow()
|
||||
// Permette di passare da una finestra all'altra e tenere aggiornato il workspace
|
||||
connect(windowMapper, SIGNAL(mapped(QWidget*)), this, SLOT(wrapSetActiveSubWindow(QWidget *)));
|
||||
// Quando si passa da una finestra all'altra aggiorna lo stato delle toolbar e dei menu
|
||||
connect(mdiarea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(switchCurrentContainer(QMdiSubWindow *)));
|
||||
connect(mdiarea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(updateLayerDialog()));
|
||||
connect(mdiarea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(updateMenus()));
|
||||
connect(mdiarea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(updateWindowMenu()));
|
||||
|
||||
@ -331,6 +331,8 @@ void MainWindow::switchOffDecorator(QAction* decorator)
|
||||
|
||||
void MainWindow::updateLayerDialog()
|
||||
{
|
||||
if (meshDoc() == NULL)
|
||||
return;
|
||||
MultiViewer_Container* mvc = currentViewContainer();
|
||||
if (mvc == NULL)
|
||||
return;
|
||||
@ -349,19 +351,21 @@ void MainWindow::updateLayerDialog()
|
||||
layerDialog->updateLog(meshDoc()->Log);
|
||||
layerDialog->updateDecoratorParsView();
|
||||
MLRenderingData dt;
|
||||
if ((meshDoc()!=NULL) && (meshDoc()->mm() != NULL))
|
||||
if (meshDoc()->mm() != NULL)
|
||||
{
|
||||
MLSceneGLSharedDataContext::PerMeshRenderingDataMap::iterator it = dtf.find(meshDoc()->mm()->id());
|
||||
if (it != dtf.end())
|
||||
layerDialog->updateRenderingParametersTab(meshDoc()->mm()->id(),*it);
|
||||
}
|
||||
layerDialog->setMinimumSize(layerDialog->_tabw->size().width() + 10,layerDialog->minimumSize().height());
|
||||
layerDialog->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Minimum);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateMenus()
|
||||
{
|
||||
if (meshDoc() == NULL)
|
||||
return;
|
||||
|
||||
bool activeDoc = (bool) !mdiarea->subWindowList().empty() && mdiarea->currentSubWindow();
|
||||
bool notEmptyActiveDoc = activeDoc && !meshDoc()->meshList.empty();
|
||||
importMeshAct->setEnabled(activeDoc);
|
||||
@ -3719,4 +3723,25 @@ void MainWindow::updateLog()
|
||||
GLLogStream* senderlog = qobject_cast<GLLogStream*>(sender());
|
||||
if ((senderlog != NULL) && (layerDialog != NULL))
|
||||
layerDialog->updateLog(*senderlog);
|
||||
}
|
||||
|
||||
void MainWindow::switchCurrentContainer(QMdiSubWindow * subwin)
|
||||
{
|
||||
if (subwin == NULL)
|
||||
return;
|
||||
if (mdiarea->currentSubWindow() != 0)
|
||||
{
|
||||
MultiViewer_Container* split = qobject_cast<MultiViewer_Container*>(mdiarea->currentSubWindow()->widget());
|
||||
if (split != NULL)
|
||||
_currviewcontainer = split;
|
||||
}
|
||||
if (_currviewcontainer != NULL)
|
||||
{
|
||||
updateLayerDialog();
|
||||
updateMenus();
|
||||
updateWindowMenu();
|
||||
updateStdDialog();
|
||||
updateXMLStdDialog();
|
||||
updateDocumentScriptBindings();
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user