本文整理汇总了C++中QSObject::isPrimitive方法的典型用法代码示例。如果您正苦于以下问题:C++ QSObject::isPrimitive方法的具体用法?C++ QSObject::isPrimitive怎么用?C++ QSObject::isPrimitive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSObject
的用法示例。
在下文中一共展示了QSObject::isPrimitive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isEqual
QSEqualsResult QSStringClass::isEqual( const QSObject &a, const QSObject &b ) const
{
Q_ASSERT( a.isA( this ) );
if ( b.isString() )
return (QSEqualsResult) (a.sVal() == b.sVal() || (a.sVal().isEmpty() && b.sVal().isEmpty()));
else if ( b.isNumber() )
return ( QSEqualsResult ) ( a.sVal() == b.toString() );
else if ( !b.isPrimitive() )
return isEqual( a, b.toPrimitive() );
else
return EqualsUndefined;
}
示例2: qsConnect
static QSObject qsConnect( QSEnv *env )
{
QS_CONNECT_INIT( connect );
// find receiver and slot
QObject *receiver = 0;
int member_index = -1;
const char *slotName = sl.ascii();
if ( recIfaces ) {
for ( int i = (int)recIfaces->count()-1; i >= 0; --i ) {
receiver = recIfaces->at( i );
member_index = receiver->metaObject()->findSlot( slotName, TRUE );
if ( member_index >= 0 && signal_index >= 0 ) {
// regular signal/slot connection
QObject::connectInternal( sender, signal_index,
receiver, QSLOT_CODE, member_index );
return env->createUndefined();
}
}
}
if ( signal_index == -1 ) {
QString msg = QString::fromLatin1("Can't find signal named ") + sig;
return env->throwError( SyntaxError, msg );
}
QuickInterpreter *ip = QuickInterpreter::fromEnv( env );
if ( recIfaces ) {
sendObj->setEventHandler( ip, sig, recIfaces->at( 0 ), sl.left( sl.find( '(' ) ) );
} else {
QSObject base;
QString name;
if ( arg2.isFunction() ) {
base = QSFuncRefClass::refBase( arg2 );
name = QSFuncRefClass::refMember( arg2 ).name();
} else {
base = arg2;
if ( base.isPrimitive() )
return env->throwError( QString::fromLatin1("Invalid receiver object") );
name = env->arg( 3 ).toString();
if ( name.endsWith( QString::fromLatin1("()") ) )
name.truncate( name.length() - 2 );
}
sendObj->setEventHandler( ip, sig, 0, name, base );
}
return env->createUndefined();
}
示例3: isEqual
QSEqualsResult QSNumberClass::isEqual( const QSObject &a, const QSObject &b ) const
{
Q_ASSERT( a.isA( this ) );
if ( b.isNumber() ) {
double n1 = a.dVal();
double n2 = b.dVal();
if ( isNaN( n1 ) || isNaN( n2 ) )
return EqualsNotEqual;
else
return ( QSEqualsResult ) ( n1 == n2 );
// ### compare -0 agains +0
} else if ( b.isString() ) {
return ( QSEqualsResult ) ( a.dVal() == b.toNumber() );
} else if ( !b.isPrimitive() ) {
return isEqual( a, b.toPrimitive() );
} else {
return EqualsUndefined;
}
}