Active subset of listview items

I have problems to access the information in my listview of the CPP.  Here is my listivew.

ListView {
    id: animList
    objectName: "animList"
    dataModel: XmlDataModel {
        source: "models/anims.xml"
    }
    listItemComponents: [
        ListItemComponent {
            type: "listItem"
            AnimItem {
            }
        }
    ]
}

It uses a cutom element

Container {
    property alias checked: animCheckBox.checked
    //    property alias title:  ListItemData.title
    id: toplvl
    layout: StackLayout {
        layoutDirection: LayoutDirection.TopToBottom
    }
    onTouch: {
        if (event.isDown()) {
            checked = ! checked
        }
    }
    Container {
        id: animContainer
        layout: StackLayout {
            layoutDirection: LayoutDirection.LeftToRight
        }
        CheckBox {
            id: animCheckBox
            layoutProperties: DockLayoutProperties {
                verticalAlignment: VerticalAlignment.Center
                horizontalAlignment: HorizontalAlignment.Left
            }
            checked: true
            Label {
                id: animLabels
                text: ListItemData.title
                layoutProperties: DockLayoutProperties {
                    verticalAlignment: VerticalAlignment.Center
                    horizontalAlignment: HorizontalAlignment.Right
                }
            }
        }
    }
    Divider {
    }
}

in the PRC

    mAnimListView = mNavPane->findChild("animList");
    XmlDataModel * xmdm = (XmlDataModel*) mAnimListView->dataModel();

How I analyze the list in the PRC to create a sublist of all items activated?  I don't know how to parse through a whole datamodel of the CPP.

Hello

I have an alternative way to do this.

1. you must use GroupDataModel

2. manually pharse XML and add data to GroupDataModel

3. Add an additional data field to GroupDataModel for the checkbox State Bank

4 browse all the RPC code line and check the weather condition is enabled or not.

A code to do this task

For parsing XML

http://supportforums.BlackBerry.com/T5/Cascades-development/how-to-create-a-ListView-using-xmldatamo...

For the State of update in qml

 onTriggered: {
                var selectedItem = dataModel.data(indexPath);
                btn.text = selectedItem.firstname;
                selectedItem.firstname = "test";
                listView.dataModel.updateItem(indexPath, selectedItem)
            }

updateItem() method works only on groupDatamodel

To browse all the line of datamodel in the PRC

GroupDataModel *model = (GroupDataModel *) listView->dataModel();

    int len = model->childCount(listView->rootIndexPath());
    QVariantList qlist;
    for (int i = 0; i < len; i++) {
        qlist.append(QVariant(i));
        qDebug() << " Data : " << model->data(qlist);
        qlist.clear();
    }

I hope that this code will help you

Tags: BlackBerry Developers

Similar Questions

  • Why my ListView items cannot display on a single line?

     ListView {
           preferredHeight: ui.du(20)
           id: keyItemList
           dataModel: _nao.keyItemList
    
           leftPadding: 20
           rightPadding: 20
        //
           layout: StackListLayout {
               orientation: LayoutOrientation.LeftToRight
               headerMode: ListHeaderMode.None
           }
    
           listItemComponents: [
    
               ListItemComponent {
                   type: 'item'
                   Container {
                       preferredHeight: ui.du(20)
                       preferredWidth: ui.du(20)
                       KeyItem {
                           name: ListItemData.name
                           nowPic: ListItemData.nowPic
                           dot: ListItemData.dot
                           rate: ListItemData.rate
                       }
                       topMargin: ui.du(1.0)
                       leftMargin: ui.du(1.0)
                       rightMargin: ui.du(1.0)
                       bottomMargin: ui.du(1.0)
                  }
              }
          ]
    
          verticalAlignment: VerticalAlignment.Center
          horizontalAlignment: HorizontalAlignment.Center
    }
    

    If I put prop of listview layout. Items being passed.

    If I didn't put any accessories page layout, the elements present, but vertically.

    It can be a little difficult to get the horizontal listviews to behave, dimensions should be set correctly if I remember correctly.

    See https://github.com/oniongarlic/bb10-hlv-example/blob/master/assets/main.qml for an example code.

  • How can I keep my Active parent menu when the activation of underlying submenu items?

    Using the submenu, how would manipulate the behavior of the tab menu parent active (active state)? For example, the parent menu = portfolio, submenu consists of 2 items, photographs and drawings. When you click on one of these tabs, the parent (portfolio) tab turns into idle even if submenu pages are built under the porfolio parent page... anyone? Thank you

    I'm not sure if I understand you right, but if you use a 'normal' menu, it should work exactly as you wish. Just look at this site: www.q-stables.de

  • Change the image, click the Listview item

    Hi all

    I want to change the image of the listview element. When I touch on the element of the list the image is modified and after leave the key event the modified image remains same. Please solve my problem.

    Thank you & best regards

    Sanjit

    remove the other part of the setHighlight function. This means that when you leave the touch, the other party will not perform.

    Press on as if that solves your problem.

  • Buy new activation for first 13 items code?

    I have the first 13 (bought on Amazon 1-2 years) elements. I have the box it came, and it is installed on my computer. It seems that I need another activation code because we have maximum number of computers, on which it may be. First of all, how computers can be on? Secondly, how can I simply buy another activation code? Still once, I don't need the software, just another code to get this to work on my new PC.

    • Serial numbers (what you call activation codes) are necessary to enable the software to use.
    • You can install the software on as many computers you like, but you can enable it only for use on up to two computers at the same time, and you cannot use a version on both
    • You can install it on your new PC, but you can not activate it with your existing serial number until that deactivate you it on one of your other computers
    • Adobe sells only the current version of their software. Premiere Elements is currently in version 14. Thus, you can not buy a serial number for version 13 of Adobe. However it is perhaps not necessary if all you need to do is toggle between computers activations.
  • Impossible to validate the serial number activation adobe photoshop 13 items

    Impossible to validate the serial number activation of elements adobe photoshop for mac from amazon 13

    See if this helps:

    http://helpx.Adobe.com/x-productkb/global/find-serial-number.html

  • Activation click on the Item Renderer only event

    Hey. I'm working on a s:list and a click event problem. I have everything works just fine on the component and linking, but as you probably guessed, the event cues when whatever it is on the s:list is clicked, including the scroll bar or an empty space.

    Is there a quick fix to make the tail only event when the user clicks on an Item Renderer inside the list? Help would be very appreciated, I tried to solve this problem for a while.

    Thank you!

    RKaster

    Hi RKaster,

    do you need the reference for the element by force converter or could you immagine a different approach? If you could work around this, you can use the change event instead of the click event. The change event gets fired whenever the selection of items in the list change. Click on an element of rendering of course will change the selection if the underlying element is already selected.

    If you can't get around the need for a reference point renderer that you should experiment with the List component mouseChildren property (inherited from the DisplayObjectContainer, see http://bit.ly/dhqCFS). IMHO of course

    Kind regards

    Thilo

  • How to move to the item in the listview

    Hi, I have a listView-> scroll from left to right.

    With listView item is a detail page (a whole screen), so if left drag the user directions will change from previous / next detail.

    The problem is to know how to activate the point specific index?

    Before the text of the page, there is a list page that contains a listview

    What I want is like this:

    So if the user clicks on mark 8 on list Page-> listview will be active on the mark 8 on the detail Page

    How to do this?

    Because in the code, it always the start of index 0 on the details Page of any index selected on ListPost

    Thank you

    QVariantList is typedeffed to QList.
    Row is a list of integers: the index of the section, the row index.

    Something like this should work:
    int row =...;
    scrollToItem (QVariantList)<>
    or
    scrollToItem (QVariantList)< section=""><>

  • Index of the current visible item ListView

    Hello

    Maby someone here knows how to do this

    I have a ListView that shows only 1 point in time (scroll in a horizontal direction)

    What signal to use or how to get the index of the currently selected item

    This is necessary because of this example:

    |--------------------|
    |        listview        |
    |         item 1        |
    |--------------------|
               1/10
    
    |--------------------|
    |        listview        |
    |         item 4        |
    |--------------------|
               4/10
    

    THX

    ListScrollStateHandler can be used to find the first visible element:

    http://developer.BlackBerry.com/Cascades/reference/bb__cascades__listscrollstatehandler.html#propert...

    Two items can be displayed simultaneously during scrolling, so I guess that extra code will be needed to determine who occupies the largest part of the screen.

  • indicator problem ListView and activity

    Hi, I was playing around with the sample application address book so that I have included a button to re-populate the list view. It takes a few seconds, that's why I've included an indicator of activity runs while the list view is being filled.

    The activity indicator is supposed to start when the button is pressed and stop when the display of the list has been entered.

    Now, my problem is that the activity indicator seems to start when the display of the list has been populated (it just starts and stops in a Flash). I have also included a header which changes the onbuttonclicked text to check if that was the problem-indicator of activity but same thing happening (text only changes after listview is filled). The list view appears to stop all operations until it was settled.

    What is the cause and how can I solve this problem? Thank you.

    onButtonClicked {}
    change the header text
    start the activity indicator
    fill listview
    }

    Then in c ++ after m_model-> insert (map) I emit a stop to the activity indicator signal.

    Indicator text and header activity does not change until the listview has been briefed.

    as the list of all the opinions of the population occurs on the event thread indicator gets no time to do things.
    If you would like to fill in the asynchronous list, it should work as expected.

    as a sidenote: have a look to refresh the headers, they are often used to reload a list.

  • To reorder ListView problem

    Hello

    10.3, reorganize the listview items is now possible via the RearrangeHandler class (https://developer.blackberry.com/native/reference/cascades/bb__cascades__rearrangehandler.html)

    I noticed during the implementation of this class that rearranging works only when the elements below are trained upward. When the elements at the top of the page it is slipped down the list, none of the signals (started, completed, updated, abandoned) don't are not fired. The user interface changes automatically isn't.

    Both the sample application or my implementation does not work when the elements above are trained more far.

    Can a BlackBerry person take a look at this? Thanks in advance.

    I tested on the official bone on the passport and classic version.

    I tried this sample and I see the same behavior that you are.  I sent the question to our development team to resolve.

    10.3.1 signals are fired, but you can not yet move items down.

  • Cascades - how to get the actual size of the item?

    Hi all

    Is it possible to get the actual width/height of the Visual element in cascade? I developed before Qt Quick applications and Qt Quick solution was simple - there's width and height properties which was always updated to the size of the real thing, and you could use them when necessary. In Silverlight, there are ActualHeight() and ActualWidth() for all visible elements. However, in the Cascades, as I see it, there are only minHeight, maxHeight, and preferredHeight and the same width, but there is no property that references element real width or height.

    I need, for example, to assign the size appropriate to the ListView items - I want to create horizontal ListView which shows only a single element (that is, the image) at a time, correctly resizes this image to fit, and works for a screen resolution and orientation. Qt Quick, I solved this by linking the width and the height to the width of the container of the element of the list element and (Rectangle) height of ListView and using the good snapMode (i.e. SnapOneItem). This works perfectly for any screen size & resolution. How can I do something like this in stunts without Hardcoding the 'magic numbers' preferredWidth and preferredHeight?

    Thanks in advance for your answer.

    You can get the width and height by using LayoutUpdateHandler of the element:

    https://developer.BlackBerry.com/Cascades/reference/bb__cascades__layoutupdatehandler.html

    LayoutUpdateHandler::create(scrollView)
        .onLayoutFrameChanged(this, SLOT(handleLayoutFrameUpdated(QRectF)));
    
  • Fill ListView using the C++ model

    Hello

    Sorry to bother, I guess my question must be pretty basic, but I'm new to bb10 SDK,

    What I intend to do is to show in a listview items, I calculated in C++. (In C++, because the logic for calculating them was quite complex)

    There, in the QT doc, you have exactly what I dream of:

    https://Qt-project.org/doc/Qt-5.1/QtQuick/QtQuick-modelviewsdata-cppmodels.html

    Unfortunately, I have several questions:

    -ownership model, seems to exist. But I guess we use dataModel in our context, right?

    -J' I also need to get the declarative context of the QmlDocument which I think is correct.

    -the delegate property also doesn't seem to exist, but I understand that I must use instead ListItemComponents ( http://developer.blackberry.com/native/reference/cascades/bb__cascades__listitemcomponent.html)

    But I'm still confused on how I should provide the data for the list view.

    Now, when I expose my QList of DataObject, as described in the Doc of QT and which gives as data to the dataModel is told that he cannot "affect QDeclarativeListReference to bb::cascades:ataModel."

    So I guess I have to use a QListDataModel instead of use a Qlist <>, or?

    Well, any help in pointing me to the right documentation would be very appreciated!

    Thank you

    fill us our data model in c ++ as well.

    For this, we use a Q_INVOKABLE method that gets the listview as a parameter.

    The ListView itself is created in QML.

    ListView* listView = dynamic_cast(listViewParameter);
    GroupDataModel* model = dynamic_cast(listView->dataModel()); if (model) {        model->clear();    } else {        model = new GroupDataModel(QStringList() << "sortParameter");        model->setGrouping(ItemGrouping::ByFullValue);        listView->setDataModel(model);    }//calculate stuffmodel->insertList(stuff);
    
  • Border of element listview

    I was wondering how do you add border of ListView items?

    Also, is it possible to change the background of the listview item to choose?

    The following code example illustrates adding a container that will simulate a border and highlighting the container for the background of the list item selected.

        content: Container {
            layout: DockLayout {
            }
            ListView {
                property variant nIndex
                id: listView
                objectName: "listView"
                horizontalAlignment: HorizontalAlignment.Center
                dataModel: MyListModel {
                    id: myListModel
                }
                listItemComponents: [
                    ListItemComponent {
                        Container {
                            layout: DockLayout {
                            }
                            preferredWidth: 768
                            preferredHeight: 70
                            background: Color.create("#000000")
                            Container {
                                layout: DockLayout {
                                }
                                preferredWidth: 768
                                preferredHeight: 60
                                background: Color.create("#ffffff")
                                id: highlightContainer
                                Label {
                                    text: ListItemData.text
                                }
                            }
                            ListItem.onSelectionChanged: {
                                if (selected) {
                                    highlightContainer.background = Color.create("#75b5d3");
                                } else {
                                    highlightContainer.background = Color.create("#ffffff");
                                }
                            }
                        }
                    }
                ]
                onTriggered: {
                    listView.select(indexPath, true);
                    listView.select(nIndex, false);
                    nIndex = indexPath;
                }
            }
        }
    

    The QmlListViewAttached object is what provides the ListItem property:

    https://developer.BlackBerry.com/Cascades/reference/bb__cascades__QmlListViewAttached.html

  • ListView - elements that are currently visible?

    Hello!

    I was unable to find a method how to check what a listview items are currently visible on the screen and which are hidden. Is there a method since beta 3 or is this planned for the Beta4?

    ScrollToItem and scrollToPosition are since the Beta3 implemented. But how to read that data?

    Any ideas?

    Well, after a night sleeping on it I retried it with your approach a second time.

    This is my solution for a horizontal scrolling list view in which each item in the list is exactly as big as the screen, so there is always only one item which is the most visible element in the list:

    listItemComponents: [
        ListItemComponent {
            type: "item"
            Container {
                attachedObjects: LayoutUpdateHandler {
                    id: luhPosition
                    onLayoutFrameChanged: {
                        lblTest.text = "XXX" + luhPosition.layoutFrame.x + " - " + Qt.pageHandler.layoutFrame.width
                        if (luhPosition.layoutFrame.x >= - Qt.pageHandler.layoutFrame.width / 2 && luhPosition.layoutFrame.x <= Qt.pageHandler.layoutFrame.width / 2) {
                            //call here a C++ routine to deliver the ID of the currently visible panel in the ListView:
    
                            testArea.background = Color.Blue
    
                        } else {
                            testArea.background = Color.DarkRed
                        }
                    }
                }
            }
            Container {
                preferredHeight: Qt.pageHandler.layoutFrame.height
                preferredWidth: Qt.pageHandler.layoutFrame.width
                background: Color.Green
                id: testArea
                Label {
                    id: lblTest
                    text: "Test"
                }
            }
        }
    ]
    

    I created a second LayoutUpdatehandler at the level of the container root in which my ListView is incorporated to get the screen resolution and provide the object inside the Listview using:

    onCreationCompleted: {
        Qt.pageHandler = pageHandler;
    }
    

Maybe you are looking for

  • Different boot disks

    Current have a 480 GB SSD and a 2 TB HDD installed on our end 2009 27 "iMac. What I want to do is to use the 2 TB as start player for my wife so that all its data (about 300 GB) is stored and to use the SSD 480 GB to store my data. Question 1: Is it

  • Satellite U300-151 - SD card slot does not

    I have the Toshiba Satellite U300-151 (PSU30E-074017AR) model that follows theSD card slot not working do not I have install windows XP SP 3, & is installed 100%, I need to fix this... Please chk this link:

  • Re: Satellite A300-1BZ white screen after logo Toshiba

    Hello The problem with my laptop, I met when I push the power on button "Toshiba leading innovation" appears and then after that the screen went white. He does not engage in windows, but the laptop has power. My OS is Windows Vista Home Premium. Plea

  • Install the network and pci controller

    Hello. I am trying to use my pc hp pavilion laptop g7-1219 wn and use the internet, but I can't use internet. I can't connect to the internet. I need to install the pci controller and network for this computer. This is the id number of network contro

  • Upgrade CPU SL410 - T5870 to i5 possible?

    Hello I have a SL410 - 2842CTO - burn a T5870 right now. What more I can spend to processor? An i5-520 or 540 would be connectable directly in it? I know that the plugs are different but do not know whether or not the motherboard has compatible Socke