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 can I pass data between forms?
Forum Updated to NodeBB v4.3 + New Features

How can I pass data between forms?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 514 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.
  • RezistenceR Offline
    RezistenceR Offline
    Rezistence
    wrote on last edited by
    #1

    My application is working with a dynamic array, there is a button through which a modal window (Dialog) opens, in which the number of elements in the array is set. How can I pass the value to MainWindow after pressing the "Apply" button, the variable itself is initialized in mainwindow.cpp

    M 1 Reply Last reply
    0
    • RezistenceR Rezistence

      My application is working with a dynamic array, there is a button through which a modal window (Dialog) opens, in which the number of elements in the array is set. How can I pass the value to MainWindow after pressing the "Apply" button, the variable itself is initialized in mainwindow.cpp

      M Offline
      M Offline
      mpergand
      wrote on last edited by mpergand
      #2

      @Rezistence
      Add a getter method to your dialog.

      If you need to get a single value, you can use this convenience class:
      QInputDialog

      RezistenceR 1 Reply Last reply
      2
      • M mpergand

        @Rezistence
        Add a getter method to your dialog.

        If you need to get a single value, you can use this convenience class:
        QInputDialog

        RezistenceR Offline
        RezistenceR Offline
        Rezistence
        wrote on last edited by
        #3

        @mpergand I saw something about signals and slots, that they can be called and passed through them. Can you explain their work?

        M 1 Reply Last reply
        0
        • RezistenceR Rezistence

          @mpergand I saw something about signals and slots, that they can be called and passed through them. Can you explain their work?

          M Offline
          M Offline
          mpergand
          wrote on last edited by
          #4

          @Rezistence
          Describe more precisely what you want to do with it;

          RezistenceR 1 Reply Last reply
          0
          • M mpergand

            @Rezistence
            Describe more precisely what you want to do with it;

            RezistenceR Offline
            RezistenceR Offline
            Rezistence
            wrote on last edited by
            #5

            @mpergand I saw somewhere that you can send a signal to another form using their bundle and get data from it. This would be a good solution for my problem.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Signals and slots is not necessarily the best way to do what you want.

              If it's simply ask your user for a value to change your array size, as suggested by @mpergand, using QInputDialog is a simple and effective way to do that.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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