Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. QObject::setParent: Cannot set parent, new parent is in a different thread
Forum Update on Monday, May 27th 2025

QObject::setParent: Cannot set parent, new parent is in a different thread

Scheduled Pinned Locked Moved Unsolved Qt for Python
4 Posts 2 Posters 745 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.
  • K Offline
    K Offline
    Khamisi Kibet
    wrote on last edited by
    #1

    I want to dynamically add widgets to the UI from a separate thread but am getting this error

    JonBJ 1 Reply Last reply
    0
    • K Khamisi Kibet

      I want to dynamically add widgets to the UI from a separate thread but am getting this error

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

      @Khamisi-Kibet
      You cannot/must not. UI operations must only be done in the UI thread. Hence the error message you are getting.

      Maybe your other thread should be sending a signal for the UI thread to connect to, and the UI thread should create whatever widgets in response?

      K 1 Reply Last reply
      1
      • JonBJ JonB

        @Khamisi-Kibet
        You cannot/must not. UI operations must only be done in the UI thread. Hence the error message you are getting.

        Maybe your other thread should be sending a signal for the UI thread to connect to, and the UI thread should create whatever widgets in response?

        K Offline
        K Offline
        Khamisi Kibet
        wrote on last edited by
        #3

        @JonB Thank you.
        Can you please help me with an example or link on how to send a signal to the GUI thread.

        K 1 Reply Last reply
        0
        • K Khamisi Kibet

          @JonB Thank you.
          Can you please help me with an example or link on how to send a signal to the GUI thread.

          K Offline
          K Offline
          Khamisi Kibet
          wrote on last edited by
          #4

          @Khamisi-Kibet @JonB I figured it out. [Solved]

          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