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. handling return parameter for a cpp method /slot in QML
Forum Updated to NodeBB v4.3 + New Features

handling return parameter for a cpp method /slot in QML

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 280 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.
  • P Offline
    P Offline
    Prasad_Socionext
    wrote on last edited by
    #1

    onClicked:{

               data = cpp_cmd.cmd_do(cmdline_txt_id.text);
                console.log(data);
            }
    

    I have a slot called cpp_cmd.cmd_do() which is called when a button is pressed.
    that cpp slot has a return paramter a string. (which contains json data) .

    return type of data is QString.

    i am not able to display it and it gives an error. how would one solve this.

    I need to futher process data or rather send it to another cpp function for further processing.

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

      Hi,

      What exact error do you get ?

      Usually slots don't have return values. Q_INVOKABLE is used for that kind of method.

      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
      2

      • Login

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