Application of C++ ListView

Hello

I am developing an application that uses a ListView in C++, but the last element of the list printed by the console is displayed at the top of the listview in the application.

I tried affecting Crescent sorted to true and false but does not seem to make any difference, so I tried to add a sort field (in this case, it's a track number and it sorts correctly but if there are more than 9 titles, then it sorts all the following list under the heading of '1'.)

Therefore, I'm looking to sort listview with the first element of the list printed in the console to be at the top of the listview in the application and also to sort by track number and if the number is greater than 9, it can be sorted in a header from 10, 11 etc.

    m_NewDataModelTrack = new GroupDataModel(QStringList() << "trackNumber");
    m_NewDataModelTrack->setSortedAscending(true);
    m_NewDataModelTrack->setGrouping(ItemGrouping::None);

    QVariantMap newMap2;

    QVariantList secondary = jsonData.toMap().value("items").toList();
    for (QList::iterator it2 = secondary.begin(); it2 != secondary.end(); it2++) {

        QVariantMap mapReturnInfo2 = it2->toMap();
newMap2["trackNumber"] = mapReturnInfo2.value("track_number").toString();

 m_NewDataModelTrack->insert(newMap2);

    }

m_listViewTrack = Application::instance()->findChild("listViewTrack");

m_listViewTrack->setDataModel(m_NewDataModelTrack);

Any help would be greatly appreciated

Finished by sorting according to one of the field and then used setSortedAscending (true) so now it works like a list from A to Z; not quite what I was looking but the watch, it would be easier for the user to navigate and find objects

m_NewDataModel = new GroupDataModel(QStringList() << "track");
m_NewDataModel->setSortedAscending(true);
m_NewDataModel->setGrouping(ItemGrouping::None);

Tags: BlackBerry Developers

Similar Questions

  • Can not access the context property of the Interior of the ListView checkbox - onCheckedChange event

    I have a context property called "app" that connects to my C++ application. My listview has a box with onCheckedChange event listener. In this method, when I make a call to the C++ side. application app.runAction, the system displays not found error app.

    If I move the box outside the list view, it will correctly trigger app.runAction.

    Can you please take a look? Thank you!

    On the side of C++ on how I set the context property.

    QmlDocument * qml = QmlDocument::create("asset:///main.qml").parent(this);

    If (qml-> {hasErrors())}
    Returns false;
    }

    QML-> setContextProperty ("app", this);

    navigationPane = qml-> createRootObject();
    If (! navigationPane) {}
    Returns false;
    }

    QML side

     

    NavigationPane {}
    ID: nav

    {Page}
    ID: mainPage
    {Of container

    {To ListView

    listItemComponents:]
    {ListItemComponent}
    type: 'point '.
    {Of container

    Checkbox {}
    Determine whether the check box should be checked
    According to a value in the data model
    checked: ListItemData.checked
    onCheckedChanged: {}
    app.testAction ();
    }
    }

    This is a scope issue... I really hope the devs find a way to fix it properly apart from this ugly solution:

    You can solve this problem by setting your app variable in the global object Qt

    NavigationPane {
        id: nav
    
    onCreationCompleted: Qt.app = app
    
    Page {
            id: mainPage
            Container {
    ListView {
    listItemComponents: [
            ListItemComponent {
                            type: "item"
                            Container {
                       CheckBox {
                                    // Determine whether the CheckBox should be checked
                                    // according to a value in the data model
                                    checked: ListItemData.checked
                                    onCheckedChanged: {
                                         app.testAction();
                                         Qt.app.testAction();
                                    }
                                }
    

    all code in a ListItemComponent will suffer from this 'framing' question

  • Find the child component of the root in C++

    Hi all

    In my application I am after this architecture for creating interface user TabbebedPane then in the first tab of TabbedPane I a NavigationPage then I created a page in the navigation page and then there is a listview in the page.

    I am facing following problems

    1 when I push the Navigation pane by setting ActiveTab property to set the first tab as the active tab Page does not freeze it.

    2. when I try to find this listview in C++ code to bind GroupDataModel to display the data I get server.

    I use this code to get the listview

    ListView * listview = Application::instance()->findChild ("listview");

    Help, please

    Concerning

    Thank you all,

    Problem solved. I made a mistake. I was binding qml with the navigation pane using ComponentDefinition that create dynamic components of QML, and that's why I wasn't getting ListView using ObjectName or id of the list.

    The solution to this problem is: the tab like this Setcontent

    Code snippet

    TabbedPane{
    Tab {
            id: tab
            objectName: "Tab1"
            title: qsTr("TITLE")
            imageSource: "asset:///images/Chat.png"
            content: NextPage{
                id:test
            }
        }
    .....
    ...
    ....
    
    }
    

    Thanks and greetings

  • How to analyze an XML using C++ or Cascades

    Hello

    I'm developing a simple application of the Listview, this need for an updated list with the response from the server in XML, the XML as below:

    
    
       
          Gambardella, Matthew
          XML Developer's Guide
          Computer
          44.95
          2000-10-01
          An in-depth look at creating applications
          with XML.
       
       
          Ralls, Kim
          Midnight Rain
          Fantasy
          5.95
          2000-12-16
          A former architect battles corporate zombies,
          an evil sorceress, and her own childhood to become queen
          of the world.
       
       
          Corets, Eva
          Maeve Ascendant
          Fantasy
          5.95
          2000-11-17
          After the collapse of a nanotechnology
          society in England, the young survivors lay the
          foundation for a new society.
       
       
          Corets, Eva
          Oberon's Legacy
          Fantasy
          5.95
          2001-03-10
          In post-apocalypse England, the mysterious
          agent known only as Oberon helps to create a new life
          for the inhabitants of London. Sequel to Maeve
          Ascendant.
       
       
          Corets, Eva
          The Sundered Grail
          Fantasy
          5.95
          2001-09-10
          The two daughters of Maeve, half-sisters,
          battle one another for control of England. Sequel to
          Oberon's Legacy.
       
       
          Randall, Cynthia
          Lover Birds
          Romance
          4.95
          2000-09-02
          When Carla meets Paul at an ornithology
          conference, tempers fly as feathers get ruffled.
       
       
          Thurman, Paula
          Splish Splash
          Romance
          4.95
          2000-11-02
          A deep sea diver finds true love twenty
          thousand leagues beneath the sea.
       
       
          Knorr, Stefan
          Creepy Crawlies
          Horror
          4.95
          2000-12-06
          An anthology of horror stories about roaches,
          centipedes, scorpions  and other insects.
       
       
          Kress, Peter
          Paradox Lost
          Science Fiction
          6.95
          2000-11-02
          After an inadvertant trip through a Heisenberg
          Uncertainty Device, James Salway discovers the problems
          of being quantum.
       
       
          O'Brien, Tim
          Microsoft .NET: The Programming Bible
          Computer
          36.95
          2000-12-09
          Microsoft's .NET initiative is explored in
          detail in this deep programmer's reference.
       
       
          O'Brien, Tim
          MSXML3: A Comprehensive Guide
          Computer
          36.95
          2000-12-01
          The Microsoft MSXML3 parser is covered in
          detail, with attention to XML DOM interfaces, XSLT processing,
          SAX and more.
       
       
          Galos, Mike
          Visual Studio 7: A Comprehensive Guide
          Computer
          49.95
          2001-04-16
          Microsoft Visual Studio 7 is explored in depth,
          looking at how Visual Basic, Visual C++, C#, and ASP+ are
          integrated into a comprehensive development
          environment.
       
    
    

    Please how can I parse the XML file.

    Thank you

    QXmlStreamReader for parsing XML files

    http://doc.Qt.Nokia.com/4.7-snapshot/qxmlstreamreader.html

    ... and for writing QXmlStreamWriter

    http://doc.Qt.Nokia.com/4.7-snapshot/qxmlstreamwriter.html

    The Reader bookmarks will be a great example for you:

    http://doc.Qt.Nokia.com/4.7-snapshot/XML-streambookmarks.html

  • Update QListDataModel of c + c++ / QML

    I have a QVariantList and from there I'm creating a QListDataModel and its application in my ListView in QML.

    My problem is that I do this, where my main page of QML is created in C++, and when I add to the list of the loose or change them that they are not updated.

    I have read that I need to signals and what did not, and then make the changes directly in the model for them to be updated.

    My question is how I updated the model of data outside of my function to create C++ main UI that I don't know how to access the data model in C++ for the specific listview or QML.

    ApplicationUI::ApplicationUI(bb::cascades::Application *app)
    : QObject(app)
    {
        // create scene document from main.qml asset
        // set parent to created document to ensure it exists for the whole application lifetime
        QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
        // create root object for the UI
        AbstractPane *root = qml->createRootObject();
        // set created root object as a scene
        qml->setContextProperty("app", this);
        app->setScene(root);
    
        QSettings settings;
        qList = settings.value("list").toList();
    
        ListView* myList = root->findChild("myListView");
    
        model = new QListDataModel;
        model->setParent(this);
        model->clear();
    
        for (int i  = 0; i  < qList.length(); ++ i ) {
            myListModel *myModel= new myListModel(i);
            model->insert(i,myModel);
        }
    
        myList->setDataModel(model);
        myList->setVisible(true);
        qmlRegisterType("com.example", 1,0, "myListModel");
    }
    
    void ApplicationUI::updateList(){
    
        //QListDataModel  *model = Application::instance()->scene()->findChild("myListModel");
    }
    

    For reference, all I had to do was keep the pointer to the global listview and instead of update of specific items, I recreate a new model with new data and apply the new model on this listview.

    May be ineffective, but if I did that several items in my list of great works.

  • How to share files from Android ported app to social applications such as BBM whatsapp FB etc.

    I have an application that has a listview that fills all the music files as .mp3 etc.

    I can multiselect and remove or play in the list...

    Problem:

    When I try to share MP3 files using the social part of the app with another app it populates the MMS and Email how to add BBM app and other apps Socual whats in this action app for app... Please show us example please

    Such me please where can I find an example of this kind of action? Thank you

    Hey madmaskd,

    Currently you can share only to an Android app from a native application, as long as the intent filter is setup accepts intentions on part.

    You will not be able to share from an Android application, at the present time, however.

  • How to detect when ListView recycles an ImageView?

    I have a ListView with items ~ 600 in a 4-wide grid. Each element is a WebImageView (inherits from ImageView, slightly modified from code kindly provided here) over a label.

    Everything works spot - we (and performance is awesome) except for one glaring problem: when I sometimes momentarily the ImageView ListView displays scrolling scrolls the erroneous image of an item that was previously on. Sometimes it moves even between two prior images before displaying the right pair. These problems are happening because applications for network WebImageView queues upward because the visible element has been recycled once or even twice.

    What I need to solve this problem is to know when the WebImageView has been recycled by ListView in order to disconnect the network signals and erase the old image. I can't find how to do this.

    So I have a "fix" that is more than a workaround. In the WebImageView, I added a member variable:

    int m_iCurrentRequestIndex;

    Whenever WebImageView has applied for a network, I add m_iCurrentRequestIndex as an attribute of the QNetworkRequest and then increment.

    When I receive the response from the network, I check if the value of attraibute for example a_reply-> request (.attribute (...)) and throw the answer if it is not the last.

    Not a very good solution because it is always that which allows network support needless to proceed and just throw the results, but at least it works. But if anyone can answer the question in the original post, I who brand as the solution because it will allow for better efficiency. I want to know a signal or something available at WebImageView that is called when ListView is recycled as:

    WebImageView::onRecycled()
    {
        // close() and disconnect() current QNetworkRequest().
    }
    
  • ListView will not display datamodel set of c ++

    I have a listview that retrieves a file from a web service json and it analyzes in a datamodel (tried GroupDataModel and QListDataModel). Thanks to some discussions that I found here, I managed to get the data in the data model and attach properly to the listview. which I checked through debugging.

    However; When I return to QML, I'm not able to get the data to display.

    My loots listview like that at the moment, but it's really just a lighter version of what I want, since I'm trying to make it work:

    ListView {
                                objectName: "list"
                                listItemComponents: [
                                    ListItemComponent {
                                        type: "item"
                                        Container {
                                            id: root
                                            WebImageView {
                                                url: ListItemData.image
                                            }
                                            Label {
                                                text: ListItemData.title
                                            }
                                        }
                                    }
                                ]
                            }
    

    Regarding my code, c ++, I use the Twitter example found here as my base:

    http://supportforums.BlackBerry.com/T5/Cascades-development/method-for-making-an-HTTP-style-request-...

    For reference, if I try to use QListDataModel, my cards will eventually look like this:

     QMap(("Description", QVariant(QString, "Description here") ) ( "image" ,  QVariant(QString, "https://image.com/image.jpg") ) ( "title" ,  QVariant(QString, "title") ) )
    

    As I said, I see the datamodel get associated with my list by list-> setDataModel (model); but it does not display anything. I'm sure it's something on the side QML that I'm hurting, but hopefully someone here can help.

    So, I realized my problem while working on another part of the application.

    Unlike the example of Twitter I've provided, I wasn't using a global variable for * root. I believe that when I started with this example, that part was giving me problems, so I used local variables. For this reason, my application created the root object in the initialization and the method of "GetTimeline".

    Once I did fixed it is global, the list filled.

    Thanks for your help on this everyone.

  • QML ListView

    Hello people!

    I'm developing an application in which I use a ListView filled by an XML file (as for now), but I want to make entries bigger and maybe even a little cloroful. Found nothing about that.

    Any help?

    Wildcat

    ListView {
    
      listItemComponents: [
          ListItemComponent {
              type: "item"
    
              CustomListItem {
                  Label{
                      text: ListItemData.title
                  }
              }
          }
      ]
    }
    

    CustomListItem (or something like that), you should get what you want. Instead of the label, you can use container and put in as much as you want

  • Strange behavior of ListView

    Hello
    I use following code:

     ListView {       id: listView listItemComponents: ListItemComponent {           Container {               id: listItemContainer               property string packageId: ListItemData.packageId               property variant packageDetailsPage               layout: AbsoluteLayout { }               WebImageView               {                   preferredHeight: 290                   preferredWidth: 751                   url: ListItemData.url;              }          }     }
    

    code for WebImageView:

    webimageview. HPP

    #ifndef WEBIMAGEVIEW_H_
    #define WEBIMAGEVIEW_H_
    
    #include 
    #include 
    #include 
    #include 
    using namespace bb::cascades;
    
    class WebImageView: public bb::cascades::ImageView {
        Q_OBJECT
        Q_PROPERTY (QUrl url READ url WRITE setUrl NOTIFY urlChanged)
        Q_PROPERTY (float loading READ loading NOTIFY loadingChanged)
    
    public:
        WebImageView();
        const QUrl& url() const;
        double loading() const;
    
        public Q_SLOTS:
        void setUrl(const QUrl& url);
        void clearCache();
    
        private Q_SLOTS:
        void imageLoaded();
        void dowloadProgressed(qint64,qint64);
    
        signals:
        void urlChanged();
        void loadingChanged();
    
    private:
        static QNetworkAccessManager * mNetManager;
        static QNetworkDiskCache * mNetworkDiskCache;
        QUrl mUrl;
        float mLoading;
    
        bool isARedirectedUrl(QNetworkReply *reply);
        void setURLToRedirectedUrl(QNetworkReply *reply);
    };
    
    #endif /* WEBIMAGEVIEW_H_ */
    

    webimageview.cpp

    #include "WebImageView.h"
    #include 
    #include 
    //#include 
    #include 
    
    using namespace bb::cascades;
    
    QNetworkAccessManager * WebImageView::mNetManager = new QNetworkAccessManager();
    //QNetworkDiskCache * WebImageView::mNetworkDiskCache = new QNetworkDiskCache();
    
    WebImageView::WebImageView() {
        // Initialize network cache
        //mNetworkDiskCache->setCacheDirectory(QDesktopServices::storageLocation(QDesktopServices::CacheLocation));
    
        // Set cache in manager
        //mNetManager->setCache(mNetworkDiskCache);
    
        // Set defaults
    
        mLoading = 0;
    }
    
    const QUrl& WebImageView::url() const {
        return mUrl;
    }
    
    void WebImageView::setUrl(const QUrl& url) {
        // Variables
    
            mUrl = url;
            mLoading = 0;
            qDebug()<<"url:: "<get(request);
    
            // Connect to signals
            QObject::connect(reply, SIGNAL(finished()), this, SLOT(imageLoaded()));
            QObject::connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(dowloadProgressed(qint64,qint64)));
    
            emit urlChanged();
    
    }
    
    double WebImageView::loading() const {
        return mLoading;
    }
    
    void WebImageView::imageLoaded() {
        // Get reply
        QNetworkReply * reply = qobject_cast(sender());
        QObject::disconnect(reply, SIGNAL(finished()), this, SLOT(imageLoaded()));
        QObject::disconnect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(dowloadProgressed(qint64,qint64)));
        if (reply->error() == QNetworkReply::NoError) {
            if (isARedirectedUrl(reply)) {
                setURLToRedirectedUrl(reply);
                return;
            } else {
                QByteArray imageData = reply->readAll();
                setImage(Image(imageData));
            }
        }
        // Memory management
        reply->deleteLater();
    }
    
    bool WebImageView::isARedirectedUrl(QNetworkReply *reply) {
        QUrl redirection = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
        return !redirection.isEmpty();
    }
    
    void WebImageView::setURLToRedirectedUrl(QNetworkReply *reply) {
        QUrl redirectionUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
        QUrl baseUrl = reply->url();
        QUrl resolvedUrl = baseUrl.resolved(redirectionUrl);
    
        setUrl(resolvedUrl.toString());
    }
    
    void WebImageView::clearCache() {
        //mNetworkDiskCache->clear();
    }
    
    void WebImageView::dowloadProgressed(qint64 bytes, qint64 total) {
        mLoading = double(bytes) / double(total);
    
        emit loadingChanged();
    }
    

    I use ListDataModel. and code above works fine and the loading of the images. But when there are more than 100 items in a list it shows the bad images in some WebImageView. When you scroll through random images change. I checked the url property of webImageView to the point where bad image is loaded, but there the right url.

    in this connection, blackberry says that view list follows MVC architecture, and QObject belonged to ListView objects are deleted when scrolling out of the area visible to the element to which they belong, or when the ListView itself is deleted. What is the cause of my problem? If not, this what's wrong with this code? Help, please...

    nik005 wrote:

    @ekke Yes. If I scroll slowly, it works fine.

    THX.

    Then, it's the same reason.

    as soon as I have a small reproducible application to create a problem, I'll add this thread and let you know

  • Share images in listview

    Hello

    I'm loading (included in the assets of the project) png images in a ListView. Then I want to trigger the framework of the call to share the selected image. And I want to let him choose what applications list. Is this the right way to go:

    ListView {
        layout: GridListLayout {}
        dataModel: XmlDataModel {
            source: "data.xml"
        }
    
        listItemComponents: [
            ListItemComponent {
                type: "image"
    
                ImageView {
                    imageSource: ListItemData.imagePath
                }
            }
        ]
        attachedObjects: [
            Invocation {
                id: invoke
                query {
                    mimeType: "image/png"
                }
            }
        ]
    
        onTriggered: {
            var selectedItem = dataModel.data(indexPath);
            invoke.uri = selectedItem.imagePath;
            invoke.trigger("bb.action.SHARE");
        }
    }
    

    Thanks for your help,
    Laurent

    OK sorry it works. I couldn't scroll because listview is initially another container.

  • How to get the content of the list item selected ListView using CPP?

    Hello

    I do a simple application, get the content of the list item selected ListView using CPP, in the main.qml file, I created a listview using XMLDataModel and I got the selected listview using dataModel.data (row) .attributeNameInXmlfile in qml. content as in the same way the ListView using cpp.please help me I want to get the content of the listitem selected.

    Here is my code

    hand. QML

    import bb.cascades 1.0
    
    Page {
        content: Container {
            id: mainContainer
            objectName: "container"
            // property alias selectedText: selectedTextField.text
            //property alias deselectedText: deselectedTextField.text
            ListView {
                objectName: "listView"
                dataModel: XmlDataModel {
                    source: "models/items.xml"
                    id: model
                }
                listItemComponents: [
                    ListItemComponent {
                        type: "item"
                        StandardListItem {
                            title: ListItemData.title
                        }
                    }
                ]
            }
            TextField {
                id: selectedTextField
                objectName: "selectedTextField"
                text: ""
            }
            TextField {
                id: deselectedTextField
                objectName: "deselectedTextField"
                text: ""
            }
        }
    }
    

    App.cpp

    #include "app.hpp"
    
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    using namespace std;
    
    using namespace bb::cascades;
    QObject *textFieldSelected ;
    QObject *textFieldNotSelected;
    QObject *list;
    App::App() {
        QmlDocument *qml = QmlDocument::create("main.qml");
        AbstractPane *root = qml->createRootNode();
        list = root->findChild("listView");
        textFieldNotSelected = root->findChild("deselectedTextField");
        textFieldSelected = root->findChild("selectedTextField");
        QObject::connect(list,SIGNAL(selectionChanged (QVariantList, bool)),this,SLOT(changeText(QVariantList, bool)));
        Application::setScene(root);
    }
    
    void App::changeText(QVariantList indexPath,bool selected) {
    
    }
    

    App.HPP

    #ifndef APP_H
    #define APP_H
    
    #include 
    #include 
    #include 
    
    /*!
     * @brief Application GUI object
     */
    class App : public QObject
    {
        Q_OBJECT
    public:
        App();
    public slots:
    void changeText(QVariantList ,bool );
    
    };
    
    #endif // ifndef APP_H
    

    Try this.

    void App::changeText(QVariantList indexPath,bool selected) {
        XmlDataModel *model = (XmlDataModel *)list->dataModel();
        QVariantMap map = model->data(indexPath).toMap();
        // map is your data in QVariant
        qDebug() << map["title"].toString();
    }
    
  • Logging within the Application in Release Mode

    Hello world!

    I'm trying to implement logging for one of my applications. So what I did is to follow the directions of this blog

    Logging within your Application. The blackBerry developer blog

    "

    QString file = QString("path/to/mylogfile.txt");

    FILE * file = fopen (theFile.toStdString () .c_str (), 'w');
    slog2_dump_logs_to_file (file, SLOG2_DUMP_LOGS_ALL);
    fclose (file);

    "

    What I need is to save logs to a file and send it by e-mail to the support team.

    The feature described in the blackberry blog post works ONLY in debug / test mode. When running the application in release mode, it seems, the logfile created, contains only platform related messages and all my messages created via the functions of qDebug() of C++ and javascript "console.log ()" are absent...

    Any thoughts anyone?

    Thank you in advance.

    Another problem with the help of slogger, is there a very small buffer. According to what you sign, you can't get all the information you need.

    our solution is probably improved, but so far I have found nothing better.

    We use qInstallMsgHandler to get our own class to handle debugging messages:

    qInstallMsgHandler(LoggerService::logMessage);
    
    void LoggerService::logMessage(QtMsgType type, const char *msg)
    

    in this static method, we check the content of the message and use QtConcurrent::run to write the message to a database sqlite modality.

    To view the log, we use a listview with a db query.

    To share the newspaper read us the db entries in a file, and then share via invocation framework.

  • Update a listView when a page is skipped

    Hi all

    I'm new in the cascades, in the developing world. I'm trying to do a two pages about the first page exposure items to a listview and has buttom "new item" action at the bottom. it triggers now pushes the second page that contains fields for a new record. He has a backup action button. When trigged inserts the element in the database and revealing the first page is displayed. My problem is that the new record is not displayed on the page. at least I got close and reopen the application. I use a sql database to populate the list. and I do everything in the cascades (no C++ backend)

    Thanks in advance for your help.

    Welcome on the support forums.

    you have several options.

    -Insert the item in sql, then reload the entire listview. You can do it by listening to the signal onTopChanged of the navigation pane.

    -inclusion of the item in the list or the model data (as well as in sql). It's a better solution in most cases, at least if the sorting is not done by sql or similar.

  • How to load a Listview

    Hello I hope yo can help me.

    I m, creating an application in Spanish, so. I want to fill a listview and when I select some item, send row, call a qml and fill the other listview in this other qml. All this is done. except, I can filter the query to the data source.

    Hery my code

    hand. QML where I have a Navegationpane, then SegmentedControl and Lisview (myLVNuevo). When I select an item, I take the Id (selectedItem.IdLibro), I create and send another to the qml (bibliapage.qml). His works, in fact.

     NavigationPane {
                id: navpaneBible
                Page {
                    Container {
                        horizontalAlignment: HorizontalAlignment.Fill
                        verticalAlignment: VerticalAlignment.Fill
    
                        leftPadding: 30
                        topPadding: 30
                        rightPadding: 30
                        bottomPadding: 30
    
                        SegmentedControl {
                            id: sgfavorites
                            accessibility.name:  sgfavorites
                            Option {
                                id: option1
                                text: "Antiguo"
                                selected: true
                            }
                            Option {
                                id: option2
                                text: "Nuevo"
                            }
    
                            onSelectedOptionChanged: {
    
                                if (selectedOption == option1) {
    
                                    myLVNuevo.visible = false;                          
    
                                } else if (selectedOption == option2) {
    
                                    myLVNuevo.visible = true;                        
    
                                }
                            }
                        }
    
                        // The contact list filter input
                        TextField {
                            id: txtBuscar
                            hintText: qsTr ("Buscar...")
    
                            // onTextChanging: _addressBook.filter = text
                        }
                        //lv2
                        ListView {
                            accessibility.name: myLVNuevo
                            id: myLVNuevo
                            dataModel: gdmNuevo
                            listItemComponents: [
                                ListItemComponent {
                                    type: "item"
                                    StandardListItem {
                                        title: ListItemData.IdLibro + ". " + ListItemData.NombreLibro
    
                                    }
                                }
                            ]
                            onTriggered: {
                                 if (indexPath.length > 1) {
                                     var selectedItem = gdmNuevo.data(indexPath);
                                     var contentpage = pageDefinition.createObject();
                                     contentpage.idlibro = selectedItem.IdLibro;
                                     contentpage.texto = selectedItem.NombreLibro;
                                     navpaneBible.push(contentpage);
    
                                 }
                            }
    
                        }
                    }
                    attachedObjects: [
    
                        GroupDataModel {
                            id: gdmNuevo
                        },
                        DataSource {
                            id: dtNuevo
    
                            // Load the data from an SQL database, based on a specific query
                            source: "asset:///sql/MyBiblia.db"
                            query: "select IdLibro, NombreLibro, Testamento from Libros Where Testamento = 'Nuevo' order by IdLibro DESC"
                            onDataLoaded: {
                                // After the data is loaded, insert it into the data model
                                gdmNuevo.clear();
                                gdmNuevo.insertList(data);
                            }
                        } // end of DataSource
                    ]
    
                    onCreationCompleted: {
                            dtNuevo.load();
                    }
                } // end of Page
    

    But then when the page is loaded, is not load or filter by property string idlibro. Becuse the query in the data source is idlibro.

     import bb.cascades 1.4
    import bb.data 1.0
    import bb.cascades.datamanager 1.2
    Page {
    property string idlibro;
    property alias texto: lblNombre.text;
    
        titleBar: TitleBar {
            id: titlebar
            title: texto
        }
        Container {
            id: bibliapagina;
    
            Label {
                id: lblNombre
                accessibility.name: lblNombre
    
                text: texto //qsTr("Pagina de la biblia") + Retranslate.onLocaleOrLanguageChanged
    
            }
            ListView {
                accessibility.name: myLVCapitulos
                id: myLVCapitulos
                dataModel: dm //gdmCapitulos
                listItemComponents: [
                    ListItemComponent {
                        type: "item"
                        StandardListItem {
                            title: ListItemData.Capitulo
                            description: ListItemData.Versiculo
                            status: ListItemData.IdVersiculo
                        }
                    }
                ]
                onTriggered: {
                    if (indexPath.length > 1) {
    
                    }
                }
    
                attachedObjects: [
                    GroupDataModel {
                        id: gdmCapitulos
    
                    },
                    DataSource {
                        id: dtCapitulos
    
                        // Load the data from an SQL database, based on a specific query
                        source: "asset:///sql/MyBiblia.db"
                        query: "select ('Capítulo ' || IdCapitulo) as Capitulo, IdVersiculo, Versiculo from CapitulosVers Where IdLibro = " + lblNombre.text + " GROUP BY IdCapitulo ORDER BY IdCapitulo DESC" 
    onDataLoaded: {
                            gdmCapitulos.clear();
                            gdmCapitulos.insertList(data);
                        }
                    }
                ]
    
                onCreationCompleted: {
                    dtCapitulos.load();
    
                }
    
            }
        }
    }
    

    HOW CAN I ACHIEVE THIS?

    ITS important to say, its fine words is a set a query without params. example (select * from CapitulosVers Where idlibro = 1).

    THANKS IN ADVANCE

    I did the solution...

    in the second .qml, just before closing the page, put this:

     onIdlibroChanged: { dtCapitulos.query = "select ('Capítulo ' || IdCapitulo) as Capitulo, IdCapitulo, IdVersiculo, Versiculo from CapitulosVers Where IdLibro = " + idlibro + " GROUP BY IdCapitulo ORDER BY IdCapitulo DESC" dtCapitulos.load();
    
     }
    
     onCreationCompleted: {
                    dtCapitulos.load();
    
                }
    

Maybe you are looking for

  • Put into hibernation - insufficient system resources exist to complete the API (Tecra M4)

    I just thought I'd pass on my experience with this problem. I recently updated my Tecra M4 2 GB of RAM memory. Everything was fine except everyonce in a while he would not hibernate. However, it would suspend to RAM (standby). It seemed to happen aft

  • 6500 a Plus E710n: I printed out a page and only print colors, not black ink.

    I used the printer all day. printing in black and color. Then I printed a page with only black characters and each line was striated. I printed again and he had disappeared, still streaked. The next time nothing printed. So I printed out a page with

  • Once its saved audio playback

    Can someone tell me how I should play an audio recorded? I'm recording in default AMR format. The data are stored in an array of byte []. Now, I want to play these data once registration is completed. Please can someone give me a code example of how

  • Dropped network speed - looking for confirmation

    We were informed this morning by our backup team one of our Exchange backups took 14 hours to complete. A huge difference than the end time of 2 hours yesterday.After reviewing the graphics performance in vCenter, it seems that our network connection

  • See 5.1 rebalance - what a mess

    An hour ago I tried to rebalance a cloning pool related 45 virtual machines on two esxi hosts 5 (latest updates and patches). I am running the latest version of the view. Each host has local SSD that store related clones, and in Re-balance today, I s