- QString curModel = "";
- if ( v.canConvert<QString>() ) curModel = v.toString();
- // get list of all predefined materials
- QStringList materials = Material_ResourceMgr::resourceMgr()->materials();
- bool found = false;
- foreach ( QString material, materials )
- {
- QAction* menAct = matMenu->addAction( material );
- connect(menAct, SIGNAL( toggled( bool ) ), signalMapper, SLOT( map() ) );
- signalMapper->setMapping( menAct, material );
- menAct->setCheckable( true );
- // Set checked if this material is current
- Material_Model aModel;
- aModel.fromResources( material );
- if ( !found && aModel.toProperties() == curModel ) {
- menAct->setChecked( true );
- found = true;
- }
+ }
+ QString curModel = "";
+ if ( v.canConvert<QString>() ) curModel = v.toString();
+
+ // get list of all predefined materials
+ QStringList materials = Material_ResourceMgr::resourceMgr()->materials();
+ bool found = false;
+ foreach ( QString material, materials )
+ {
+ QAction* a = matMenu->addAction( material );
+ connect( a, SIGNAL( toggled( bool ) ), signalMapper, SLOT( map() ) );
+ signalMapper->setMapping( a, material );
+ a->setCheckable( true );
+
+ Material_Model aModel;
+ aModel.fromResources( material );
+ if ( !found && aModel.toProperties() == curModel ) {
+ a->setChecked( true );
+ found = true;