示例#1
0
static const char *signalForMember(const char *member)
{
    QByteArray normalizedMember(QMetaObject::normalizedSignature(member));

    for (int i = 0; i < NumCandidateSignals; ++i)
        if (QMetaObject::checkConnectArgs(candidateSignal(i), normalizedMember))
            return candidateSignal(i);

    // otherwise, use fit-all accepted signal:
    return SIGNAL(accepted());
}
示例#2
0
QT_USE_NAMESPACE

static const char *signalForMember(const char *member)
{
    static const int NumCandidates = 4;
    static const char * const candidateSignals[NumCandidates] = {
        SIGNAL(textValueSelected(QString)),
        SIGNAL(intValueSelected(int)),
        SIGNAL(doubleValueSelected(double)),
        SIGNAL(accepted())
    };

    QByteArray normalizedMember(QMetaObject::normalizedSignature(member));

    int i = 0;
    while (i < NumCandidates - 1) { // sic
        if (QMetaObject::checkConnectArgs(candidateSignals[i], normalizedMember))
            break;
        ++i;
    }
    return candidateSignals[i];
}