ListView - Is GroupDataModel a model 'by default'?

Hello

I'm bring in C++ and I don't want to use QML.

I'm trying to create a list similar to the blackberry platform which operates an icon, title, description and status.

I was under the impression that the default behavior of the listview would show that if you define a datamodel

with the properties of the standardlistitem was looking for. Is it not the case?  What I have to put up a ListItemProvider and ListItemListener if I want these features?

I tried many variations of this (I guessed the names to reading the documentation):

GroupDataModel * model = new GroupDataModel (QStringList)<>
model-> setGrouping (ItemGrouping::None);

QVariantMap map;
map ["title"] = "Heading1";
map ["description"] = 'Description ';

map ["status"] = "Status1.
map ["type"] = "item";
model-> insert (map);

What I can't understand, why is it always displays the description field. If I do not use

'description', then it will display the 'title '.  Also, if I add more than one card, it always shows

all that is sorted shows, is that right?

In addition, the row created automatically based on the model are provide you? As, to create

a tree would you basically add another card to a property of the map. for example

Map1 QVariantMap;

QVariantMap map2;

map2 ['name'] = "Name2";

Map1 ['name'] = "Name1"
['Child'] Map1 = map2;

Hello

I could be wrong, but I think that it does not StandardListItem. It is a component Visual which can only be used in QML.

You will have to implement your own, take a look at cascadescookbookcpp for an example:

https://github.com/BlackBerry/Cascades-samples/tree/master/cascadescookbookcpp

If you need a thin selection border as in the menus of the Control Panel, it can be done using image 9-patch.

> What I don't understand, why is it always displays the description field.

It seems that the default implementation displays the first item in a container. In card keys are sorted, so it displays the description. If a QVariantList was it would probably display a first element instead.

I believe you can create a map of maps and GroupDataModel it will treat as structure multi-level providing the correct childCount() of each level, but I have not tried. ListView can display two levels, but there is the rootIndexPath property to the value of the starting node. This page has more information on indexPaths:

http://developer.BlackBerry.com/Cascades/reference/index_paths.html

In dataModel custom layout of data can be of any type.

Tags: BlackBerry Developers

Similar Questions

  • 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);
    
  • Models of default PCB

    Ultiboard provides a way of redefining what contains the default PCB project?

    Now, as soon as you open Ultiboard and select "create new project... ', it opens to the design with no space.  What is cool at the moment, you draw your rectangle Board, add a title block, etc, etc, life goes on.

    However, we seek to keep our design as possible consistent layout between the different engineers.  So, what I would do is create a contour of the blank map, add a title block and any other area of descriptions of text that I want and then save it as the new default project template.  This way, the next time I create a new Board of Directors, I'm starting with my preconfigured cartridge and description of field arrangement.  Is this possible?

    Hello

    Multisim/Ultiboard includes the ability to create user models, essentially a Multisim file (for your schema) and Ultiboard file (for the presentation of PCB). Details can be found at:

    Quickly prototype with Multisim and Ultiboard user-defined models

    I hope this helps!

    Fernando

  • Notify the ListView data in the model have changed

    Hello!

    I know this question has been asked several times, but I have yet to find anything satisfactory.

    I have a ListView, filled with a QListDataModel.

    After some time I update an element of the model. So far, the only way I found to the ListView so that this change is to delete the model and then reappend all elements. But the problem with this approach is that ListView Flash and scroll to the top of the page. Is there anything better to just say ListView that it should update the visible elements?

    Thank you

    Well, I just signal myself in the WRITE method and it works.

  • Re: What is the model of default keyboard in a Qosmio G30?

    Hello
    I have a Qosmio G30-155 which I had arranged with additional partitions. Recently, I did a complete reinstall of Windows Vista, but I have not used the Vista DVD provided with my computer because it would destroy my partitions. So, I used a standard DVD of Vista. Everything works well except two questions: the computer is not responding to shortcut keys, or IR remote. Laptop infiltrates the IR signals, because when one presses a button on the IR remote control, a few lights in the remote and computer. However, nothing else happens.

    I installed several configurations of the packages 'remote control manager', "Added value package" and "Support" button, nothing helps.

    I checked the Device Manager, and my keyboard appears as a "PS/2 Standard keyboard. I guess that this setting is false, because this keyboard would not have access keys. So, this setting could be cause my problems.

    Can someone tell me which type of keyboard G30s were?

    Thank you and best regards

    I agree with Akuma
    There is no special keyboard drivers and those drivers are not needed.,.
    The Windows operating system, no matter if it of Vista or XP, uses the Microsoft keyboard driver.

    To enable the keys FN and Toshiba control buttons the VAP (value added package) must be installed

    You must ensure that you have chosen the correct drivers for the laptop G30.
    The G30-155 seems to belong to the series of PQG32E so chose exactly this model in the form of download number.

  • After you remove models 5 default the configuration section is now disabled.

    Hello world

    Just installed Photoshop CS6. I deleted the default templates and now I want to import my patterns.pat. I imported successfully, but the bosses of section is now disabled (gray). So I can't access my bosses! How can I activate the bosses again?

    Sorry, I just had to restart Photoshop, now it is activated again (in the properties of the layer)

  • Models of default responses

    http://lh6.ggpht.com/_rhCtHYLiamQ/S5EUBvp6DfI/AAAAAAABXtY/SnEtDnGNKSc/S800/01_example.PNG

    Sorry, but the! doesn't seem to work properly, you have to click through.

    The first column is a dimension, the following 2 are measures of a fact table.

    Note how the style is different? I don't want to... I want to keep it consistent.

    Using true firebug, I note the different classes used.

    Column dimension
    <th style="background-color: rgb(231, 231, 247); font-size: 9px; color: rgb(0, 51, 102);" class="ColumnHdg" scope="col" dir="ltr">Product Desc</th>
    Measure column
    <th class="ColumnHdg" scope="col" dir="ltr">Basis Amount</th>
    I grepped the web folder and could not find any reference to the style tag in the Dimension column. These statements of inline css are the substitution of the ColumnHdg class, but I can't find where that is defined. It does not appear that the files have changed in the msgdb or res files (timestamp is the date of installation).

    So my question is, where else can I look to see where this style attribute could apply?

    Looks like you forgot to reset the OOB settings when installing OBIEE:
    Have a look here to reset the:
    http://obiee101.blogspot.com/2009/02/OBIEE-editing-system-wide-defaults.html

    concerning

    John

    http://obiee101.blogspot.com

  • Model by default - table cell has no border when the cell is empty: IE6

    Hello

    I use the model: dark blue with the model of report of ratings in the region.
    I have a problem in displaying the result in IE6.

    When a cell is empty, I have white border in my table instead of edge banding.

    Do you know where I can fix this?

    Thank you

    Roseline

    Roseline,

    You must locate the corresponding css file and look for something like it's - t10 is the number of my theme so replace it with your theme

    Th.t10ReportHeader

    TD.t10data

    TD.t10dataalt

    and add the following code to the css classes:

    empty-cells:show;border-collapse:collapse;
    

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • Cancel/model of default slide

    Hello

    I have created a caption box in one of my slides and accidentally selected, apply to all > slides? Apply to all slides. Now I have that same box of legend (apparently) incorporated in each subsequent slide of the project. I can't move, delete or even highlight the area, because it seems to be a background image.


    I tried to change the background image for the slide service, but this removes the images that are already there.

    When I try to insert a blank slide, it inserts a slide with this same box integrated in it. The box does not appear in the film strip, only in the editing pane.

    Anyone know how I can cancel the change I made?

    Hello

    I'm glad that my intuition was good

    For the sake of other readers: it is possible to mark your question as a reply?

    Lilybiri

  • WORDPAD: HOW TO DEFINE MODEL DEFAULTS TO SINGLE SPACE?

    My computer came with Wordpad.  The model 'by default' seems to be set to double space and I don't know how to change it so that the default value is a single space (ie. like my ad here). Itdoesn't seem to be a 'box' in the menu at the top of the page - on the same line as the font settings/size - titled ' line spacing: change the spacingbetween of text lines ") but it doesn't seem to work ! Or, at least, I don't know how to operate it. I tried to play with the settings made here, but nothing that I don't seem to make any difference.

    In the line spacing box, you should be able to select; 1.0, 1.15, 1.5 or 2.0

  • How to apply filters to the Listview created using GroupDataModel?

    Hello

    I have created a listview with groupdatamodel, now I want to apply filters for listview. How to do this?

    Please help me. (As looking for contacts)

    Kind regards

    Naresh Kodumuri.

    Hello

    I found the solution for the application of filters to the listview.

  • Change default model navigation in the portal generator

    Hello

    I develop a portal 11.1.1.8 Webcenter portal using the portal generator. I created a new Navigation model.  Now, I want to assign as the model of default navigation for the portal, I had created.

    When I go to the link to Administration-> settings, Navigation is not editable. Other things like Page Template, Skins etc can be changed. Is there a way I can change the value by default model of Navigation for my portal?

    According to the link here: http://docs.oracle.com/cd/E29542_01/doc.1111/e27603/portadv_admin.htm#CHDDEIIA

    The navigation model for a particular site cannot be changed after creation. Instead, we can change the default Navigation model based on our needs.

  • Change SQL model #4 and default SQL DDL #5

    Hello

    on the FSCM 9.1, 52.0 on Win 2008 Server tools;

    to force AE statistics we should do:

    6 change SQL #4 and #5 DDL SQL model by default for the Oracle platform to allow through option when updating

    Recommended in:

    RED_PAPER_ - _PeopleSoft_Enterprise_Performance_on_Oracle_11g_Database.pdf

    Can you be kind and tell us how to find (SQL #4)?

    Thank you.

    DDL models are under

    PeopleTools > utilities > Administration > DDL default model

    Select the Oracle platform in the search, and you should get a scroll with 5 rows. Lines 4 and 5 must begin with DBMS_STATS. GATHER_TABLE_STATS

    You can also consider to download the tool from Oracle's Support:

    pscbo_stats - improve statistics in RDBMS to Oracle for PeopleSoft Enterprise [1322888.1 ID]

    See the statistics of PeopleSoft database update for more information.

    Kind regards

    Bob

  • ListView filling does not

    Hi all

    ListView in my app is not filling, here is the code snippet

    ListView {
                        id:sectionlistview
                        objectName: "sectionlistview"
    
                        ///dataModel: groupDataModel
                        listItemComponents: [
                            ListItemComponent {
                                id:row
                                type: "item"
                                CustomListItem {
                                    dividerVisible: true
                                    highlightAppearance: HighlightAppearance.Default
                                    Container{
                                        opacity: 0.9
                                        background: Color.create("#c0c0c0")
                                        layout: StackLayout {
                                         orientation: LayoutOrientation.TopToBottom
                                        }
                                        Label {
                                            text: ListItemData.name
                                            textStyle.base: myStyle.style
                                            textStyle.color: Color.create("#ffffff")
                                        }
                                    }
                                }
    
                            }
                        ]
                    }
    
    void ApplicationUI::fetchData(){
            listView = root->findChild("sectionlistview");
            model = new GroupDataModel(QStringList() << "name");
            model->clear();
            model->setGrouping(ItemGrouping::None);
            model->insert(dataName);
            listView->setDataModel(model);
    }
    

    dataName is a QVariantMap variable. The data are available in the variable, I checked that.

    The following, almost identical to yours works for me. There are a few things in your code, which I don't see, so it is difficult to check every detail. First, create a new application and replace applicationui.cpp, applicationui.hpp and main.qml with my code and then test it. If it works, check if your code against mine. If not, let me know the device and the version of the OS that you are testing.

    #ifndef ApplicationUI_HPP_
    #define ApplicationUI_HPP_
    
    #include 
    
    namespace bb
    {
        namespace cascades
        {
            class Application;
            class LocaleHandler;
        }
    }
    
    class QTranslator;
    
    /*!
     * @brief Application object
     *
     *
     */
    
    class ApplicationUI : public QObject
    {
        Q_OBJECT
    public:
        ApplicationUI(bb::cascades::Application *app);
        virtual ~ApplicationUI() { }
        Q_INVOKABLE void fetchData();
    
    private slots:
        void onSystemLanguageChanged();
    private:
        QTranslator* m_pTranslator;
        bb::cascades::LocaleHandler* m_pLocaleHandler;
    
    };
    
    #endif /* ApplicationUI_HPP_ */
    

    applicationui. HPP

    #include "applicationui.hpp"
    
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    
    using namespace bb::cascades;
    
    static AbstractPane *root = 0;
    
    ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
            QObject(app)
    {
        // prepare the localization
        m_pTranslator = new QTranslator(this);
        m_pLocaleHandler = new LocaleHandler(this);
    
        bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()));
        // This is only available in Debug builds
        Q_ASSERT(res);
        // Since the variable is not used in the app, this is added to avoid a
        // compiler warning
        Q_UNUSED(res);
    
        // initial load
        onSystemLanguageChanged();
    
        // Create scene document from main.qml asset, the parent is set
        // to ensure the document gets destroyed properly at shut down.
        QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
        // Create root object for the UI
        root = qml->createRootObject();
    
        // Set created root object as the application scene
        app->setScene(root);
    
        qml->setContextProperty("app", this);
    
    }
    
    void ApplicationUI::onSystemLanguageChanged()
    {
        QCoreApplication::instance()->removeTranslator(m_pTranslator);
        // Initiate, load and install the application translation files.
        QString locale_string = QLocale().name();
        QString file_name = QString("SupportListView_%1").arg(locale_string);
        if (m_pTranslator->load(file_name, "app/native/qm")) {
            QCoreApplication::instance()->installTranslator(m_pTranslator);
        }
    }
    
    void ApplicationUI::fetchData()
    {
    
        QVariantMap dataName;
        dataName["name"] = "Martin";
        ListView* listView = root->findChild((const QString) "sectionlistview");
        GroupDataModel* model = new GroupDataModel(QStringList() << "name");
        model->clear();
        model->setGrouping(ItemGrouping::None);
        model->insert(dataName);
        listView->setDataModel(model);
    }
    

    applicationui.cpp

    import bb.cascades 1.2
    
    Page {
        Container {
            //Todo: fill me with QML
            Label {
                // Localized text with the dynamic translation and locale updates support
                text: qsTr("Hello World") + Retranslate.onLocaleOrLanguageChanged
                textStyle.base: SystemDefaults.TextStyles.BigText
            }
            Button {
                text: "Fetch Data"
                onClicked: {
                    app.fetchData();
                }
            }
            ListView {
                id: sectionlistview
                objectName: "sectionlistview"
    
                ///dataModel: groupDataModel
                listItemComponents: [
                    ListItemComponent {
                        id: row
                        type: "item"
                        CustomListItem {
                            dividerVisible: true
                            highlightAppearance: HighlightAppearance.Default
                            Container {
                                opacity: 0.9
                                background: Color.create("#c0c0c0")
                                layout: StackLayout {
                                    orientation: LayoutOrientation.TopToBottom
                                }
                                Label {
                                    text: ListItemData.name
                                    textStyle.base: myStyle.style
                                    textStyle.color: Color.create("#ffffff")
                                }
                            }
                        }
    
                    }
                ]
            }
        }
    }
    

    hand. QML

    Good luck!

    Martin

  • Update of ListView dummy image using images from URL http

    Hi guys...

    Please help me with this.

    I have created a ListView in QML file and filled with data received from a webservice. Since this web service provides all the images, I have to place a dummy image at this location. Then I used another method to retrieve images of the url. Now, I got the image in my CPC file. But I could not update my listview. I tried several methods. But failed.

    Here is my code snippet.

     ListView {
                    id: listView
                    objectName: "listView"
    
                    dataModel: ArrayDataModel {
                        id: myListModel
    
                    }
    
                    // Override default GroupDataModel::itemType() behaviour, which is to return item type "header"
                    listItemComponents: ListItemComponent {
                        id: listcomponent
                        // StandardListItem is a convivience component for lists with default cascades look and feel
                        StandardListItem {
                            title: ListItemData.postText
                            description: ListItemData.postDate
                            status: ListItemData.filePath
                            imageSource: "asset:///images/4.png"
                        }
    
                    }
                    layoutProperties: StackLayoutProperties {
                        spaceQuota: 1.0
                    }
                    horizontalAlignment: HorizontalAlignment.Fill
                    verticalAlignment: VerticalAlignment.Fill
    
                }
    

    In the PRC, I get my image like this.

    void PostHttp::imageFetcher(){
    const QUrl url("http:///828/828_20135312012288.png");
    if (flag1 == true) {
        get(url);
    }
    }
    void PostHttp::onImageReply(){
        QNetworkReply* reply = qobject_cast(sender());
        QString response;
        QImage img;
        QString filePathWithName = "data/img/";
        QString imageName;
    
        if (reply) {
                if (reply->error() == QNetworkReply::NoError) {
                    flag1 = false;
                    const int available = reply->bytesAvailable();
                    if (available > 0) {
                    const QByteArray buffer(reply->readAll());
                    response = QString::fromUtf8(buffer);
                    img.loadFromData(buffer);
                    img = img.scaled(40, 40, Qt::KeepAspectRatioByExpanding);
                    const QImage swappedImage = img.rgbSwapped();
                    const bb::ImageData imageData = bb::ImageData::fromPixels(
                            swappedImage.bits(), bb::PixelFormat::RGBX,
                            swappedImage.width(), swappedImage.height(),
                            swappedImage.bytesPerLine());
                    bb::utility::ImageConverter::encode(QUrl(QDir::currentPath() + "/shared/camera/img.png"), imageData, 75);
                    qDebug()<<"current path is "<
    

    Thanks in advance

    You can pass a QByteArray of image data coded directly to an imageView in the image property, set of QVariant::fromValue (). However, in your case you can place the uri to which you saved the image and not the bytes. Advantage: cascades puts these images in cache. If you use deterministic file names, you can avoid any networking calls or loading of images when only the populated list of point sier after be recycled.

    img.loadFromData(buffer);
    img = img.scaled(40, 40, Qt::KeepAspectRatioByExpanding);
    img.save(QDir::currentPath() + "/shared/camera/img.png"), 0, 75);
    

    QImage can do all this for you, without permutation of bytes.

    All you have to do is then updated the datamodel.

Maybe you are looking for

  • OfficeJet 6500 a Plus: HP Scan &amp; Print uility? missing?

    I had used this software successfully for some time. I just had to create a new Windows user profile (former got corrupted).  Now I find it useful.  I don't know it's just a setting somewhere. Please notify earlier. Thank you!

  • Organization___ of files in Windows XP

    I'd like to understand how windows XP organize files.For example, when I click on 'my computer' there is a my documents folderBut if I click on "disk local c:" I also find my documents under documents and settings/owner/my documents This is not an ur

  • Error code internal 2753 everything trying to remove Java

    Original title: internal error code 2753 I get this error code when I try to remove Java from my computer and also try to download a Java Update. Is there anything I can do to fix this problem.

  • Can not defragment my hard drive, stuck at 18%

    Original title: defragment my hard drive. Hello, I am running windows 7 pro and cannot defragment my hard drive. He had the same percentage on it seems like forever. 18%. my laptop is a few years old and was never Defrag. can someone help me please.

  • onSwipeDown Menu

    Hi all I try to add a menu located in the bezel blow in my app Playbook. I use this code here to make it work: http://supportforums.blackberry.com/t5/tkb/articleprintpage/tkb-id/browser_dev@tkb/article-id/88 Unfortunately the code does not work durin