Correct syntax to register object reference using qRegisterMetaType?
-
@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 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?:
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.
-
@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.
-
@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.
-
@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. -
@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.
-
Restarted what ?
How are you currently running your application ? -
Did you check the environment variables in the Run part of the Project Panel to ensure it's properly set ?
-
@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...