Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Message, what does it mean, is it important ?
Forum Updated to NodeBB v4.3 + New Features

Qt Message, what does it mean, is it important ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 3 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Christian EhrlicherC Christian Ehrlicher

    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.

    SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #7

    @Christian-Ehrlicher , if the error occurs in a thread, what is the correct way to manage this connection?

    Christian EhrlicherC 1 Reply Last reply
    0
    • SPlattenS SPlatten

      @Christian-Ehrlicher , if the error occurs in a thread, what is the correct way to manage this connection?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #8

      @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)

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      SPlattenS 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        @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)

        SPlattenS Offline
        SPlattenS Offline
        SPlatten
        wrote on last edited by SPlatten
        #9

        @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 EhrlicherC 1 Reply Last reply
        0
        • SPlattenS SPlatten

          @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 EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #10

          @SPlatten said in Qt Message, what does it mean, is it important ?:

          What does that even mean ?

          1. 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.
          2. you did not read the QThread documentation which clearly explains on how to properly use a QThread and don't care about it.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          SPlattenS 2 Replies Last reply
          2
          • Christian EhrlicherC Christian Ehrlicher

            @SPlatten said in Qt Message, what does it mean, is it important ?:

            What does that even mean ?

            1. 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.
            2. you did not read the QThread documentation which clearly explains on how to properly use a QThread and don't care about it.
            SPlattenS Offline
            SPlattenS Offline
            SPlatten
            wrote on last edited by
            #11
            This post is deleted!
            1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              @SPlatten said in Qt Message, what does it mean, is it important ?:

              What does that even mean ?

              1. 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.
              2. you did not read the QThread documentation which clearly explains on how to properly use a QThread and don't care about it.
              SPlattenS Offline
              SPlattenS Offline
              SPlatten
              wrote on last edited by
              #12

              @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.

              SPlattenS 1 Reply Last reply
              0
              • SPlattenS SPlatten

                @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.

                SPlattenS Offline
                SPlattenS Offline
                SPlatten
                wrote on last edited by
                #13

                @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?

                JoeCFDJ 2 Replies Last reply
                0
                • SPlattenS SPlatten

                  @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?

                  JoeCFDJ Offline
                  JoeCFDJ Offline
                  JoeCFD
                  wrote on last edited by JoeCFD
                  #14

                  @SPlatten

                  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?

                  1 Reply Last reply
                  2
                  • SPlattenS SPlatten

                    @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?

                    JoeCFDJ Offline
                    JoeCFDJ Offline
                    JoeCFD
                    wrote on last edited by JoeCFD
                    #15

                    @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."

                    SPlattenS 1 Reply Last reply
                    2
                    • JoeCFDJ JoeCFD

                      @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."

                      SPlattenS Offline
                      SPlattenS Offline
                      SPlatten
                      wrote on last edited by
                      #16

                      @JoeCFD , thank you, I will certainly take a look into this.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved