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. [SOLVED] QSocketNotifier: Can only be used with threads started with QThread
Forum Update on Monday, May 27th 2025

[SOLVED] QSocketNotifier: Can only be used with threads started with QThread

Scheduled Pinned Locked Moved General and Desktop
8 Posts 6 Posters 28.2k Views
  • 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.
  • L Offline
    L Offline
    Leon
    wrote on 18 Jul 2013, 12:48 last edited by
    #1

    My application is coded with qt4
    i added this to the .pro file @QT += widgets@

    to remove the #include errors on qt5.

    Now i have this warning:
    @Starting /home/citybong/Downloads/build-wallch-Desktop-Debug/wallch...
    QSocketNotifier: Can only be used with threads started with QThread
    QSocketNotifier: Can only be used with threads started with QThread@

    which i don't know what it is, what causes it, and how to fix it.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alexandros
      wrote on 29 Jul 2013, 18:30 last edited by
      #2

      I am trying to build a project here which doesn't even use the QSocketNotifier library.

      What?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 29 Jul 2013, 21:07 last edited by
        #3

        But internally it might be used.

        That question might find better answer on the mailing list (you'll find Qt's developers/maintainers there, this forum is more user oriented)

        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
        • A Offline
          A Offline
          alexandros
          wrote on 29 Jul 2013, 21:09 last edited by
          #4

          If it is internally used (by some other library) and that causes the problem, then I don't have control over it! Why does it complain to me?

          1 Reply Last reply
          0
          • J Online
            J Online
            JKSH
            Moderators
            wrote on 30 Jul 2013, 01:21 last edited by
            #5

            [quote author="alexandros" date="1375132190"]If it is internally used (by some other library) and that causes the problem, then I don't have control over it! Why does it complain to me?[/quote]Because it needs you to use your classes differently.

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dbzhang800
              wrote on 30 Jul 2013, 01:25 last edited by
              #6

              Hi, normally, the error will occur when you access a non-thread-safe object which is created in another thread, in other words, wrong usage of QThread will cause this problem.

              1 Reply Last reply
              0
              • L Offline
                L Offline
                Leon
                wrote on 10 Aug 2013, 09:44 last edited by
                #7

                Well apparently it had something to do with QFileSystemWatcher
                Fixed ;)

                Z 1 Reply Last reply 14 Nov 2018, 18:41
                0
                • L Leon
                  10 Aug 2013, 09:44

                  Well apparently it had something to do with QFileSystemWatcher
                  Fixed ;)

                  Z Offline
                  Z Offline
                  Zerhynn
                  wrote on 14 Nov 2018, 18:41 last edited by
                  #8

                  @Leon said in [SOLVED] QSocketNotifier: Can only be used with threads started with QThread:

                  Well apparently it had something to do with QFileSystemWatcher
                  Fixed ;)

                  Leon didn't say what it had to do with the QFileSystemWatcher. For future googlers out there, what worked for me was to make sure the QThread had called its start() function first before utilizing the FileSystemWatcher's signals and slots, i.e. don't do it in the construction.

                  Not sure if that'l work for everyone but it fixed my problem.

                  1 Reply Last reply
                  1

                  • Login

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