/*! * \~english * Gets list of id binding table. * \~russian * Получение списка уже присутствующих в форме таблиц. Необходимо для того, чтобы одну таблицу не добавили два раза. * \~ * \return \~english list of id binding table. \~russian список таблиц \~ */ Q3ValueList<int> wDBTable::getBindList() { aCfgItem obj; QObjectList wList; int id; wDBTable* wtable; QObject* wd = aWidget::parentContainer( this ); listBindings.clear(); wList = wd->queryList( "wDBTable" ); QListIterator<QObject*> it( wList ); // iterate over the wDBTable while ( it.hasNext() ) { wtable = qobject_cast<wDBTable*>( it.next() ); if(strcmp(wtable->name(),this->name())) // don't added current id { //don.t added deleted widgets if(strncmp("qt_dead_widget_",wtable->name(),strlen("qt_dead_widget_"))) { id = wtable->property("TableInd").toInt(); if(id>=0) // don't added negativ id (table while not selected) { listBindings << id; } } } } //--delete wList; return listBindings; }
void HierarchyList::insertObject( QObject *o, QListViewItem *parent ) { bool fakeMainWindow = false; if ( o && o->inherits( "QMainWindow" ) ) { QObject *cw = ( (QMainWindow*)o )->centralWidget(); if ( cw ) { o = cw; fakeMainWindow = true; } } QListViewItem *item = 0; QString className = WidgetFactory::classNameOf( o ); if ( o->inherits( "QLayoutWidget" ) ) { switch ( WidgetFactory::layoutType( (QWidget*)o ) ) { case WidgetFactory::HBox: className = "HBox"; break; case WidgetFactory::VBox: className = "VBox"; break; case WidgetFactory::Grid: className = "Grid"; break; default: break; } } QString dbInfo; #ifndef QT_NO_SQL dbInfo = MetaDataBase::fakeProperty( o, "database" ).toStringList().join("."); #endif QString name = o->name(); if ( o->parent() && o->parent()->inherits( "QWidgetStack" ) && o->parent()->parent() ) { if ( o->parent()->parent()->inherits( "QTabWidget" ) ) name = ( (QTabWidget*)o->parent()->parent() )->tabLabel( (QWidget*)o ); else if ( o->parent()->parent()->inherits( "QWizard" ) ) name = ( (QWizard*)o->parent()->parent() )->title( (QWidget*)o ); } QToolBox *tb; if ( o->parent() && o->parent()->parent() && (tb = ::qt_cast<QToolBox*>(o->parent()->parent()->parent())) ) name = tb->itemLabel( tb->indexOf((QWidget*)o) ); if ( fakeMainWindow ) { name = o->parent()->name(); className = "QMainWindow"; } if ( !parent ) item = new HierarchyItem( HierarchyItem::Widget, this, name, className, dbInfo ); else item = new HierarchyItem( HierarchyItem::Widget, parent, name, className, dbInfo ); if ( !parent ) item->setPixmap( 0, PixmapChooser::loadPixmap( "form.xpm", PixmapChooser::Mini ) ); else if ( o->inherits( "QLayoutWidget") ) item->setPixmap( 0, PixmapChooser::loadPixmap( "layout.xpm", PixmapChooser::Small ) ); else item->setPixmap( 0, WidgetDatabase::iconSet( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( o ) ) ). pixmap( QIconSet::Small, QIconSet::Normal ) ); ( (HierarchyItem*)item )->setWidget( (QWidget*)o ); const QObjectList *l = o->children(); if ( !l ) return; QObjectListIt it( *l ); it.toLast(); for ( ; it.current(); --it ) { if ( !it.current()->isWidgetType() || ( (QWidget*)it.current() )->isHidden() ) continue; if ( !formWindow->widgets()->find( (QWidget*)it.current() ) ) { if ( it.current()->parent() && ( it.current()->parent()->inherits( "QTabWidget" ) || it.current()->parent()->inherits( "QWizard" ) ) && it.current()->inherits( "QWidgetStack" ) ) { QObject *obj = it.current(); QObjectList *l2 = obj->queryList( "QWidget", 0, true, false ); QDesignerTabWidget *tw = 0; QDesignerWizard *dw = 0; if ( it.current()->parent()->inherits( "QTabWidget" ) ) tw = (QDesignerTabWidget*)it.current()->parent(); if ( it.current()->parent()->inherits( "QWizard" ) ) dw = (QDesignerWizard*)it.current()->parent(); QWidgetStack *stack = (QWidgetStack*)obj; for ( obj = l2->last(); obj; obj = l2->prev() ) { if ( qstrcmp( obj->className(), "QWidgetStackPrivate::Invisible" ) == 0 || ( tw && !tw->tabBar()->tab( stack->id( (QWidget*)obj ) ) ) || ( dw && dw->isPageRemoved( (QWidget*)obj ) ) ) continue; insertObject( obj, item ); } delete l2; } else if ( ::qt_cast<QToolBox*>(it.current()->parent()) ) { if ( !::qt_cast<QScrollView*>(it.current()) ) continue; QToolBox *tb = (QToolBox*)it.current()->parent(); for ( int i = tb->count() - 1; i >= 0; --i ) insertObject( tb->item( i ), item ); } continue; } insertObject( it.current(), item ); } if ( item->firstChild() ) item->setOpen( true ); }