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. how to pass a value from QDialog to another QDialog

how to pass a value from QDialog to another QDialog

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 604 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #1

    how to pass a value from Dialog to another Dialog?

    Pablo J. RoginaP 1 Reply Last reply
    0
    • ? A Former User

      how to pass a value from Dialog to another Dialog?

      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @davidlabib create a setter in the receiving Dialog class, quick pseudocode example:

      class DialogSender : public QDialog {
      ...
      }
      
      DialogSender::on_button_X_clicked() {
         DialogReceiver receiverDlg();
         ...
         receiverDlg.setValueX(the value to set from DialogSender)
      ...
      }
      
      class DialogReceiver : public QDialog {
      ...
      public:
          void setValueX(WhateverType value);
      
      }
      
      ....
      
      void AnotherClass::doWork() {
          dialogSender = new DialogSender();
          dialogSender.exec(); 
      }
      

      Or you can have the dialogs connected via signals and slots

      PS: please update/fix the title of your post so other people can find it meaningful

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      4
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by A Former User
        #3

        is editing the contractor of the receiving dialog a good idea ?

        mrjjM 1 Reply Last reply
        0
        • ? A Former User

          is editing the contractor of the receiving dialog a good idea ?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @davidlabib
          contractor = constructor ?
          Yes, its very fine to change it to give dialog any data it needs.

          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