×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    43

    Help in Updating C++ Data in QML

    Hello All,

    I am making a hybrid Qt c++ and QML Based application where at first i need to send a request to the server, on correct response i need to parse that and then display it using a QML View like List View.

    I am able to send a request, parse the response make a data model using QAbstractListModel, but now my problem is i am using QNetworkAccessManager to make the http get request, which is asynchronous in nature.

    I initiate the request in main.cpp of the application, so my QML view is loaded when prior to the data added in the data model, so can any body help me in understanding how to update the data in QML once the finished Signal is emitted by QNetworkAccessManager. or simply how i can wait for the finished signal in QML.

    Please let me know if question is not clear.

    Regards,

  2. #2
    Registered User
    Join Date
    Oct 2004
    Posts
    89

    Re: Help in Updating C++ Data in QML

    Hello

    First of all a good UI Design should be showing some progress bar until the data get fetched and ready to be displayed.

    If you had already loaded your QML before you have your data, then you can reload the model and dispaly the Qml again, when you get your data

    -halderp

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    166

    Re: Help in Updating C++ Data in QML

    If you are inserting new rows to model then in your model implementation.

    An insertRows() implementation must call beginInsertRows() before inserting new rows into the data structure, and endInsertRows() immediately afterwards. this will generate proper signal and update qml view.

    you will also need to provide implementations of insertRows(), removeRows(), insertColumns(),and removeColumns(). When implementing these functions, it is important to notify any connected views about changes to the model's dimensions both before and after they occur.

    see subclassing section here for more info.
    http://doc.qt.nokia.com/latest/qabstractitemmodel.html
    http://kunalmaemo.blogspot.com/

Similar Threads

  1. Drawing in QML
    By JeffC55 in forum [Archived] Qt Quick
    Replies: 8
    Last Post: 2011-04-27, 18:22
  2. [move] Help for locating the data type reference in eclipse SDK help
    By soaringhawkzf in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 11
    Last Post: 2009-02-11, 16:44
  3. need help in data recovery
    By sulabh120881 in forum Symbian
    Replies: 5
    Last Post: 2006-12-06, 11:53

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×