示例#1
0
static inline void objectChildrenXml(AQSObject *o, QDomNode *doc,
                                     bool includeComplexTypes)
{
    const QObjectList *children = static_cast<QObject *>(o->o())->children();
    if (!children)
        return;
    QObjectListIt it(*children);
    QObject *obj;
    AQSObject *ito;
    QDomNode *itd;

    while ((obj = it.current())) {
        ++it;

        ito = ::qt_cast<AQSObject *>(AQSWrapperFactory::staticCreate(obj->className(), obj));
        if (!ito)
            continue;

        ito->setObjectName(obj->name());
        itd = ito->toXml(includeComplexTypes);
        objectChildrenXml(ito, itd, includeComplexTypes);
        doc->firstChild().appendChild(itd->firstChild());
        delete ito;
    }
}
示例#2
0
void Tools::printChildren(QObject* parent)
{
	const QObjectList objs = parent->children();
    QObject * obj;
    for(int i = 0 ; i < objs.size() ; i++) {
        obj = objs.at(i);
        kDebug() << k_funcinfo << obj->className() << ": " << obj->name() << endl;
    }

}
示例#3
0
  void build(){
	//           QListViewItem * cur = __current;
	QListViewItem * qt_list = new QListViewItem(__current,"Basic Qt Object");
	qt_list->setPixmap(0,__pixattptr);
	QListViewItem * other_list = new QListViewItem(__current,"Custom Qt Object");
	other_list->setPixmap(0,__pixattptr);
	const QObjectList * roots = QObject::objectTrees();
	if(roots != NULL){
	  uint size = roots->count();
	  __current->setText(2,"List<QObject>["+QString::number(size)+"]");
	  QObjectList r(*roots);
	  for(uint i = 0; i < size; i++ ){
		QObject * obj = r.at(i);
		if(obj != NULL){
		  if(obj->className()[0] == 'Q')
			__current = qt_list;
		  else __current = other_list;
		  process(obj);
		}
	  }
	}
  }
示例#4
0
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 );
}