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. Connecting a signal to another thread's slot
Forum Update on Monday, May 27th 2025

Connecting a signal to another thread's slot

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 6.0k 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.
  • I Offline
    I Offline
    insomnia
    wrote on last edited by
    #1

    First of all im new to qt, so bare with me:)

    Im wondering which way is the right way to do it.

    I have a customized QWidget object and a QThread object & I need send SIGNALS between both;
    Signals&slots that reside inside UI I found quite comfortable to connect as it has a nice graphical tool(Qt C++ Signal Slot Editor) to do it. But as i got to the part where i needed a thread i was unable to connect with signals&slots that reside outside of UI. It seems editor will only see objects defined in ui_xxx.h file which is generated by uic program from the xxx.ui file. So its useless to edit the ui_xxx.h file as the changes will be lost.

    My question is:

    1. is there a way connect signals/slots between QWidget and QThread with Qt C++ Signal Slot Editor?
    2. if not what is the correct way to do it?

    Oh and I am using eclipse qt plugin...

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2
      1. No. Use connect()s in your code :)
      2. Don't add slots to QThread subclasses. Avoid QThread subclassing if possible.
        http://developer.qt.nokia.com/wiki/Threads_Events_QObjects

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      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