Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. get c++ signal parameter in QML
Forum Updated to NodeBB v4.3 + New Features

get c++ signal parameter in QML

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 4 Posters 419 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.
  • ODБOïO Offline
    ODБOïO Offline
    ODБOï
    wrote on last edited by ODБOï
    #1

    hi,
    is there a way to get the parameter of a signal in QML without having a Q_PROPERTY ?

    i only have this in c++

    signals :
        void valueRead(int val);
    
    ... 
    emit valueRead(10)
    

    an object of this class is exposed to QML with setContextProperty

    can i get it in QML ?

        Connections{
            target: cppObj
            onValueRead: console.log("value is : "  /* + ?*/)
        }
    

    thx

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2
      signal paramenter name is same as the one you declared in signal at C++.
      
      Connections{
          target: cppObj
          onValueRead: console.log("value is : "  +val)
      }
      

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

      ODБOïO 1 Reply Last reply
      3
      • dheerendraD dheerendra
        signal paramenter name is same as the one you declared in signal at C++.
        
        Connections{
            target: cppObj
            onValueRead: console.log("value is : "  +val)
        }
        
        ODБOïO Offline
        ODБOïO Offline
        ODБOï
        wrote on last edited by
        #3

        @dheerendra thank you ! i just noticed that too

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Jadi Nabil
          wrote on last edited by
          #4

          please , can i use serialport with android , i work with qt Qml ,Kit armv7?

          SGaistS 1 Reply Last reply
          0
          • J Jadi Nabil

            please , can i use serialport with android , i work with qt Qml ,Kit armv7?

            SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Jadi-Nabil please do not highjack other people thread with unrelated questions.

            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

            • Login

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