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. Open a new dialog within a dialog
Qt 6.11 is out! See what's new in the release blog

Open a new dialog within a dialog

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 2.2k 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.
  • J Offline
    J Offline
    janaki
    wrote on last edited by
    #1

    i have a client program running on one system with different lineedits which reads data from file and prints on the lineedits and on click of ok push button all the line edits value has to be displayed on the same gui running on server machine which is on other system

    my client and server programs are running fine when am displaying the received data at console .

    i was asked to write a pthread at the receiving end becoz i vll be receiving many messages concurrently
    it means that i have to run my gui and my server program separately

    now how should i do it

    and also can u tell me how can i open a dialog within a dialog

    thank u

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Just run your communication in a QThread or a pool of QThreads (check out QConcurrent).

      As for the dialog question... you just do it, the same way you have opened the first dialog.

      (Z(:^

      1 Reply Last reply
      0
      • J Offline
        J Offline
        janaki
        wrote on last edited by
        #3

        i was asked to do pthreads
        for that i have created pthread and in pthread_create
        i have to call my gui dialog i have created dialog as follows
        @
        #include<groundsystems.h> //my dialog.h name

        in thread_create(&t1,NULL,message,NULL);

        the above statement says that thread name is t1,message is my function

        (void *) message(void *)
        {

        GroundSystems gs;
        gs.show();
        }

        when i execute this it is throwing an error as undefined reference to groundsystems.h

        thought .h and .cpp are included

        how should i solve this issue
        can u please help me

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Qt does not allow running GUI elements in a separate thread. You can move your logic to a thread, but all widgets have to remain in main GUI thread.

          If it's throwing "undefined reference" then it can't find the header. Check your project settings again. Maybe the path is wrong, or you forgot about INCLUDEPATH in your .pro file (if you are using qmake).

          (Z(:^

          1 Reply Last reply
          0
          • IamSumitI Offline
            IamSumitI Offline
            IamSumit
            wrote on last edited by
            #5

            Hii...
            "Undefined reference " I think this is due to object that you have declared GroundSystems gs; inside the thread class ,You should pass the object reference of GroundSystems class (say gsObj)to pthread class and equalise it to this->gs=gsObj;
            so the reference can be assigned to gs object.

            I don't what is your idea regarding dialogs ,
            but if you are switching from 1--->2---->3 it is very simple by using show()/hide() functions.

            Be Cute

            1 Reply Last reply
            0
            • N Offline
              N Offline
              NicuPopescu
              wrote on last edited by
              #6

              few things:
              -as it was said, you either create and show in the server main thread one dialog per client after connection request is accepted and in the per client server worker thread you signal the dialog object(or other helper object) for updating the dialog(eventually the dialog must be destroyed if client worker thread exits), or trigger an external gui programm (dialog based) and do inter process communication between server and each gui instance (is harder)
              -imho no need of pthread as QThread has as backend pthread on unix platforms
              -QDialog within QDialog means that it has main dialog as parent: this is not as usual, since a dialog is intended to be used as a top-level window

              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