Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Signal and Slots

Signal and Slots

Scheduled Pinned Locked Moved Solved Mobile and Embedded
16 Posts 4 Posters 3.1k 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.
  • Nikhilesh NN Nikhilesh N

    @Bhushan_Sure
    Have you registered the abc class using Q_PROPERTY?

    Bhushan_SureB Offline
    Bhushan_SureB Offline
    Bhushan_Sure
    wrote on last edited by
    #5

    @Nikhilesh-N
    No, in abc.cpp ?

    Nikhilesh NN 1 Reply Last reply
    0
    • Bhushan_SureB Bhushan_Sure

      @Gojir4 yes , i did that.

      Gojir4G Offline
      Gojir4G Offline
      Gojir4
      wrote on last edited by
      #6

      @Bhushan_Sure Can we see the definition of the class Abc ? Especially the complete signal ?

      Bhushan_SureB 1 Reply Last reply
      1
      • Bhushan_SureB Bhushan_Sure

        @Nikhilesh-N
        No, in abc.cpp ?

        Nikhilesh NN Offline
        Nikhilesh NN Offline
        Nikhilesh N
        wrote on last edited by Nikhilesh N
        #7

        @Bhushan_Sure
        Yes, you need to have a header file of abc that inherits from QObject. In that class you may create a Q_PROPERTY, and register this class using qmlRegisterType in main.cpp file.
        Then you can create an object of abc class on the QML side, where you can catch your signal.

        Bhushan_SureB Gojir4G 2 Replies Last reply
        1
        • Nikhilesh NN Nikhilesh N

          @Bhushan_Sure
          Yes, you need to have a header file of abc that inherits from QObject. In that class you may create a Q_PROPERTY, and register this class using qmlRegisterType in main.cpp file.
          Then you can create an object of abc class on the QML side, where you can catch your signal.

          Bhushan_SureB Offline
          Bhushan_SureB Offline
          Bhushan_Sure
          wrote on last edited by
          #8

          @Nikhilesh-N ok i will try this.
          Could you tell me what will here
          Be signal and slot and object
          In Q_property syntax ?

          1 Reply Last reply
          0
          • Gojir4G Gojir4

            @Bhushan_Sure Can we see the definition of the class Abc ? Especially the complete signal ?

            Bhushan_SureB Offline
            Bhushan_SureB Offline
            Bhushan_Sure
            wrote on last edited by
            #9

            @Gojir4 ok
            I will post that class tomorrow as i m out of office now !

            1 Reply Last reply
            0
            • Nikhilesh NN Nikhilesh N

              @Bhushan_Sure
              Yes, you need to have a header file of abc that inherits from QObject. In that class you may create a Q_PROPERTY, and register this class using qmlRegisterType in main.cpp file.
              Then you can create an object of abc class on the QML side, where you can catch your signal.

              Gojir4G Offline
              Gojir4G Offline
              Gojir4
              wrote on last edited by
              #10

              @Nikhilesh-N The goal is not to create the object from QML side, as it is "shared" as a QML context property, but only to catch the signal. So, at my opinion, there is no need to use Q_PROPERTY or to register the type at all.

              You could make a complete property, and then use the "onCompleteChanged" signal from QML. But why using a property if a signal is enough to notify the QML side ?

              Nikhilesh NN 1 Reply Last reply
              1
              • dheerendraD Offline
                dheerendraD Offline
                dheerendra
                Qt Champions 2022
                wrote on last edited by
                #11

                @Bhushan_Sure Either you have missed registering the your goose object 'gooooo' before loading the qml. Just check whether you have defined the complete signal. Is it defined with capital letters ? Hope all the methods in abc.cpp are defined with scope resolution.

                Dheerendra
                @Community Service
                Certified Qt Specialist
                http://www.pthinks.com

                1 Reply Last reply
                2
                • Gojir4G Gojir4

                  @Nikhilesh-N The goal is not to create the object from QML side, as it is "shared" as a QML context property, but only to catch the signal. So, at my opinion, there is no need to use Q_PROPERTY or to register the type at all.

                  You could make a complete property, and then use the "onCompleteChanged" signal from QML. But why using a property if a signal is enough to notify the QML side ?

                  Nikhilesh NN Offline
                  Nikhilesh NN Offline
                  Nikhilesh N
                  wrote on last edited by Nikhilesh N
                  #12

                  @Gojir4 If that is the case, your solution of using a context property is good and will suffice.

                  @Bhushan_Sure If you folow Gojir4's solution, you can emit your signal via C++ and catch it via QML in a Connections object without any issues. Either this, or you also can emit your signal through QML in order to catch it there.

                  Bhushan_SureB 1 Reply Last reply
                  2
                  • Nikhilesh NN Nikhilesh N

                    @Gojir4 If that is the case, your solution of using a context property is good and will suffice.

                    @Bhushan_Sure If you folow Gojir4's solution, you can emit your signal via C++ and catch it via QML in a Connections object without any issues. Either this, or you also can emit your signal through QML in order to catch it there.

                    Bhushan_SureB Offline
                    Bhushan_SureB Offline
                    Bhushan_Sure
                    wrote on last edited by
                    #13

                    @Nikhilesh-N @dheerendra @Gojir4
                    Hi i Solved the problem, From JNI function i was creating new object and then calling function,

                    Jnifunction
                    {
                    //the java is returning to JNI function from here i am calling status function
                    classobject.status(status);
                    }
                    

                    instead of that i used same instance of object and called it and the problem got solved.

                    1 Reply Last reply
                    1
                    • dheerendraD Offline
                      dheerendraD Offline
                      dheerendra
                      Qt Champions 2022
                      wrote on last edited by
                      #14

                      It was issue of different objects ?

                      Dheerendra
                      @Community Service
                      Certified Qt Specialist
                      http://www.pthinks.com

                      Bhushan_SureB 1 Reply Last reply
                      0
                      • dheerendraD dheerendra

                        It was issue of different objects ?

                        Bhushan_SureB Offline
                        Bhushan_SureB Offline
                        Bhushan_Sure
                        wrote on last edited by
                        #15

                        @dheerendra yes sir, Sir how to solved this issue if i have to use different object and not the same instance.

                        1 Reply Last reply
                        0
                        • dheerendraD Offline
                          dheerendraD Offline
                          dheerendra
                          Qt Champions 2022
                          wrote on last edited by
                          #16

                          practically this case should not arise. If you can show me the simple code sample, I can help you.

                          Dheerendra
                          @Community Service
                          Certified Qt Specialist
                          http://www.pthinks.com

                          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