- fixed "MLRenderGlobalToolBar status is not correctly initialized" bug

This commit is contained in:
Guido Ranzuglia granzuglia 2016-10-05 07:05:09 +00:00
parent ddd24511b0
commit a21705fca4
3 changed files with 17 additions and 2 deletions

View File

@ -2613,7 +2613,6 @@ bool MainWindow::loadMesh(const QString& fileName, MeshIOInterface *pCurrentIOPl
saveRecentFileList(fileName);
if(!meshDoc()->mm()->cm.textures.empty())
updateTexture(meshDoc()->mm()->id());

View File

@ -1492,6 +1492,15 @@ void MLRenderingGlobalToolbar::statusConsistencyCheck(const MLSceneGLSharedDataC
isvalidforall &= rendact->isRenderingDataEnabled(it.value());
}
rgact->setChecked(isvalidforall);
MLRenderingZeroOrOneActionGroup* actgroup = qobject_cast<MLRenderingZeroOrOneActionGroup*>(rgact->actionGroup());
if (actgroup != NULL)
{
if (rgact->isChecked())
actgroup->setLastClicked(rgact);
else
if (actgroup->checkedAction() == NULL)
actgroup->setLastClicked(NULL);
}
}
}
}
@ -1648,6 +1657,11 @@ MLRenderingZeroOrOneActionGroup::MLRenderingZeroOrOneActionGroup(QObject* parent
connect(this, SIGNAL(triggered(QAction*)), this, SLOT(toggle(QAction*)));
}
void MLRenderingZeroOrOneActionGroup::setLastClicked(MLRenderingGlobalAction* ga)
{
_lastclicked = ga;
}
void MLRenderingZeroOrOneActionGroup::toggle(QAction* act)
{
if (act == NULL)
@ -1655,6 +1669,7 @@ void MLRenderingZeroOrOneActionGroup::toggle(QAction* act)
MLRenderingGlobalAction* ract = qobject_cast<MLRenderingGlobalAction*>(act);
if (ract == NULL)
return;
foreach(QAction* curract, actions())
{
MLRenderingGlobalAction* rendcurract = qobject_cast<MLRenderingGlobalAction*>(curract);
@ -1666,6 +1681,7 @@ void MLRenderingZeroOrOneActionGroup::toggle(QAction* act)
else
if ((ract == rendcurract) && (_lastclicked == ract))
_lastclicked = NULL;
}
}
}

View File

@ -43,6 +43,7 @@ public:
public:
bool isEsclusive() { return true; }
void setLastClicked(MLRenderingGlobalAction* ga);
private slots :
void setExclusive(bool) {}
void toggle(QAction* act);
@ -301,7 +302,6 @@ private:
MLRenderingGlobalAction* _solidvertcolglobact;
MLRenderingGlobalAction* _solidfacecolglobact;
MLRenderingGlobalAction* _solidtextcolglobact;
signals:
void updateRenderingDataAccordingToAction(MLRenderingGlobalAction*);
//void updateRenderingDataAccordingToAction(int, MLRenderingAction*,bool);