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

    @jsulm , thank you. Is there an implementation of the connect that will allow this signal syntax with a lambda slot?

    Kind Regards,
    Sy

    jsulmJ 1 Reply Last reply
    0
    • SPlattenS SPlatten

      @jsulm , thank you. Is there an implementation of the connect that will allow this signal syntax with a lambda slot?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #6

      @SPlatten https://doc.qt.io/qt-5/qobject.html
      Only with the new connect syntax.

      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 SPlatten
        #7

        @jsulm , thats what I thought, so back to the requirement, can I roll my own and create a connect which does exactly what I required?

        Is there a way to translate the SIGNAL(signal) into the new syntax?

        Kind Regards,
        Sy

        SPlattenS 1 Reply Last reply
        0
        • SPlattenS SPlatten

          @jsulm , thats what I thought, so back to the requirement, can I roll my own and create a connect which does exactly what I required?

          Is there a way to translate the SIGNAL(signal) into the new syntax?

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

          So the penny has dropped now, I've been working with C since the mid 80's and C++ since the early 90's. The language has changed quite a lot over the years and there are elements of the language that I have never had to use, however with the introduction of some of the newer enhancements its time to learn and adopt some of these features.

          Specifically templates, I've used them when developing Qt applications without really paying to much attention. Now I find its an absolute requirement if I'm to implement the kind of features I want in my application.

          I want to be able to support any signal that a Qt widget has and connect ever signal to the same Lambda slot, this is going to require some cool code and I know it's possible as thats exactly what the standard connect does.

          I'm currently working through online tutorials, any help or input is greatly appreciated.

          Kind Regards,
          Sy

          1 Reply Last reply
          0
          • 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