Qt Message, what does it mean, is it important ?
-
You're long enough here to know how to use a debugger and debug such warnings.. aren't you?
And searching for QT_FATAL_WARNINGS in the forum will reveal more help.QObject::connect(mpsckIncoming, &QAbstractSocket::errorOccurred ,this, &clsServer::onErrorOccurred);
And this was also discussed many times here - your slot is executed in the main thread and so QTcpSocket is accessed from the wrong thread. The forum search is something you should learn to use.
@Christian-Ehrlicher , if the error occurs in a thread, what is the correct way to manage this connection?
-
@Christian-Ehrlicher , if the error occurs in a thread, what is the correct way to manage this connection?
@SPlatten Do you even read my posts? I wrote what you did wrong (except that there is again no need for a thread and when using a thread reading the documentation on how to use it properly seems to be too hard)
-
@SPlatten Do you even read my posts? I wrote what you did wrong (except that there is again no need for a thread and when using a thread reading the documentation on how to use it properly seems to be too hard)
@Christian-Ehrlicher , maybe because your posts are very cryptic and its not easy to see what you are trying to say.
"except that there is again no need for a thread and when using a thread reading the documentation on how to use it properly seems to be too hard"
What does that even mean ?
-
@Christian-Ehrlicher , maybe because your posts are very cryptic and its not easy to see what you are trying to say.
"except that there is again no need for a thread and when using a thread reading the documentation on how to use it properly seems to be too hard"
What does that even mean ?
@SPlatten said in Qt Message, what does it mean, is it important ?:
What does that even mean ?
- you don't need a thread to read from a QTcpSocket but just use it because it's fancy without known what you're actually doing.
- you did not read the QThread documentation which clearly explains on how to properly use a QThread and don't care about it.
-
@SPlatten said in Qt Message, what does it mean, is it important ?:
What does that even mean ?
- you don't need a thread to read from a QTcpSocket but just use it because it's fancy without known what you're actually doing.
- you did not read the QThread documentation which clearly explains on how to properly use a QThread and don't care about it.
-
@SPlatten said in Qt Message, what does it mean, is it important ?:
What does that even mean ?
- you don't need a thread to read from a QTcpSocket but just use it because it's fancy without known what you're actually doing.
- you did not read the QThread documentation which clearly explains on how to properly use a QThread and don't care about it.
@Christian-Ehrlicher , Its actually not a problem at all, turns out the only time these messages are reported is when the application is terminated by clicking the stop button in Qt Creator.
If I close the application by clicking the close widgets on the window it doesn't exhibit the problem.
-
@Christian-Ehrlicher , Its actually not a problem at all, turns out the only time these messages are reported is when the application is terminated by clicking the stop button in Qt Creator.
If I close the application by clicking the close widgets on the window it doesn't exhibit the problem.
@Christian-Ehrlicher , I've tried various things in an attempt to figure out what you were suggesting, but I'm still seeing the same problem, can you be any more descriptive?
-
@Christian-Ehrlicher , I've tried various things in an attempt to figure out what you were suggesting, but I'm still seeing the same problem, can you be any more descriptive?
Do not do this.
class clsServer : public QThread { }
Instead, use a worker as Christian posted:
https://doc.qt.io/qt-6/qthread.html#details
It is critical.Another thing Christian pointed out is: why do you add QTcpSocket inside a thread?
What is the reason? -
@Christian-Ehrlicher , I've tried various things in an attempt to figure out what you were suggesting, but I'm still seeing the same problem, can you be any more descriptive?
@SPlatten
In Qt, the GUI elements (widgets) or QObject are not thread-safe, meaning they should
be created and manipulated only in the main thread. If you try to create or manipulate
GUI elements in a thread other than the main thread, you may encounter issues,
including the error message "Cannot create children for a parent that is in a different
thread." -
@SPlatten
In Qt, the GUI elements (widgets) or QObject are not thread-safe, meaning they should
be created and manipulated only in the main thread. If you try to create or manipulate
GUI elements in a thread other than the main thread, you may encounter issues,
including the error message "Cannot create children for a parent that is in a different
thread."