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