static timeval tv;
#define START_TIMING gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000;
#define END_TIMING(NUMBER) \
- tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
+ tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
if(tcount==NUMBER){ std::cerr <<pthread_self()<<":"<<__FILE__<<":"<<__LINE__<<" temps CPU(mus): "<<cumul<< std::endl; tcount=0;cumul=0; }
{
if( obj )
obj->update();
+ /*
if ( item && needUpdate( item ) )
myModel->updateItem( item );
+ */
}
/*!
this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject*,SUIT_DataObject* ) ) );
SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
- SUIT_DataObject::disconnect( SIGNAL( updated( SUIT_DataObject* ) ), this, SLOT( onUpdated( SUIT_DataObject* ) ) );
+ //SUIT_DataObject::disconnect( SIGNAL( updated( SUIT_DataObject* ) ), this, SLOT( onUpdated( SUIT_DataObject* ) ) );
delete myRoot;
}
this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject*,SUIT_DataObject* ) ) );
SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
- SUIT_DataObject::disconnect( SIGNAL( updated( SUIT_DataObject* ) ), this, SLOT( onUpdated( SUIT_DataObject* ) ) );
+ //SUIT_DataObject::disconnect( SIGNAL( updated( SUIT_DataObject* ) ), this, SLOT( onUpdated( SUIT_DataObject* ) ) );
delete myRoot;
}
return QVariant();
SUIT_DataObject* obj = object( index );
- obj->setModified(false);
+ //obj->setModified(false);
QColor c;
QVariant val;
this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject*,SUIT_DataObject* ) ) );
SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
- SUIT_DataObject::disconnect( SIGNAL( updated( SUIT_DataObject* ) ), this, SLOT( onUpdated( SUIT_DataObject* ) ) );
+ //SUIT_DataObject::disconnect( SIGNAL( updated( SUIT_DataObject* ) ), this, SLOT( onUpdated( SUIT_DataObject* ) ) );
myAutoUpdate = on;
if ( myAutoUpdate ) {
this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ,SUIT_DataObject*) ) );
SUIT_DataObject::connect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
- SUIT_DataObject::connect( SIGNAL( updated( SUIT_DataObject* ) ), this, SLOT( onUpdated( SUIT_DataObject* ) ) );
+ //SUIT_DataObject::connect( SIGNAL( updated( SUIT_DataObject* ) ), this, SLOT( onUpdated( SUIT_DataObject* ) ) );
updateTree();
}
void SUIT_TreeModel::updateTree( SUIT_DataObject* obj )
{
if(myAutoUpdate)
- return;
+ {
+ emit layoutAboutToBeChanged();
+ emit layoutChanged();
+ emit modelUpdated();
+ return;
+ }
if ( !obj )
obj = root();
else if ( obj->root() != root() )
return;
+ emit layoutAboutToBeChanged();
+
synchronize<ObjPtr,ItemPtr,SUIT_TreeModel::TreeSync>( obj,
treeItem( obj ),
SUIT_TreeModel::TreeSync( this ) );
+ emit layoutChanged();
emit modelUpdated();
}
this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject*,SUIT_DataObject* ) ) );
SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
- SUIT_DataObject::disconnect( SIGNAL( updated( SUIT_DataObject* ) ), this, SLOT( onUpdated( SUIT_DataObject* ) ) );
+ //SUIT_DataObject::disconnect( SIGNAL( updated( SUIT_DataObject* ) ), this, SLOT( onUpdated( SUIT_DataObject* ) ) );
if ( autoUpdate() ) {
SUIT_DataObject::connect( SIGNAL( inserted( SUIT_DataObject*, SUIT_DataObject*,SUIT_DataObject* ) ),
this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject*,SUIT_DataObject* ) ) );
SUIT_DataObject::connect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
- SUIT_DataObject::connect( SIGNAL( updated( SUIT_DataObject* ) ), this, SLOT( onUpdated( SUIT_DataObject* ) ) );
+ //SUIT_DataObject::connect( SIGNAL( updated( SUIT_DataObject* ) ), this, SLOT( onUpdated( SUIT_DataObject* ) ) );
}
myItems.clear(); // ????? is it really necessary
SUIT_DataObject* afterObj = after ? object( after ) : 0;
int row = afterObj ? afterObj->position() + 1 : 0;
+ //std::cerr << " SUIT_TreeModel::createItem " << row << ":" << afterObj << std::endl;
- beginInsertRows( parentIdx, row, row );
+ //beginInsertRows( parentIdx, row, row );
myItems[ obj ] = new TreeItem( obj, parent, after );
- endInsertRows();
+ //endInsertRows();
//obj->setModified(false);
void SUIT_TreeModel::createItem( SUIT_DataObject* obj, SUIT_DataObject* parent, SUIT_DataObject* after )
{
+ //std::cerr << " SUIT_TreeModel::createItem " << obj << ":" << parent << ":" << after << std::endl;
if ( !treeItem(parent))
return;
createItem(obj,treeItem(parent),treeItem(after));
static long cumul;
#define START_TIMING timeval tv; gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000;
#define END_TIMING(NUMBER) \
- tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
- if(tcount==NUMBER){ std::cerr << __FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; }
+ tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
+ if(tcount==NUMBER){ std::cerr << pthread_self()<<":"<<__FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; }
using namespace std;
virtual void notifyObserver(const char* theID, const char* event)
{
- //START_TIMING;
+ START_TIMING;
//MESSAGE("I'm notified of " << event << " of ID = " << theID);
_PTR(SObject) obj = myStudyDS->FindObjectID( theID );
}
int pos = after ? father->childPos( after ) : 0;
father->insertChild(suit_obj,pos+1);
+ /*
+ if (LightApp_Application* myApp=dynamic_cast<LightApp_Application*>(myStudy->application()))
+ if (SUIT_ProxyModel* myModel=dynamic_cast<SUIT_ProxyModel*>(myApp->objectBrowser()->model()))
+ myModel->createItem(suit_obj,father,after);
+ */
}
else
{
//MESSAGE("This should be for a module");
SUIT_DataObject* father=myStudy->root();
father->appendChild(suit_obj);
+ /*
+ if (LightApp_Application* myApp=dynamic_cast<LightApp_Application*>(myStudy->application()))
+ if (SUIT_ProxyModel* myModel=dynamic_cast<SUIT_ProxyModel*>(myApp->objectBrowser()->model()))
+ myModel->createItem(suit_obj,father,father->lastChild());
+ */
}
entry2SuitObject[theID]=suit_obj;
}
MESSAGE("Want to modify an unknown object" << theID);
}
}
- //END_TIMING(10);
+ END_TIMING(100);
}
private: