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. QML model item text change - data is changing in c++ but not on screen (unless you flip to another screen and back)
Forum Update on Monday, May 27th 2025

QML model item text change - data is changing in c++ but not on screen (unless you flip to another screen and back)

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.3k 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.
  • D Offline
    D Offline
    Dolphin
    wrote on last edited by
    #1

    I need to update current data (in this instance an download progress - list of items a user can download needs to have a progress by the ones currently downloading). So the items in the list should update as appropriate but you should still be able to up/down arrow on the list. The data is updated in the c++. If I update the whole list the up/down arrows do not work because the list is constantly being refreshed. The c++ is changing the data which emits the onChanged but nothing on screen changes.

    if I use this the screen refreshes constantly because there it is 'new' data so the QML resets the index (I assume)
    @
    getGuide()->updateQMLView(QVariant::fromValue(m_model));
    @

    The objects in my list are
    @
    class CDetails : public QObject
    {
    Q_OBJECT

    public:
    CDetails();
    ~CDetails(void);

    //QML properties
    

    Q_PROPERTY(QString displayText READ getQML_displayText WRITE setQML_displayText NOTIFY QML_displayTextChanged)
    QString getQML_displayText();
    void setQML_displayText(QString text);
    QString QML_displayText;

    ...
    signals:
    void QML_displayTextChanged();

    };
    @

    A breakpoint here shows the method is being called when expected
    @
    void CDetails::setQML_displayText(QString text)
    {
    QML_displayText = text;
    emit QML_displayTextChanged();
    }
    @

    1 Reply Last reply
    0
    • P Offline
      P Offline
      portoist
      wrote on last edited by
      #2

      Could you show us how do you use it in QML?

      1 Reply Last reply
      0

      • Login

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