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. Editing QML Objects from C++ File
Forum Update on Monday, May 27th 2025

Editing QML Objects from C++ File

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 586 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
    RyonMS
    wrote on 26 May 2017, 01:55 last edited by
    #1

    So I have a C++ program that has

    Q_PROPERTY( QList<QString> messages READ getMessages NOTIFY messagesChanged )
    

    and

    Q_SIGNAL void messagesChanged(QString message)
    

    Every time I add a QString to the QList I send a signal using Q_EMIT messagesChanged(message) from a function called addMessages(QString message) which appends a QString to the QList. How can I use this signal to update a List object described in a QML file so that text will populate the List and appear on the screen each time something is added to the QList?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Manohar_SL
      wrote on 26 May 2017, 02:08 last edited by
      #2

      Hi,

      You can use connections in QML as onmessagesChanged: and you can update your list in QML display screen with target setting it as c++ file object which you have exposed to QML.

      Manohar SL
      Embedded Qt & QML Developer

      1 Reply Last reply
      2

      1/2

      26 May 2017, 01:55

      • 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