本文整理汇总了C++中QSObject::isUndefined方法的典型用法代码示例。如果您正苦于以下问题:C++ QSObject::isUndefined方法的具体用法?C++ QSObject::isUndefined怎么用?C++ QSObject::isUndefined使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSObject
的用法示例。
在下文中一共展示了QSObject::isUndefined方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: queryQSObject
QSObject QSAEditor::queryQSObject( const QMetaObject *meta, const QString &property, bool /*includeSuperClass*/ ) const
{
int propertyIndex = -1;
const QMetaObject *m = meta;
propertyIndex = m->indexOfProperty(property.toLatin1().constData());
if (propertyIndex >= 0) {
QMetaProperty mp = m->property(propertyIndex);
QSObject o = vTypeToQSType( QString::fromLatin1(mp.typeName()) );
if ( !o.isNull() && !o.isUndefined() )
return o;
}
m = meta;
for (int i=0; i<m->methodCount(); ++i) {
QMetaMethod mm = m->method(i);
if (mm.methodType() == QMetaMethod::Slot) {
QString n = QLatin1String(mm.methodSignature());
n = n.left(n.indexOf('('));
if ( property != n )
continue;
return vTypeToQSType(mm.typeName());
}
}
return env()->createUndefined();
}
示例2: classes
/*!
Returns all the classes declared in the context \a context.
\sa functions(), variables()
*/
QStringList QSInterpreter::classes(QObject *context) const
{
if (!context) {
#if defined( QT_RANGE_CHECK )
qWarning("QSInterpreter::classesOf: context is null");
#endif
return QStringList();
}
startInterpreter();
QSObject obj = d->interpreter->wrap(context);
QStringList lst;
if (!obj.isUndefined())
lst = d->interpreter->classesOf(obj);
stopInterpreter();
return lst;
}
示例3: functions
/*!
Returns all script functions which have been defined in the
context \a context.
If \a flags includes \c FunctionSignatures, then each function name
returned will be of the following form:
\code
functionName( typeOfArg1, typeOfArg2, ... )
\endcode
Otherwise just the names will be returned (which is the default).
\sa classes(), variables()
*/
QStringList QSInterpreter::functions(QObject *context,
FunctionFlags flags) const
{
if (!context) {
#if defined( QT_RANGE_CHECK )
qWarning("QSInterpreter::functions: context is null");
#endif
return QStringList();
}
startInterpreter();
QStringList lst;
QSObject obj = d->interpreter->wrap(context);
if (!obj.isUndefined())
lst = d->interpreter->functionsOf(obj, flags & FunctionSignatures);
stopInterpreter();
return lst;
}
示例4: variables
/*!
Returns all the variables declared in the contenxt \a context.
\sa functions(), classes()
*/
QStringList QSInterpreter::variables(QObject *context, bool includeStatic, bool includeCustom,
bool includeMemberVariables) const
{
if (!context) {
#if defined( QT_RANGE_CHECK )
qWarning("QSInterpreter::variablesOf: context is null");
#endif
return QStringList();
}
startInterpreter();
QSObject obj = d->interpreter->wrap(context);
QStringList lst;
if (!obj.isUndefined())
lst = d->interpreter->variablesOf(obj, includeStatic, includeCustom,
includeMemberVariables);
stopInterpreter();
return lst;
}
示例5: completeQMetaObject
void QSAEditor::completeQMetaObject( const QMetaObject *meta,
const QString &,
QVector<CompletionEntry> &res,
int flags,
QSObject &obj )
{
QMap<QString, bool> propMap;
bool includeSuperClass = (flags & IncludeSuperClass) == IncludeSuperClass;
// properties
const QMetaObject *m = meta;
int num = m->propertyCount();
for ( int j = 0; j < num; ++j ) {
const QMetaProperty mp = m->property( j );
if ( propMap.find( QString::fromLatin1(mp.name()) ) != propMap.end() )
continue;
CompletionEntry c;
propMap[QLatin1String(mp.name())] = false;
c.type = QLatin1String("property");
c.text = mp.name();
c.prefix = QString();
c.postfix2 = mp.typeName();
QuickInterpreter::cleanType( c.postfix2 );
if ( !c.postfix2.isEmpty() )
c.postfix2.prepend( QLatin1String(" : ") );
res.append( c );
}
if ( includeSuperClass && obj.isValid() && !obj.isUndefined() ) {
QStringList vars = interpreter()->variablesOf( obj, true );
QStringList::iterator it;
for ( it = vars.begin(); it != vars.end(); ++it ) {
CompletionEntry c;
c.type = QLatin1String("variable");
c.text = *it;
c.prefix = QString();
c.postfix2 = QString();
res << c;
}
}
// functions
QList<Property> lst;
QList<Property>::Iterator pit;
getSlots( meta, lst, includeSuperClass, false, false );
for ( pit = lst.begin(); pit != lst.end(); ++pit ) {
CompletionEntry c;
c.type = QLatin1String("function");
c.text = (*pit).name;
c.postfix = QLatin1String("()");
c.postfix2 = (*pit).type;
if ( !c.postfix2.isEmpty() )
c.postfix2.prepend( QString::fromLatin1(" : ") );
res << c;
}
if ( includeSuperClass && obj.isValid() && !obj.isUndefined() ) {
QStringList funcs = interpreter()->functionsOf( obj, true, true, true );
QStringList::Iterator it;
for ( it = funcs.begin(); it != funcs.end(); ++it ) {
CompletionEntry c;
c.type = QLatin1String("function");
c.text = *it;
c.prefix = QString();
c.postfix2 = QString();
res << c;
}
}
// enum values
m = meta;
for (int k=0; k<m->enumeratorCount(); ++k) {
QMetaEnum me = m->enumerator(k);
for (int l=0; l<me.keyCount(); ++l) {
CompletionEntry c;
c.type = QLatin1String("enum");
c.text = QLatin1String(me.key(l));
c.prefix = QString();
c.postfix2 = QLatin1String(me.name());
if (!c.postfix2.isEmpty())
c.postfix2.prepend( QString::fromLatin1(" : ") );
res << c;
}
}
if ( includeSuperClass && obj.isValid() && !obj.isUndefined() ) {
QStringList classes = interpreter()->classesOf( obj );
QStringList::Iterator it;
for ( it = classes.begin(); it != classes.end(); ++it ) {
CompletionEntry c;
c.type = QLatin1String("class");
c.text = *it;
c.prefix = QString();
c.postfix2 = QString();
res << c;
}
}
}