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

Connect Prototype help

Scheduled Pinned Locked Moved Unsolved General and Desktop
18 Posts 3 Posters 1.3k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #9

    Hi,

    Depending on your goal with that, did you consider using some meta object programming ?

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

    SPlattenS 1 Reply Last reply
    2
    • SGaistS SGaist

      Hi,

      Depending on your goal with that, did you consider using some meta object programming ?

      SPlattenS Offline
      SPlattenS Offline
      SPlatten
      wrote on last edited by
      #10

      @SGaist , please tell me more...

      Kind Regards,
      Sy

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

        It's all in the link ;-)

        The idea is that you can use introspection of your QObject based classes. You can get all the signals of your class, or go upper the chain and get the signals of the base classe (for as many class as your hierarchy has). Then you can use the various QMetaXXX classes to do what you want.

        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
        • SPlattenS Offline
          SPlattenS Offline
          SPlatten
          wrote on last edited by
          #12

          Ok, to summarise, what I want to do is reduce all signal and slot connections to a single connect call and then manage the details of the signal in the lambda slot.

          Kind Regards,
          Sy

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

            You can't have only one connect statement. However with the introspection, you can loop on the signals to connect them to the same lambda.

            However there's one issue that you are going to have: signals will have different parameters, how are you going to manage that in your lambda ?

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

            SPlattenS 1 Reply Last reply
            0
            • SGaistS SGaist

              You can't have only one connect statement. However with the introspection, you can loop on the signals to connect them to the same lambda.

              However there's one issue that you are going to have: signals will have different parameters, how are you going to manage that in your lambda ?

              SPlattenS Offline
              SPlattenS Offline
              SPlatten
              wrote on last edited by SPlatten
              #14

              @SGaist , sorry thats really what I meant, I would have a single map in my application where my derived Qt control classes register they're signals and then that map will be processed after reading the configuration from XML files where the subscribers will be defined. The subscribers (slots) will be connected to the signals using a common function. From what I've seen so far, having different parameters isn't a problem.

              Kind Regards,
              Sy

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

                Some sort of configurable pub/sub design ?

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

                SPlattenS 1 Reply Last reply
                0
                • SGaistS SGaist

                  Some sort of configurable pub/sub design ?

                  SPlattenS Offline
                  SPlattenS Offline
                  SPlatten
                  wrote on last edited by
                  #16

                  @SGaist , absolutely, everything I'm working towards will take Qt into a new era, where once the engine is complete, you will only need to have the same engine for each platform you want to run on, but the actual application will be a series of XML files and JavaScript files.

                  Kind Regards,
                  Sy

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

                    Then you will have to go with introspection.

                    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
                    0
                    • SPlattenS Offline
                      SPlattenS Offline
                      SPlatten
                      wrote on last edited by SPlatten
                      #18

                      @SGaist said in Connect Prototype help:

                      introspection

                      Now thats a new one (for me), had to Wiki it!

                      https://en.wikipedia.org/wiki/Type_introspection#C++

                      Kind Regards,
                      Sy

                      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