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.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.
  • Pranit PatilP Offline
    Pranit PatilP Offline
    Pranit Patil
    wrote on 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
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on 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
      • ODБOïO Offline
        ODБOïO Offline
        ODБOï
        wrote on 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
        • BuckwheatB Offline
          BuckwheatB Offline
          Buckwheat
          wrote on 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

          • Login

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