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. QThread Issues while creating GUI
Forum Updated to NodeBB v4.3 + New Features

QThread Issues while creating GUI

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 230 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.
  • N Offline
    N Offline
    Nandini
    wrote on 25 Aug 2024, 17:56 last edited by
    #1

    I have created a GUI which utilises QTableview and the model gets set into the table for about 13k rows data of data.
    To avoid the GUI to go into hang state, i added a Qthread based approach so that my database creation (which takes a lot of time) goes into the thread.

    But i would also like to update my other widgets inside that thread itself since they are also time consuming. How do i do that? I receive an error on this.
    QObject: :cannot create children for a parent that is in a different thread.
    Or is there any other way apart from QThread where i can avoid the problem of the GUI hanging whenever certain large computations /calculations happen in my GUI?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 25 Aug 2024, 17:59 last edited by
      #2

      Hi,

      It's simple: don't do that. Never try to access GUI related elements from other threads than the main thread.

      Use the worker object approach and signals and slots to communicate with the widgets.

      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
      1

      2/2

      25 Aug 2024, 17:59

      • Login

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