PDA

View Full Version : slot with variable arguments



kung-foo
25th November 2009, 19:04
Hello, I am trying to create a slot method that has variable arguments. The MOC'er does its thing but when the compiler runs it complains about syntax.

error 2059 : syntax error : '('



class Utility : public QObject {
Q_OBJECT
public slots:
void log(char *, ...);
};


MOC'ed code (snipped)


int Utility::qt_metacall(QMetaObject::Call _c, int _id, void **_a) {
//...
case 0: log((*reinterpret_cast<const char *(*)>(_a[1])), (*reinterpret_cast< (*)>(_a[2]))); break;
//...
}

It looks like the MOC'er doesn't know how to handle '...'. Is there a better way to do this?

Thanks!

wysota
25th November 2009, 20:24
Slots can't use varargs. You can use QVariantList to pass a variable number of different types of arguments.