[Qt-interest] need help with qobject connect

Ivan Lyapunov qt4box at gmail.com
Wed Aug 5 16:47:20 CEST 2009


hello

here is a piece of code with trouble

struct aStruct {
int a;
double b;
bool c;
}

Q_DECLARE_METATYPE(aStruct);

int main {
qRegisterMetaType<aStruct>("aStruct");
QObject::connect(obj1, SIGNAL(func1(aStruct&)), obj2,
SLOT(func2(aStruct&)));
}

gives me
QObject::connect: Cannot queue arguments of type 'aStruct&'
(Make sure 'aStruct&' is registered using qRegisterMetaType().)


however qRegisterMetaType<aStruct>("aStruct&");
QObject::connect works but its looks like a trouble ))

QObject::connect(obj1, SIGNAL(func1(const aStruct&)), obj2, SLOT(func2(const
aStruct&)));
works but i don't need a const specifier

i need a help how can i do connect functions with reference

Regards,
 Ivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090805/a46129d4/attachment.html 


More information about the Qt-interest-old mailing list