Solved Signal & Slot weard error (Qt 5.7.1)
-
could you show us the signature of
MainWindow::sendHistoryRequestWithMarker
andPBXConnect::getHistoryCallUpdates
? are you overloading any of these functions? -
Yes, I have :
void getHistoryCallUpdates(); ///and void getHistoryCallUpdates(QString &);
-
I've changed the functions name.
now, when I send the signal I get:
QObject::connect: Cannot queue arguments of type 'QString&'
(Make sure 'QString&' is registered using qRegisterMetaType().) -
ok, 2 more things:
- what's the signature of MainWindow::sendHistoryRequestWithMarker
- what version of Qt are you using?
-
@michalos
Hi
Using the new syntax , you must use cast when you have a overloaded signal.
( same name, different paramters)lIke in
connect(mySpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), mySlider, &QSlider::setValue);
-
@mrjj said in Signal & Slot weard error (Qt 5.7.1):
you must use cast when you have a overloaded signal
or for Qt>=5.7 qOverload
Edit:
Are you using Qt::QueuedConnection (i.e. sender and receiver are in 2 different threads)?
Do you really mean to pass a non-const QString reference? -
-
Could you answer all pending questions?
- Are you using Qt::QueuedConnection (i.e. sender and receiver are in 2 different threads)?
- Do you really mean to pass a non-const QString reference?
- what's the signature of MainWindow::sendHistoryRequestWithMarker
- what version of Qt are you using?
-
- Yes, I am using Qt::QueuedConnection
- Can You tell me why passing a non-const QString reference is a problem?
- signature (if I understand correctly) is:
void sendHistoryRequestWithMarkerMain(QString &);
- I am using Qt 5.7.1 (MSVC 2015 64 bit)
Changing the QString & to const QString & did help, but I would appreciate If You could explain me why (or point me in the right direction).
-
@michalos said in Signal & Slot weard error (Qt 5.7.1):
Can You tell me why passing a non-const QString reference is a problem?
Because that string could be modified on the other side so you cannot store "a copy of it" in a queue