当前位置: 代码迷 >> QT开发 >> QMetaMethod:Cloned,该如何解决
  详细解决方案

QMetaMethod:Cloned,该如何解决

热度:71   发布时间:2016-04-25 03:14:00.0
QMetaMethod::Cloned

void QMetaObject::connectSlotsByName(QObject *o)
{
......
......

if (foundIt) {
            // we found our slot, now skip all overloads
            while (mo->method(i + 1).attributes() & QMetaMethod::Cloned)
                  ++i;
        } else if (!(mo->method(i).attributes() & QMetaMethod::Cloned)) {
            // check if the slot has the following signature: "on_..._...(..."
            int iParen = slotSignature.indexOf('(');
            int iLastUnderscore = slotSignature.lastIndexOf('_', iParen-1);
            if (iLastUnderscore > 3)
                qWarning("QMetaObject::connectSlotsByName: No matching signal for %s", slot);
        }

}


这个  QMetaMethod::Cloned 是什么意思?
怎么才能让 mo->method(i + 1).attributes() & QMetaMethod::Cloned 这个条件成立
------解决方案--------------------
QMetaMethod::Cloned 表示的是这个QMetaMethod对应的函数是一个拷贝过来的函数
这个标志使用与void  function(bool param=true)这种类型
这个函数在QMetaObject中的函数列表占用两个位置,一个无参,一个有参。
其中一个就会有Cloned标志。
mo->method(i + 1).attributes() & QMetaMethod::Cloned要这个成立就是要给函数设置默认参数列表就可以了。
  相关解决方案