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. [SOLVED]multi-thread & network problem !
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]multi-thread & network problem !

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.3k Views 2 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.
  • O Offline
    O Offline
    opengpu2
    wrote on last edited by opengpu2
    #1

    i use a new thread to tick Network IO.
    and a QTimer ticking in the Main Thread to readData from the server.
    also the data is sended from the Main Thread.
    here is my question, eg:

    1. i enter the login info in ClassA in the main thread, and send the info to the server;
    2. a func in ClassA is called in the QTimer in the Main Thread in order to process the readData from the server.

    is it OK? and what should i do between the 2 step above, should i block the Main Thread until the step 2 succeed?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      HI,

      my suggestion is never block the Main Thread; if you need that the step 2 is completed before doing something else use a signal to tell the main thread the data are received

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • O Offline
        O Offline
        opengpu2
        wrote on last edited by
        #3

        is there any way to make the whole window and controls Disable before step 2 is done?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on last edited by
          #4

          Hi,

          you can use QWidget::setEnabled() to disable and disable a Widget

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          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