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. Question about problem with threads in Qt
Forum Updated to NodeBB v4.3 + New Features

Question about problem with threads in Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 4 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.
  • D Offline
    D Offline
    drmhkelley
    wrote on last edited by
    #1

    I have never consciously use threads - just what my development environment provides automagically. Hence, I don't have a clue what I might have changed in an application to get the following error from QCoreApplication:

    Warning: QCoreApplication: Object event filter cannot be in a different thread. (:0, )

    I have used this app quite a lot recently and this is new. I get a bunch of these warning messages just before the program crashes.

    Any suggestions about what sorts of things muck up proper threading?

    NOTE: See related follow-up question about catching these warnings in the debugger.

    JonBJ 1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @drmhkelley said in Question about problem with threads in Qt:

      Any suggestions about what sorts of things muck up proper threading?

      First: don't use thread if you don't need them
      Second: if you use threads make sure you really need them
      Third: read the documentation about Qt threads

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

      D 1 Reply Last reply
      2
      • Christian EhrlicherC Christian Ehrlicher

        @drmhkelley said in Question about problem with threads in Qt:

        Any suggestions about what sorts of things muck up proper threading?

        First: don't use thread if you don't need them
        Second: if you use threads make sure you really need them
        Third: read the documentation about Qt threads

        D Offline
        D Offline
        drmhkelley
        wrote on last edited by
        #3

        @Christian-Ehrlicher - As I said

        "I have never consciously use threads - just what my development environment provides automagically. "

        My present challenge is the first I've been aware of threads, except as an intellectual construct. How do I figure out why they are being used and how to turn it off?

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @drmhkelley said in Question about problem with threads in Qt:

          How do I figure out why they are being used and how to turn it off?

          Since you program your app you should know if you use QThread or QtConcurrent somehwere. If not then you don't have to worry about threads.

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

          D 1 Reply Last reply
          1
          • Christian EhrlicherC Christian Ehrlicher

            @drmhkelley said in Question about problem with threads in Qt:

            How do I figure out why they are being used and how to turn it off?

            Since you program your app you should know if you use QThread or QtConcurrent somehwere. If not then you don't have to worry about threads.

            D Offline
            D Offline
            drmhkelley
            wrote on last edited by
            #5

            @Christian-Ehrlicher - I have never used either.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              Are you using an event filter in your application ?
              If so, what object are you filtering with it ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              D 1 Reply Last reply
              0
              • SGaistS SGaist

                Hi,

                Are you using an event filter in your application ?
                If so, what object are you filtering with it ?

                D Offline
                D Offline
                drmhkelley
                wrote on last edited by
                #7

                @SGaist - is "event filter" a technical term"? For a generic meaning of the term, yes I do. Several of my widgets have a protected element "event", which I use to intercept a few events (primarily QKeyEvents). That has be my rather long-standing practice and has presented very few kinks (my recent instance of passing such events directly to QWidget instead of to the current specific widget type is a rare example of a problem).

                Since I've been doing this for a while, my present problem must be due to a very recent change - but I haven't yet found anything closely related that has changed. :(

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  No, not at technical term, see QObject::installEventFilter.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • D drmhkelley

                    I have never consciously use threads - just what my development environment provides automagically. Hence, I don't have a clue what I might have changed in an application to get the following error from QCoreApplication:

                    Warning: QCoreApplication: Object event filter cannot be in a different thread. (:0, )

                    I have used this app quite a lot recently and this is new. I get a bunch of these warning messages just before the program crashes.

                    Any suggestions about what sorts of things muck up proper threading?

                    NOTE: See related follow-up question about catching these warnings in the debugger.

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by JonB
                    #9

                    @drmhkelley said in Question about problem with threads in Qt:

                    Warning: QCoreApplication: Object event filter cannot be in a different thread. (:0, )

                    If this message is being produced from Qt code as a warning (which looks to be the case), then assuming you can debug your application you can write a qInstallMessageHandler. Put a breakpoint there and when the message occurs you would get the stack trace. This may help you understand where the message is being issued from.

                    D 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @drmhkelley said in Question about problem with threads in Qt:

                      Warning: QCoreApplication: Object event filter cannot be in a different thread. (:0, )

                      If this message is being produced from Qt code as a warning (which looks to be the case), then assuming you can debug your application you can write a qInstallMessageHandler. Put a breakpoint there and when the message occurs you would get the stack trace. This may help you understand where the message is being issued from.

                      D Offline
                      D Offline
                      drmhkelley
                      wrote on last edited by
                      #10

                      @JonB - as noted in my original post, please see my related post "Trapping QT debugging messages"

                      JonBJ 1 Reply Last reply
                      0
                      • Christian EhrlicherC Offline
                        Christian EhrlicherC Offline
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Strip down your app until it no longer occurs.

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

                        1 Reply Last reply
                        0
                        • D drmhkelley

                          @JonB - as noted in my original post, please see my related post "Trapping QT debugging messages"

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by
                          #12

                          @drmhkelley said in Question about problem with threads in Qt:

                          @JonB - as noted in my original post, please see my related post "Trapping QT debugging messages"

                          See it where? Post a reference.

                          If it's a Qt code warning, you can get stack trace via qInstallMessageHandler.

                          D 1 Reply Last reply
                          2
                          • JonBJ JonB

                            @drmhkelley said in Question about problem with threads in Qt:

                            @JonB - as noted in my original post, please see my related post "Trapping QT debugging messages"

                            See it where? Post a reference.

                            If it's a Qt code warning, you can get stack trace via qInstallMessageHandler.

                            D Offline
                            D Offline
                            drmhkelley
                            wrote on last edited by
                            #13

                            @JonB - sorry that was the subject my other post to this forum

                            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