Correct syntax to register object reference using qRegisterMetaType?
-
@kshegunov , I am using const QJsonObject& for my signal arguments, these are working, the only thing that is displayed in the Application Output is the message I've raised. I'm not experience any other problems, crashes or bugs.
wrote on 6 Jan 2021, 16:49 last edited by@SPlatten
The signal argument type is "OK", insofar as it would work OK with non-cross-thread direct connectionconnect()
s. But the problem is that you are trying to use it when you need a queued connection. That is why you get the error message on theQObject::connect
statement. -
@SPlatten
The signal argument type is "OK", insofar as it would work OK with non-cross-thread direct connectionconnect()
s. But the problem is that you are trying to use it when you need a queued connection. That is why you get the error message on theQObject::connect
statement. -
@kshegunov , I am using const QJsonObject& for my signal arguments, these are working, the only thing that is displayed in the Application Output is the message I've raised. I'm not experience any other problems, crashes or bugs.
@SPlatten said in Correct syntax to register object reference using qRegisterMetaType?:
@kshegunov , I am using const QJsonObject& for my signal arguments, these are working, the only thing that is displayed in the Application Output is the message I've raised. I'm not experience any other problems, crashes or bugs.
For the slots as well ?
-
@SPlatten said in Correct syntax to register object reference using qRegisterMetaType?:
@kshegunov , I am using const QJsonObject& for my signal arguments, these are working, the only thing that is displayed in the Application Output is the message I've raised. I'm not experience any other problems, crashes or bugs.
For the slots as well ?
-
wrote on 6 Jan 2021, 18:23 last edited by
Ok, I've now got rid of the warning, by going through all the QObject::connect calls and only using Qt::DirectionConnection where the signal and slot pointers are the same.
-
Ok, I've now got rid of the warning, by going through all the QObject::connect calls and only using Qt::DirectionConnection where the signal and slot pointers are the same.
-
@SPlatten
A lot of your questions are about threads. Are yourconnect()
s' senders/receivers never in separate threads? -
@SPlatten said in Correct syntax to register object reference using qRegisterMetaType?:
not for the ones where I've used Qt::DirectConnection
Then it's useless since then Qt::AutoConnection evaluates to Qt::DirectConnection. Specifying a connection type is not needed in most of the cases.
-
@SPlatten said in Correct syntax to register object reference using qRegisterMetaType?:
not for the ones where I've used Qt::DirectConnection
Then it's useless since then Qt::AutoConnection evaluates to Qt::DirectConnection. Specifying a connection type is not needed in most of the cases.
wrote on 6 Jan 2021, 18:45 last edited by@Christian-Ehrlicher , Well that's the only change I'm implemented and now there is no message, so perhaps this is something that needs looking at?
-
@Christian-Ehrlicher , Well that's the only change I'm implemented and now there is no message, so perhaps this is something that needs looking at?
@SPlatten said in Correct syntax to register object reference using qRegisterMetaType?:
@Christian-Ehrlicher , Well that's the only change I'm implemented and now there is no message, so perhaps this is something that needs looking at?
For that a minimal compilable example would be needed.
-
@Christian-Ehrlicher , Well that's the only change I'm implemented and now there is no message, so perhaps this is something that needs looking at?
@SPlatten said in Correct syntax to register object reference using qRegisterMetaType?:
so perhaps this is something that needs looking at?
This means that there is a thread context switch somewhere even you tell us it isn't.
-
@Christian-Ehrlicher , Well that's the only change I'm implemented and now there is no message, so perhaps this is something that needs looking at?
@SPlatten said in Correct syntax to register object reference using qRegisterMetaType?:
@Christian-Ehrlicher , Well that's the only change I'm implemented and now there is no message, so perhaps this is something that needs looking at?
Run with
QT_FATAL_WARNINGS=1
as an environment variable and extract the stack trace, then you will have leveraged your debugger to show you exactly where you're passing a reference between threads. -
@SPlatten said in Correct syntax to register object reference using qRegisterMetaType?:
@Christian-Ehrlicher , Well that's the only change I'm implemented and now there is no message, so perhaps this is something that needs looking at?
Run with
QT_FATAL_WARNINGS=1
as an environment variable and extract the stack trace, then you will have leveraged your debugger to show you exactly where you're passing a reference between threads.wrote on 6 Jan 2021, 20:11 last edited by@kshegunov said in Correct syntax to register object reference using qRegisterMetaType?:
QT_FATAL_WARNINGS=1
I've opened both .pro files and added that line, then cleaned and rebuilt, the applications have been running for several minutes, nothing to report, no issues.
-
It's an environnement variable, not a define.
You have to set it in the Run tab of the Project panel.
-
It's an environnement variable, not a define.
You have to set it in the Run tab of the Project panel.
-
Restarted what ?
How are you currently running your application ? -
Lifetime Qt Championwrote on 7 Jan 2021, 08:33 last edited by SGaist 1 Jul 2021, 08:33
Did you check the environment variables in the Run part of the Project Panel to ensure it's properly set ?
-
Did you check the environment variables in the Run part of the Project Panel to ensure it's properly set ?
-
@SGaist , I checked in a terminal, I don't know how or where to "Run part of the Project Panel" ?
Lifetime Qt Championwrote on 8 Jan 2021, 07:14 last edited by jsulm 1 Aug 2021, 07:14@SPlatten said in Correct syntax to register object reference using qRegisterMetaType?:
I don't know how or where to "Run part of the Project Panel" ?
Easy to find actually.
Left pane: Projects -> Build & Run -> Run...
23/34