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

Connections problem

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 250 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.
  • R Offline
    R Offline
    RobM
    wrote on last edited by
    #1

    I have a signal in C++:

    emit(mySignal(bool));
    

    I have a connection in qml:

    Connections {​​​​​​​
      target: cppObject
      onMySignal: argument ? "true" : "false"
    }​​​​​​​
    

    When I surround the connection in curly braces:

    Connections {​​​​​​​​
      target: cppObject
      onMySignal: {​​​​​​​ argument ? "true" : "false" }​​​​​​​
    }​​​​​​​​
    

    I get a ReferenceError that argument is not defined, but not with the curly braces, why is this?

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

      What is argument here ? Either way it should give you problem. Argument should be variable name defined in your signal. I did not see that. Also when you emit the signal, you should give the value than type. Here you are adding as bool. It should true/false

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

      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