Results 1 to 8 of 8

Thread: how to notify qml that the c++model changed

  1. #1
    Join Date
    Mar 2014
    Posts
    5
    Thanks
    1
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Question how to notify qml that the c++model changed

    Hi everyone:
    i'm a new Qtor who want to use in Android .
    i use a qml ListView with a c++ model.
    but when i delete the item in the model,the list view do not delete the item.
    who can help me?thx!

    my english is so so, sorry

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: how to notify qml that the c++model changed

    Is this a custom model

    Does the model correctly emit the signals for row removal?

    I.e. have you verified in C++ that rowsAboutToBeRemoved() and rowsRemoved() are correctly emitted when you delete an entry?

    Cheers,
    _

  3. #3
    Join Date
    Mar 2014
    Posts
    5
    Thanks
    1
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: how to notify qml that the c++model changed

    thank you for your reply

    i'm use a QAbstractListModel
    and now , i knew that , QAbstractListModel didnot emit dataChanged() auto
    but, i do not know how to use the dataChanged signal

    i ll google it,but now , i have no idea
    do you have any document?

    thank u very much!

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: how to notify qml that the c++model changed

    dataChanged() is about existing cell data changing. There are different signals for removal of rows.

    How do you handle removing of an entry?

    Cheers,
    _

  5. #5
    Join Date
    Mar 2014
    Posts
    5
    Thanks
    1
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: how to notify qml that the c++model changed

    Yes

    now i have found it

    i have no idea

    i'm searching the answer now but have no result

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: how to notify qml that the c++model changed

    Quote Originally Posted by Mr A View Post
    Yes
    Yes is not an answer to a question starting with "how".
    Unless you are a Vorlon, of course.

    Quote Originally Posted by Mr A View Post
    now i have found it
    Found what?

    Quote Originally Posted by Mr A View Post
    i have no idea
    No idea where to find your code that handle removal of entries?

    Quote Originally Posted by Mr A View Post
    i'm searching the answer now but have no result
    You must trigger the item deletion somewhere, that is a good place to start searching.

    Cheers,
    _

  7. The following user says thank you to anda_skoa for this useful post:

    Mr A (18th March 2014)

  8. #7
    Join Date
    Mar 2014
    Posts
    5
    Thanks
    1
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: how to notify qml that the c++model changed

    i failed to do it.......

  9. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to notify qml that the c++model changed

    Quote Originally Posted by anda_skoa View Post
    Yes is not an answer to a question starting with "how".
    Unless you are a Vorlon, of course.
    That made my day today

    Quote Originally Posted by Mr A View Post
    i failed to do it.......
    How did you implement removeRows() for your model?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 1
    Last Post: 24th October 2010, 11:09
  2. Replies: 12
    Last Post: 24th July 2010, 08:12
  3. Replies: 1
    Last Post: 1st February 2010, 18:42
  4. Qt web notify
    By bunjee in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 13:24
  5. Informing a model its data has changed
    By saknopper in forum Newbie
    Replies: 3
    Last Post: 17th January 2007, 19:58

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.