本文整理汇总了C++中QSMember::name方法的典型用法代码示例。如果您正苦于以下问题:C++ QSMember::name方法的具体用法?C++ QSMember::name怎么用?C++ QSMember::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSMember
的用法示例。
在下文中一共展示了QSMember::name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addTransientSignalHandler
/*!
Adds the Qt Script function \a qtscriptFunction (fully qualified)
as a transient signal handler for the C++ signal \a signal of the
object \a sender.
Example:
\code
interpreter->addTransientSignalHandler( myButton, SIGNAL( clicked() ), "classA.obj.calculate" );
\endcode
\sa removeTransientSignalHandler()
*/
void QSInterpreter::addTransientSignalHandler(QObject *sender,
const char *signal,
const char *qtscriptFunction)
{
QuickInterpreter *ip = interpreter();
QString func = QString::fromLatin1(qtscriptFunction);
func.left(func.find('('));
QSObject senderObj = ip->wrap(sender);
QSObject obj = ip->object(func);
if (!obj.isFunction()) {
qDebug("QSInterpreter::addTransientSignalHandler(): '%s' not a function",
qtscriptFunction);
return;
}
QSObject base = QSFuncRefClass::refBase(obj);
QSMember member = QSFuncRefClass::refMember(obj);
QSWrapperShared *sh = ip->wrapperClass()->shared(&senderObj);
if (!sh->setEventHandler(ip, QString::fromLatin1(signal + 1), 0, member.name(), base)) {
#if defined( QT_CHECK_STATE )
qWarning("QSInterpreter::addTransientSignalHandler(), "
"failed to add signal handler: '%s' to '%s'", signal + 1, qtscriptFunction);
#endif
}
}
示例2: qsDisconnect
static QSObject qsDisconnect( QSEnv *env )
{
QS_CONNECT_INIT( disconnect );
// 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::disconnectInternal( 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 );
}
if ( recIfaces ) {
sendObj->removeEventHandler( sig, recIfaces->at( 0 ), sl.left( sl.find( '(' ) ) );
} else {
QSObject base = QSFuncRefClass::refBase( arg2 );
QSMember member = QSFuncRefClass::refMember( arg2 );
sendObj->removeEventHandler( sig, 0, member.name(), base );
}
return env->createUndefined();
}