*/
QModelIndex SUIT_TreeModel::parent( const QModelIndex& index ) const
{
+ //std::cerr << "SUIT_TreeModel::parent " << index.row() << std::endl;
if ( !index.isValid() )
return QModelIndex();
else if ( obj->root() != root() )
return;
- emit layoutAboutToBeChanged();
synchronize<ObjPtr,ItemPtr,SUIT_TreeModel::TreeSync>( obj,
treeItem( obj ),
SUIT_TreeModel::TreeSync( this ) );
+
+ emit layoutAboutToBeChanged();
emit layoutChanged();
emit modelUpdated();
}
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);
QModelIndex parentIdx = index( parentObj, 0 );
int row = item->position();
- //beginRemoveRows( parentIdx, row, row );
+ beginRemoveRows( parentIdx, row, row );
myItems.remove( obj );
if ( obj == root() )
delete item;
- //endRemoveRows();
+ endRemoveRows();
}
void SUIT_TreeModel::onUpdated( SUIT_DataObject* object)
#include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_ExceptionHandler.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
+#include <stdexcept>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+void AttachDebugger();
+void Handler(int);
+
+typedef void (*sighandler_t)(int);
+sighandler_t setsig(int sig, sighandler_t handler)
+{
+ struct sigaction context, ocontext;
+ context.sa_handler = handler;
+ sigemptyset(&context.sa_mask);
+ context.sa_flags = 0;
+ if (sigaction(sig, &context, &ocontext) == -1)
+ return SIG_ERR;
+ return ocontext.sa_handler;
+}
+
+void AttachDebugger()
+{
+ if(getenv ("DEBUGGER"))
+ {
+ std::stringstream exec;
+ exec << "$DEBUGGER SALOME_Session_Server " << getpid() << "&";
+ std::cerr << exec.str() << std::endl;
+ system(exec.str().c_str());
+ while(1);
+ }
+}
+
+void Handler(int theSigId)
+{
+ std::cerr << "SIGSEGV: " << std::endl;
+ AttachDebugger();
+ //to exit or not to exit
+ exit(1);
+}
+void terminateHandler(void)
+{
+ std::cerr << "Terminate: not managed exception !" << std::endl;
+ AttachDebugger();
+}
+
+void unexpectedHandler(void)
+{
+ std::cerr << "Unexpected: unexpected exception !" << std::endl;
+ AttachDebugger();
+}
+
#include <Standard_Version.hxx>
// ---------------------------- MAIN -----------------------
int main( int argc, char **argv )
{
+
+ if(getenv ("DEBUGGER"))
+ {
+ setsig(SIGSEGV,&Handler);
+ setsig(SIGBUS,&Handler);
+ set_terminate(&terminateHandler);
+ set_unexpected(&unexpectedHandler);
+ }
+
// Install Qt debug messages handler
qInstallMsgHandler( MessageOutput );