QString Project::locationOfObject( QObject *o ) { if ( !o ) return QString::null; if ( MainWindow::self ) { QWidgetList windows = MainWindow::self->qWorkspace()->windowList(); for ( QWidget *w = windows.first(); w; w = windows.next() ) { FormWindow *fw = ::qt_cast<FormWindow*>(w); SourceEditor *se = ::qt_cast<SourceEditor*>(w); if ( fw ) { if ( fw->isFake() ) return objectForFakeForm( fw )->name() + QString( " [Source]" ); else return fw->name() + QString( " [Source]" ); } else if ( se ) { if ( !se->object() ) continue; if ( se->formWindow() ) return se->formWindow()->name() + QString( " [Source]" ); else return makeRelative( se->sourceFile()->fileName() ); } } } if ( ::qt_cast<SourceFile*>(o) ) { for ( QPtrListIterator<SourceFile> sources = sourceFiles(); sources.current(); ++sources ) { SourceFile* f = sources.current(); if ( f == o ) return makeRelative( f->fileName() ); } } extern QMap<QWidget*, QString> *qwf_forms; if ( !qwf_forms ) { qWarning( "Project::locationOfObject: qwf_forms is NULL!" ); return QString::null; } QString s = makeRelative( *qwf_forms->find( (QWidget*)o ) ); s += " [Source]"; return s; }