Example #1
0
int Button::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QPushButton::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 2)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 2;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = getState(); break;
        case 1: *reinterpret_cast< int*>(_v) = getNumStates(); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setState(*reinterpret_cast< int*>(_v)); break;
        case 1: setNumStates(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 2;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #2
0
void CtrlInfo::show(FILE *f) const
{
    if (getType() == Numeric)
    {
        fprintf(f, "CtrlInfo: Numeric\n");
        fprintf(f, "Display : %g ... %g\n", getDisplayLow(), getDisplayHigh());
        fprintf(f, "Alarm   : %g ... %g\n", getLowAlarm(), getHighAlarm());
        fprintf(f, "Warning : %g ... %g\n", getLowWarning(), getHighWarning());
        fprintf(f, "Prec    : %ld '%s'\n", (long)getPrecision(), getUnits());
    }
    else if (getType() == Enumerated)
    {
        fprintf(f, "CtrlInfo: Enumerated\n");
        fprintf(f, "States:\n");
        size_t i, len;
        for (i=0; i<getNumStates(); ++i)
        {
            fprintf(f, "\tstate='%s'\n", getState(i, len));
        }
    }
    else
        fprintf(f, "CtrlInfo: Unknown\n");
}
Example #3
0
bool CtrlInfo::parseState(const char *text,
                         const char **next, size_t &state) const
{
    const char *state_text;
    size_t  i, len;

    for (i=0; i<getNumStates(); ++i)
    {
        state_text = getState(i, len);
        if (! state_text)
        {
            LOG_MSG("CtrlInfo::parseState: missing state %zu", i);
            return false;
        }
        if (!strncmp(text, state_text, len))
        {
            state = i;
            if (next)
                *next = text + len;
            return true;
        }
    }
    return false;
}
Example #4
0
void Button::setState(int s)
{
	m_state = s % getNumStates();
	style()->unpolish(this);
	style()->polish(this);
}