Json stream composed and ListView

Hello world

This seems to be a simple problem with a simple solution, I just can't understand it.

Loading a simple json in a list view is simple:

jsonDataAccess = new JsonDataAccess();
QVariant json = jsonDataAccess->loadFromBuffer(data);
jsonDataModel->insertList(json.value());
jsonListView->setDataModel(jsonDataModel);

It works for the flows that are simple, as in the example of many on this site:

[
    {
        "firstName" : "Mike",
        "lastName" : "Chepesky"
        "employeeNumber" : 01840192
    }
]

What about Situations like this:

{

    "error":null,
    "result":"success",
    "count":17,
    "podcasts":[
        {
            "title":"Arts",
            "image_url":"http://cdn.99percentinvisible.org/wp-content/uploads/powerpress/99in visible-logo-1400.jpg",
            "podcasts_url":"/api/v2/podcasts/category/145",
            "category_id":145
        },
        {
            "title":"Business",
            "image_url":"http://newdisruptors.s3.amazona ws.com/images/ND_full_iTunes.jpg",
            "podcasts_url":"/api/v2/podcasts/category/143",
            "category_id":143
        }]

In the case above is not 'just work', I want to fill my ListView with all information under "podcasts", including the title, image_url, etc... But I can't understand how insert only that part of the json is fed into the model of group data.

How to insert specific parts of the food in the Datamodel?

See you soon,.

EI

I thought about it, the answers were already riddled through the forums. I guess I was looking for a "simple" solution, although it is short, it was not obvious.

QVariantMap podcasts = jsonList.value();
QVariantList podcatlist = podcasts.value("podcasts").toList();
foreach (QVariant category, podcatlist)
{
    categoryDataModel->insert(category.toMap());
}
categoryListView->setDataModel(categoryDataModel);

Tags: BlackBerry Developers

Similar Questions

  • How to detect that a text stream is entirely composed and displayed?

    Hello

    I have a stream of text (text) I want to decorate. For example, I would like to add special background and border.

    The standard behavior of TLF to put the background/border is not enough in my case.

    What is the best event to listen to detect when the text is entirely composed and displayed?

    Events which can lead to a new composition/rendering are resize window or the text itself changes flow so whenever such events happen I would like to be informed once everything is displayed again, and then do my decoration on top of the text.

    Currently I listen to 'UPDATE_COMPLETE' for the Web that holds the Sprite with the text but I noticed that in some cases on this event when I call textFlow.flowComposer.isDamaged (textFlow.textLength - 1), that it returns true.

    I guess that's a way of knowing if everything is composed and displayed and it seems that sometimes he is not so probably I should use something else.

    Thank you

    Smirnoff

    The updateComplete event is sent when the container has been updated. It must always be true when you get updateComplete that the text in the container is composed and displayed. If some text is in flux that does not fit in the container, this other text can be not composed or posted. This can happen, for example, if the text is too big to enter the container and some has been scrolled beyond the ousi container which has been updated was not the last container in the flow.

    You can force the most text can be made by calling composeToPosition. But if you force to deal at the end of a very long flow, which could have negative performance implications. You can simply add your ornaments only to text in the container.

  • I just pop up saying wifi is composed and it will be disabled for a min. Cause for concern?

    I just pop up saying wifi is composed and it will be disabled for a min. Cause for concern?

    Who is this message

  • SoniX - streaming media and broadcast - YooStar camera got downloaded from WINDOWS UPDATE through MICROSOFT

    I friggin do not know if this is a real update... I think it's a fake but its on my system and can not get rid of it. I did a system restore to an earlier date and its always there, so this is a spyware crap that needs to be taken out of microsoft windows operating system. If this is not true then please someone Microsoft please invite you to my computer and look for yourself. Who has heard of an update of the program called youstar by sonix camera?

    I feel my system is compromised and WINDOWS UPDATE is fracked if it contained in this new trojan spyware virus whatever being downloaded in this way. SOUNDS DANGEROUS TO me.. .Please help!

    On my windows update page it reads this with other optional updates.

    "Sonix - running and broadcast media - YooStar camera.

    Download size: 4.8 MB

    You may have to restart your computer for this update is taken into account.

    Update type: recommended

    SoniX Streaming Media and software distribution updated June 2009

    More information:
    http://winqual.Microsoft.com/support/?DriverID=20283737

    Help and Support:
    http://support.Microsoft.com/select/?target=hub

    I can't imagine how MICROSOFT is allowing us to download this tool which is probably a bug or another infection, but the way we think that we are Microsoft download is not Microsoft.

    MICROSOFT SOFTWARE ENGINEERS, you can call me to remedy this situation and go to the heart of this new problem. Of course sounds like a chineese bug. Who has heard of a device called YOOSTAR CAMERA?

    RobertSaikaley

    Try to do the following

    1 disconnect Internet completely until told to reconnect
    2. go to the device, imaging devices Manager, select the Sonix Webcam device and choose to uninstall the driver, without forgetting to select [] delete the driver for this device
    3. restart the system and allow it to install the Microsoft Inbox driver
    4. go to control panel, Classic view, Windows Update and change the setting/configuration, Opt to download only the updates, but do NOT install, let me decide
    5. connect to the Internet and then go to Windows Update windowsupdate.microsoft.com
    6. check updates and click on update driver option
    7. RIGHT mouse click on the Sonix webcam driver and opt to hide the update, and then click OK
    8 return to Windows Update and opt-in settings on the automatic updates and the recommended updates
    9 Windows Update will never ask you to install this new driver

    Also, if you have Windows Live Messenger installed, go to Tools/Options, Sign In and check the box automatically connect to Windows Live Messenger when I log in to Windows

    Restart the system and see if the webcam is working normally

  • How to uninstall Active Development Co., Ltd. - Streaming Media and Broadcast - USB TV Tuner?

    Hello

    Last month, I installed "Active Development Co., Ltd. - Streaming Media and Broadcast - TV USB Tuner" MS Update and this pilot "crashed" my TV not only. I saw on your page K. Azam suggesting another person to go to the system restore point, but I do not have a restore point before I installed the new driver.
    How can I remove it, it does not appear to remove windows updates?
    Any help would be greatly appreciated!
    D. Marek Köter

    Hi Marek,

    Currently, your TV tuner card working properly or you get a command prompt to install this update?

    If get you any prompt to install the update, then you can try to hide the update and check if it helps.

    a. open the Control Panel (all items view) and click the Windows Update icon.

    (b) after the updates of Windows or if you are looking for updates, click the link available updates .

    c. right click on Windows Update list that you want to hide, and then click hide update.

    d. If prompted by UAC, then click on Yes or enter the administrator password.

    You can also read the following article and check:

    Restore a driver with its previous version

  • I'M ON A WIRELESS SYSTEM TO RUN FAST, NOW I'M I'VE SEEN TROUBLE STREAMING MOVIES AND EVEN VIDEOS ON YOU TUBE, CAN SOMEONE ME USING THE ADVICE ON SETTINGS OF WINDOWS VISTA?

    I'M ON A WIRELESS SYSTEM TO RUN FAST, NOW I'M I'VE SEEN TROUBLE STREAMING MOVIES AND EVEN VIDEOS ON YOU TUBE, CAN SOMEONE ME USING THE ADVICE ON SETTINGS OF WINDOWS VISTA?

    Hi GrahamCroal

     

    1. is the streaming of films and videos slow down or you are totally unable to broadcast their?
    2. what exactly happens when you try streaming?

     

    You can check if the below link help-

    http://Windows.Microsoft.com/en-us/Windows-Vista/which-protocols-does-Windows-Media-Player-use-for-streaming

     

    Also the connection speed must be higher than the data rate of the content you read to discover Fast Streaming. The faster your connection, the better your experience will be. So it depends entirely on the broadband connection you are using and speed offered by the connection. If you want faster streaming then you need check the high-speed broadband connections. You can communicate with the internet service provider for more information about the same thing.

    I hope this helps.

  • How to make a streaming audio and video on BlackBerry.

    Hi all

    Please someone help me.

    I must be a 3rd part java application that can stream audio and video server and can play only audio/video on my phone from BB.

    Please share me your ideas or related links to do the same as soon as POSSIBLE.

    Thanks in advance.

    Thanks Peter.

    It's really useful links

  • Can you live stream RTMP and HLS

    Is it possible to live stream RTMP and HLS with FMS 4.5?

    I want flash to users to have the least possible latency using the RTMP protocol, and iOS users to HLS.

    If possible, how can I achieve this?

    Yes, this should be possible...

    You can publish on the netconnection rtmp://server-ip/livepkgr a stream say "livestream".

    On ios, you can mailing to http://server-ip:8134/hls-live/livepkgr/_definst_/livestream/livestream.m3u8

    In flash, you can subscribe to (Netconnection: rtmp://server-ip/livepkgr streamName: livestream)

    It may be useful

  • delivery block http f4v videos to stream directory (and allowing CTS)

    I have configured with success of FMS 4.5 (on windows) to do the following:

    • offer the progressive download video e:\fmsvids\localuser\fms-web\progressive\user-id\video.f4v
    • delivering rtmp/streaming videos at e:\fmsvids\localuser\fms-web\streams\user-id\video.f4v
    • offer videos in two directories via HLS.

    I need to disable the full delivery of the video file in e:\fmsvids\localuser\fms-web\streams\user-id\ (delivery via the m3u8 is fine).

    I tried without success to the following:

    • Add "allow to 127.0.0.1.
    • Add deny all permissions ntfs IUSR (apache continues to serve the f4vs).

    What can do to accompish my goals?  I want to ensure the safety of streaming videos and offer compatibility iOS (otherwise, why have same FMS?). Here are the guidelines of location in my httpd.conf for your review.

    Thank you.

    ----------------------------------------

    Progressive alias E:/fmsvids/localuser/fms-web/progressive"."

    < progressive location >

    True HLSHttpStreamingEnabled

    HLSMediaFileDuration 8000

    HttpStreamingContentPath E:/fmsvids/localuser/fms-web/progressive"."

    HLSFmsDirPath "..".

    Options - Indexes FollowSymLinks

    < / location >

    Alias /streams "E:/fmsvids/localuser/fms-web/streams".

    < /streams location >

    True HLSHttpStreamingEnabled

    HLSMediaFileDuration 8000

    HttpStreamingContentPath "E:/fmsvids/localuser/fms-web/streams".

    HLSFmsDirPath "..".

    Options - Indexes FollowSymLinks

    allow from 127.0.0.1

    < / location >

    This chalk up lack certain documents from adobe.  It must set the vod_directory in the fms.ini file, and then change the path instead of hls - vod in the httpd.conf file.   the guidelines above, I've added were unnecessary.

  • Child parsing JSON with datasource and view in listview

    Hi, I use datasource to get json from url data and I want in the listview, but json data have child, so I don't know how to access.

    My data source code here:

    DataSource {
            id: serviceDataSource
            source: "http://services.okezone.com/json/headline"
            type: DataSourceType.Json
            onDataLoaded: {
                serviceDataModel.clear();
                serviceDataModel.insertList(data)
            }
        }
    

    And here my display list code:

    ListView {
              dataModel: serviceDataModel
              listItemComponents: [
    
                   ListItemComponent {
                          type: "news"
                          ServiceDetail {
                                 title: ListItemData.title
                                 pubDate: ListItemData.published
                          }
                   }
              ]
     }
    

    And here is the response from json to this url:

    [
    
    {
    
      "okezone": {
    
         "version": "0.1",
    
         "headline": {
    
            "request": {
    
               "channel": 0,
    
               "start": 0
    
            },
    
            "status": "OK",
    
            "more": {
    
               "offset": 2,
    
               "start": 0,
    
               "total": 2
    
            },
    
            "news": {
    
               "type": "2",
    
               "id": "796135",
    
               "channel": {
    
                  "id": "519",
    
                  "label": "Surabaya"
    
               },
    
               "published": "2013-04-23 13:21:25",
    
               "title": "Gara-Gara UN, Mendikbud Didesak Mundur",
    
               "summary": "Para orangtua murid menilai, Mendikbud, Muhammad Nuh, harus bertanggung jawab di balik kesemerawutan sistem dan pelaksanaan Ujian Nasional.",
    
               "thumbnail": "http://img.okeinfo.net/images-data/content/2013/04/23/519/796135/BkuPxui4gB.jpg",
    
               "url": "http://services.okezone.com/json/detail/2013/04/23/519/796135"
    
            }
    
         }
    
      }
    
    }
    ]
    

    Thanks for your help, I do it in two days and does not work.

    Hello

    Try this code

    import bb.cascades 1.0
    import bb.data 1.0
    
    Page {
        content: Container {
            Label {
                text: "List View with json parsing"
            }
    
            ListView {
                id: listViewDemo
                dataModel: GroupDataModel {
                    grouping: ItemGrouping.None
                }
    
                listItemComponents: [
                    ListItemComponent {
                        type: "listItem"
                        StandardListItem {
                            title: ListItemData.okezone.headline.news["title"]
                        }
                    }
                ]
    
                function itemType(data, indexPath) {
                    return "listItem";
                }
            }
        }
    
        attachedObjects: [
            DataSource {
                id: serviceDataSource
                source: "http://services.okezone.com/json/headline"
                type: DataSourceType.Json
                onDataLoaded: {
                    listViewDemo.dataModel.clear();
                    listViewDemo.dataModel.insertList(data)
                }
            }
        ]
    
        onCreationCompleted: {
            serviceDataSource.load();
        }
    }
    

    Don't forget to add the library to .pro file

    LIBS +=-lbbdata

  • I am able to receive streams Netflix and Amazon Prime but not my shared network libraries.

    i AM ABLE to RECEIVE NETFLIX AND AMAZON PRIME FLOW BUT NOT MY NET WORK LIBRARIES

    original title: HOW CAN I GET MY WIRELESS BLUERAY PLAYER to CONNECT to MY HOME GROUP NETWORK for ACCESS to MY MEDIA? HIM DRIVE "SEES" MY COMPUTERS BUT DOES NOT CONNECT TO THEM.

    Hi KEN138,

    ·         What operating system is installed on your computer?

    ·         What exactly happens when you try to connect to the home group? You receive an error message or error code?

    ·         Did you do changes on the computer before the show?

    I suggest you to return the item and check.

    Stream your media to devices and computers using Windows Media Player

    http://Windows.Microsoft.com/en-us/Windows7/stream-your-media-to-devices-and-computers-using-Windows-Media-Player

    You can also see the article for more information on the problems of connection Wi - Fi and wireless.

    Windows wireless and wired network connection problems

    http://Windows.Microsoft.com/en-us/Windows/help/wired-and-wireless-network-connection-problems-in-Windows

    Please you with more information on the issue so that we can you extra.

  • How to synchronize streams RS232 and GPIB in labview

    Dear all, SOS.

    I built a system with 2 instruments GPIB and serial RS232 1 instrument.

    The VI works well with high light performance. But when I run the program normally with games step by step, what I get is only the stream GPIB. The serial data is not found after reading the GPIB data.

    I wonder if there is a sync issue. If so, how can I get these two data streams synchronized?

    BTW: I was trying to use the RS232-GPIBCVA converter to connect GPIB, but always had error6 at visa read. I still can't understand. Without the GPIB-RS232 converter, data can be read with the series making.

    I'm fighting this case several days, hope you guys can give me some suggestions!  Thank you very much!

    Zhenxing

    A quick glance and I don't know why you need all local variables. And even if you have bunches of error wired inside all of these structures from sequence (you should also get rid of), you have not connected to the indicators or pass them to the sequence of the sequence. I have a question some of your other codes. With each iteration of the inner loop, you can reset each instrument. It is highly unlikely that you need to reset or initialize the serial port more than once.

    You will need to also get rid of the constant cable outside during the end of the Terminal loop. Using the button abandon, this isn't the right way to stop a program.

    Highlight the performance slows down the program in a little. You may need to add some delay. Run in normal mode and set breakpoints so that most of the code that runs at a normal speed. By the process of elimination, you will finally find the area problem.

    p.s. These are Keithley instruments, you should really try the drivers that are available.

  • JSON format - Date and special characters

    Hi all

    I had a JSON server in which, I have a few text values and date.

    1. How can I convert special characters to normal String.e.g. Comma etc. ?
    2. How can I convert long date, a string in the format e.g. "1345670466960-0400"?

    I really appreciate any help above.

    Solved... Where the above closure. For others, I will post the solution.

    Special characters-

    QByteArray buffer(bufSize, 0);
    int read = reply->read(buffer.data(), available);
    //response = QString(buffer); -- Wrong way to convert the bytes.
    response = QString::fromUtf8(buffer); // right way, so special character handled itself.
    

    Day fromatting - for example "/ Date (1345670466960-0400).

    QString getStringDate(QString k){
        QDateTime date = QDateTime::fromTime_t(getDate(k));
        QString strDate = date.toString("MM/dd/yyyy HH:mm:ss");
        return strDate;
    }
    long getDate(QString k) {
        long rc = 0;
        QString v = k;
        if (v.length() > 0 ) {
            int b = v.indexOf("/Date(");
            if (b >= 0) {
                b += 6;
                int e = v.indexOf(')', b);
                if (e > b) {
                    QString s = v.mid(b, e);
                    int sign = 1;
                    if (s.indexOf('-') > 0 || s.indexOf('+') > 0) {
                        sign = s.indexOf('-') > 0 ? -1 : 1;
                        e = sign < 0 ? s.indexOf('-') : s.indexOf('+');
                        s = s.mid(0, e);
                    }
                    bool *ok = false;
                    s = s.mid(0, s.length() - 3); //trimming it for seconds only....
                    rc = s.toLong(ok, 0);
                }
            }
        }
        return rc;
    }
    
  • dynamically create and bind datamodel and listview

    Hello

    I looked through forums and examples, but in all the listview/datamodel example are linked since the start of the application only. I need to create and link dynamically. Because my data listview will depend on the selection of the previous shape. Need to do using qml. Can someone help me?

    I have not seen that your souce code can only guess the possibility.

    You have set the query, like "query:" / xxx/yyy "? You can add the journal to your custom data source to check the loop iteration of data?

    If you can show your brief source code, it willl be quick analysis.

  • Alignment and Listview header history

    I want to display header of the listview to centerd horizontally and give it a background color? I tried but its not working

    Hello

    Please given the size container means a full width based on the width of the screen. I hope that they conver the part with the gray color.

    Thank you

    Umang.

Maybe you are looking for