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. Create Thread
Forum Updated to NodeBB v4.3 + New Features

Create Thread

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 1.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.
  • P Offline
    P Offline
    Pranit Patil
    wrote on 13 Jul 2018, 10:19 last edited by
    #1

    How to create Thread in Qt c++;
    i developed one simple application on Qt .now i want thread creation using this i want to generate progress bar function.

    Thank you.

    @Embedded Software Developer
    God has given you one face, and you make yourself another.

    1 Reply Last reply
    0
    • V Offline
      V Offline
      VRonin
      wrote on 13 Jul 2018, 10:31 last edited by VRonin
      #2

      http://doc.qt.io/qt-5/thread-basics.html
      https://doc.qt.io/qt-5/threads-technologies.html

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      3
      • O Offline
        O Offline
        ODБOï
        wrote on 13 Jul 2018, 10:55 last edited by
        #3

        hi,see this article also:http://blog.debao.me/2013/08/how-to-use-qthread-in-the-right-way-part-1/

        1 Reply Last reply
        3
        • B Offline
          B Offline
          Buckwheat
          wrote on 13 Jul 2018, 15:12 last edited by
          #4

          Hi @Pranit-Patil !

          Welcome!

          The first thing you need to remember is that GUI items should not be created in any thread other than the main thread. QTimers are especially tempermental I have found to only respond to the owning thread.

          What I typically do, is create the QProgress or QMovie (for ajax style) in the main thread. My worker thread then just shows and set values. If you want something global (across DLLs and plugins) I typically have some forwarding signals in the qApp. This allows consistent user interface experience for progress. My progress singleton interface connects to those and the plugin or thread or other object simply calls into it.

          Using a worker thread, keeps the design simple. I am starting to like QtConcurrent since I am using more worker functions in a larger object to process data (like files). You have a lot of control over the threads and they are run from a pool so you can reuse the resources easier.

          Another really good blog: https://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/

          Dave Fileccia

          1 Reply Last reply
          1

          1/4

          13 Jul 2018, 10:19

          • Login

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