Good afternoon,
I am using Qt4.6, code written in C++. I am trying to create a generic signal/slot using QVariant as one of the passed arguments - see the prototypes below. I looked at the Qt source code and saw that sub-attac/torpedo.cpp contains an example of what I am trying to achieve and used this as a starting point.
signal declaration:
void configArgument
( int,
const QVariant &);
void configArgument( int, const QVariant &);
To copy to clipboard, switch view to plain text mode
signal emitted:
qVariant.setValue( exposureTime);
emit configArgument( (int)CAMERA_EXPTIME, qVariant);
QVariant qVariant;
qVariant.setValue( exposureTime);
emit configArgument( (int)CAMERA_EXPTIME, qVariant);
To copy to clipboard, switch view to plain text mode
where exposureTime is declared as an int, CAMERA_EXPTIME is an enum
slot declaration:
void configArgument
( int,
const QVariant &);
void configArgument( int, const QVariant &);
To copy to clipboard, switch view to plain text mode
connect statement:
connect( m_scriptEngine,
SIGNAL( configArgument
( int,
QVariant)),
this,
SLOT( configArgument
( int,
QVariant)),Qt
::QueuedConnection);
connect( m_scriptEngine,SIGNAL( configArgument( int, QVariant)), this, SLOT( configArgument( int, QVariant)),Qt::QueuedConnection);
To copy to clipboard, switch view to plain text mode
The signal is simply not processed by the slot.
I also tried using QVariant only (not as a const reference) in the declaration without changes.
There are no compilation warnings nor runtime message displayed related to thes signal/slot.
I traced thru the code and the signal appears to be emitted properly. Am I missing something?
If I replace the QVariant argument by an int (as below) in the different declarations, then the code is working properly.
void configArgument( int, int);
void configArgument( int, int);
To copy to clipboard, switch view to plain text mode
Thanks in advance
Daniel
Bookmarks