本文整理汇总了C++中QObject::queryList方法的典型用法代码示例。如果您正苦于以下问题:C++ QObject::queryList方法的具体用法?C++ QObject::queryList怎么用?C++ QObject::queryList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QObject
的用法示例。
在下文中一共展示了QObject::queryList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: it
/*!
* \~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;
}
示例2: insertObject
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();
//.........这里部分代码省略.........