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?
Forum Updated to NodeBB v4.3 + New Features

Passing multiple parameters into function. How?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 1.4k 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 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.HilkJ 1 Reply Last reply
    0
    • B bogong

      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.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on 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
      2
      • J.HilkJ J.Hilk

        @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 last edited by
        #3

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

        J.HilkJ 1 Reply Last reply
        0
        • B bogong

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

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on 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
          2
          • J.HilkJ J.Hilk

            @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 last edited by bogong
            #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 ...

            JonBJ 1 Reply Last reply
            0
            • B bogong

              @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 ...

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on 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

              • Login

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