updateObjectBrowser( true );
}
+/*!Private SLOT. Update actions after rename object.*/
+void LightApp_Application::onRenamed()
+{
+ activeStudy()->Modified();
+ updateActions();
+}
+
/*!Private SLOT. Support drag-and-drop operation.*/
void LightApp_Application::onDropped( const QList<SUIT_DataObject*>& objects, SUIT_DataObject* parent, int row, Qt::DropAction action )
{
if ( proxyModel ) {
connect( proxyModel, SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ),
this, SLOT( onDropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ) );
+ connect( proxyModel, SIGNAL( renamed( SUIT_DataObject* ) ),
+ this, SLOT( onRenamed( ) ) );
+
}
// temporary commented
}
break;
case EditRole: {
- QString val = value.toString();
+ QString val = value.toString();
+ bool mod = obj->name() != val;
if ( !val.isEmpty() && obj->setName(val) ) {
emit( dataChanged( index, index ) );
- return true;
- }
- return false;
+ if (mod)
+ emit ( renamed(obj) );
+ return true;
+ }
+ return false;
break;
}
default:
connect( model, SIGNAL( clicked( SUIT_DataObject*, int ) ), this, SIGNAL(clicked( SUIT_DataObject*, int ) ) );
connect( model, SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ),
this, SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ) );
+ connect( model, SIGNAL( renamed( SUIT_DataObject* ) ), this, SIGNAL( renamed( SUIT_DataObject* ) ) );
setSourceModel( model );
setDynamicSortFilter( true );
}
connect( model, SIGNAL( clicked( SUIT_DataObject*, int ) ), this, SIGNAL( clicked( SUIT_DataObject*, int ) ) );
connect( model, SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ),
this, SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ) );
+ connect( model, SIGNAL( renamed( SUIT_DataObject* ) ), this, SIGNAL( renamed( SUIT_DataObject* ) ) );
setSourceModel( model );
setDynamicSortFilter( true );
}
connect( *model, SIGNAL( clicked( SUIT_DataObject*, int ) ), this, SIGNAL( clicked( SUIT_DataObject*, int ) ) );
connect( *model, SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ),
this, SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ) );
+ connect( *model, SIGNAL( renamed( SUIT_DataObject* ) ), this, SIGNAL( rename( SUIT_DataObject* ) ) );
setSourceModel( *model );
setDynamicSortFilter( true );
}
void modelUpdated();
void clicked( SUIT_DataObject*, int );
void dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction );
+ void renamed( SUIT_DataObject* );
private:
void initialize();
void modelUpdated();
void clicked( SUIT_DataObject*, int );
void dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction );
+ void renamed( SUIT_DataObject* );
protected:
SUIT_AbstractModel* treeModel() const;