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. Passing multiple parameters into function. How?

Passing multiple parameters into function. How?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 1.2k 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.
  • B Offline
    B Offline
    bogong
    wrote on 3 Apr 2019, 08:39 last edited by
    #1

    Hello all?

    What is best way in Qt to pass into function multiple parameters? For example I have an issue to create object that might be required in one case 3 properties and in another case 30 properties. In Java Script this case looks like passing into function named array where key-value pairs. I need something like it for CPP.

    J 1 Reply Last reply 3 Apr 2019, 08:48
    0
    • B bogong
      3 Apr 2019, 08:39

      Hello all?

      What is best way in Qt to pass into function multiple parameters? For example I have an issue to create object that might be required in one case 3 properties and in another case 30 properties. In Java Script this case looks like passing into function named array where key-value pairs. I need something like it for CPP.

      J Online
      J Online
      J.Hilk
      Moderators
      wrote on 3 Apr 2019, 08:48 last edited by
      #2

      @bogong
      you can use in c++ a list/vector of key value pairs as well.
      But I think you're better off using a class/struct as parameter.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      B 1 Reply Last reply 3 Apr 2019, 08:50
      2
      • J J.Hilk
        3 Apr 2019, 08:48

        @bogong
        you can use in c++ a list/vector of key value pairs as well.
        But I think you're better off using a class/struct as parameter.

        B Offline
        B Offline
        bogong
        wrote on 3 Apr 2019, 08:50 last edited by
        #3

        @J.Hilk Thanks a lot. I've been already using list/vector. Is there any example of class/struct?

        J 1 Reply Last reply 3 Apr 2019, 08:52
        0
        • B bogong
          3 Apr 2019, 08:50

          @J.Hilk Thanks a lot. I've been already using list/vector. Is there any example of class/struct?

          J Online
          J Online
          J.Hilk
          Moderators
          wrote on 3 Apr 2019, 08:52 last edited by
          #4

          @bogong
          take a look in this thread,

          it should get you going ;-)
          https://stackoverflow.com/questions/15181765/passing-structs-to-functions


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          B 1 Reply Last reply 3 Apr 2019, 08:53
          2
          • J J.Hilk
            3 Apr 2019, 08:52

            @bogong
            take a look in this thread,

            it should get you going ;-)
            https://stackoverflow.com/questions/15181765/passing-structs-to-functions

            B Offline
            B Offline
            bogong
            wrote on 3 Apr 2019, 08:53 last edited by bogong 4 Mar 2019, 08:55
            #5

            @J.Hilk I-I-I-H-A-A-A! That's what I've been seeking for! :-))))) I forget the key word - struct. I've been seeking: array, vectors and others but not "struct". Thanks ... Bad morning ... Need coffee ...

            J 1 Reply Last reply 3 Apr 2019, 12:30
            0
            • B bogong
              3 Apr 2019, 08:53

              @J.Hilk I-I-I-H-A-A-A! That's what I've been seeking for! :-))))) I forget the key word - struct. I've been seeking: array, vectors and others but not "struct". Thanks ... Bad morning ... Need coffee ...

              J Offline
              J Offline
              JonB
              wrote on 3 Apr 2019, 12:30 last edited by
              #6

              @bogong
              struct is a keyword in C/C++. array/vector are not keywords (std::array/std::vector are standard library class templates). :)

              1 Reply Last reply
              0

              5/6

              3 Apr 2019, 08:53

              • Login

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