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. How to pass QString array from .cpp to string array in qml

How to pass QString array from .cpp to string array in qml

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.6k 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.
  • H Offline
    H Offline
    HuyQuang
    wrote on 7 Jan 2015, 13:34 last edited by
    #1

    Hi everybody,
    I'm a newbie.
    I have 2 array in .cpp and .qml like:

    .cpp
    @
    QString arr1[2];
    arr[0]= "";
    arr[1]= "sdfsdf";
    @

    .qml

    @
    property variant arr2: ["null", "null"]
    @

    I wanna pass arr1 to arr2 like arr2= arr1;
    how can I get it ???

    1 Reply Last reply
    0
    • O Offline
      O Offline
      onek24
      wrote on 7 Jan 2015, 13:54 last edited by
      #2

      Hello and welcome,

      basically you can pass a C++ Object to Qt using the setContextProperty method. For further informations i would recommend you to check our this qt doc:
      http://doc.qt.io/qt-5/qtqml-cppintegration-contextproperties.html

      It should answer your question and explain it better than i could =)
      If you have got more questions you are free to ask here!

      Greetings

      1 Reply Last reply
      0

      1/2

      7 Jan 2015, 13:34

      • Login

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