xtofl
15th November 2011, 21:20
Hi.
In the Signals and Slots overview (http://doc.qt.nokia.com/stable/signalsandslots.html), I read that
Signals and slots can take any number of arguments of any type. They are completely type safe.
Actually trying that out, however, showed that a member function with a typedeffed argument is not recognized:
class IndexToEnum : public QObject {
Q_OBJECT
...
typedef QAudio::Mode mode;
signals:
void modeChanged( QAudio::Mode mode );
void modeChangedT( e mode );
IndexToEnum* e = new IndexToEnum;
// works just fine:
connect( e, SIGNAL( modeChanged(QAudio::Mode) ), this, SLOT( modeChanged(QAudio::Mode) ) );
// triggers "No such signal ModeEnum::modeChangedT(IndexToEnum::e)"
connect( e, SIGNAL( modeChangedT(IndexToEnum::e) ), this, SLOT( modeChangedT(IndexToEnum::e) ) );
Note: I was actually tweaking the audiodevices demo, where I wanted to insert an index->enum convertor between the modeBox and the AudioTest object.
Is this improper use of the signal/slot mechanism? Are there any other restrictions on the argument types?
In the Signals and Slots overview (http://doc.qt.nokia.com/stable/signalsandslots.html), I read that
Signals and slots can take any number of arguments of any type. They are completely type safe.
Actually trying that out, however, showed that a member function with a typedeffed argument is not recognized:
class IndexToEnum : public QObject {
Q_OBJECT
...
typedef QAudio::Mode mode;
signals:
void modeChanged( QAudio::Mode mode );
void modeChangedT( e mode );
IndexToEnum* e = new IndexToEnum;
// works just fine:
connect( e, SIGNAL( modeChanged(QAudio::Mode) ), this, SLOT( modeChanged(QAudio::Mode) ) );
// triggers "No such signal ModeEnum::modeChangedT(IndexToEnum::e)"
connect( e, SIGNAL( modeChangedT(IndexToEnum::e) ), this, SLOT( modeChangedT(IndexToEnum::e) ) );
Note: I was actually tweaking the audiodevices demo, where I wanted to insert an index->enum convertor between the modeBox and the AudioTest object.
Is this improper use of the signal/slot mechanism? Are there any other restrictions on the argument types?