CreateObject QML property binding

Hello, I use the createObject command to dynamically create objects on a qml page, I can do that, but now I want some properties of the dynamically object objects to bind on some properties of the parent, how it is possible?

Greetings silajm

Try the following detour

1 make sure you have your parent properties loan (try also to declare them as alias just to be sure)

2 use the parent properties during the construction of the object in the format: parent.property (or same parent.parent...)

3 createObject(explicit parent id)

It should work. In the case where it does not have to launch your actions onCreationCompleted where I am sure that you will get parent.property.

Try and tell us.

Tags: BlackBerry Developers

Similar Questions

  • Change the contents of cell based selector QML property in container QML

    I have a selector in which I want to have the text in each cell selector display in one of two ways, depending on the State of another control in the QML that surrounds the selector and the other controls.

    My first attempt used only a QML based Picker with PickerItemComponents.  The PickerItemComponents had their text property set to the return value of a utility JS function that takes two arguments - the PickerItemData extracted string and an indicator a boolean to indicate the JS function how to change the string returned to display in the cell of the selector.

    When I try to spend a QML property set on the selector for JS calls in the PickerItemComponents, I get an error log saying:

    "" ReferenceError: can't find variable: ".

    I assume here that a PickerItemComponent is missing the context of the selector containing the same way that a ListItemComponent is not the context of the parent company of the ListView.  However the docs of PickerItemComponent do not seem to set all of the properties that I could use similiarly to the ListItem.view property, which is ListItemComponent.  (In fact, the PickerItemComponent docs don't same spec property of pickerItemData - it only appears in example code).

    So the next thing I plan extends the C++ PickerProvider class.  However, it seems that this class inherits QObject, not so I don't know if once I go to the trouble to write and expose my own version, I'll be able to finally get the QML of the container including down in the correct callback inside my custom PickerProvider.

    Anyone who has been in this way, please share your experience/solution you are able - thanks!

    You can try @simon_hain replica of this thread
    http://supportforums.BlackBerry.com/T5/native-development/using-QProperty-for-a-label-inside-list-VI...

  • notion of property binding

    Hello

    In a popup, I created an entry field. and I did the property binding.

    Whenever I run this page jspx... text entry field does not appear.

    Please someone help me...

    Thank you
    Ashish

    This case come only if you link two input component of the user interface with the same backing bean property binding.

    Thank you
    Prateek

  • Store a NavigationPane as a QML property

    I have code similar to the following places:

    onTriggered: {
        var chosenItem = dataModel.data(indexPath);
        var detailPage = detailsPageDefinition.createObject();
        detailPage.initDetailsPage(chosenItem);
        // Push the content page to the navigation stack
        main_list_nav.push(detailPage);
    }
    

    detailPage must also push the NavigationPane, but the problem is I have a couple of different NavigationPanes and the detailPage knows not only push you on.

    I want to be able to switch the navigation as the parameter pane to initDetailsPage() i.e.

    detailPage.initDetailsPage(chosenItem, main_list_nav);
    

    But how I declare this as a property? by DetailsPage.qml

    Page {
         property  navigationPaneToUse
    
         function initDetailsPage(item, navPane)
         {
              navigationPaneToUse = navPane
              ...
         }
    }
    

    If not, is there a property QML on a Page that tells it what NavigationPane he pushed to?

    Thanks for all the help guys. Suite suggested Zmey using the idea of the .parent property and generalizing javayoung above, I came up with this method I set on my UI root object, if it's available everywhere.

    It crosses just to the top of the tree of the child until it finds an ancestor with an object name that contains "NavigationPane", then push on that. In this way, that you don't need to store anything.

        function pushToParentNavigation(child, objToPush)
        {
            var cur = child;
            while(cur != null && cur.objectName.indexOf("NavigationPane") == -1)
            {
                cur = cur.parent;
            }
            if(cur.objectName.indexOf("NavigationPane") != -1)
            {
                cur.push(objToPush);
            }
            else
            {
                console.log("No NavigationPane in heirarchy!");
            }
        }
    

    So now I can just do this anywhere:

    // Push the content page to the navigation stack this page belongs to.
    pushToParentNavigation(this_page_id, myUIObject);
    

    This means that you must add objectName: 'NavigationPane' to all your NavigationPane who isn't ideal. If anyone can suggest a better way to do it, it would be great. I looked at JavaScript typeof operator, but it is not powerful enough.

  • QML property after onCreationComplete is called?

    Hey all,.

    I try to send an ID of one QML page into another using properties. On the second page, I want to put a list with data corresepoding to the ID that was passed along.

    This is the top of the page that is being created and the

    {Page}
    property alias workoutname: root.workoutName
    property alias workoutid: root.workoutID

    It is the container that contains the list view

    {Of container
    ID: root
    property int workoutID:-1
    "" workoutName variant property:

    It's the onCreationComplete of the Page that has the ID passed in

    onCreationCompleted: {}
    segmentList.dataModel = _Dal.GetListOfWorkoutSegments (root.workoutID);
    }

    The problem is when onCreationComplete is called the root.workoutID is always-1 instead of the value as defined when I created the page?

    Creation of the page below.

    page var = workoutPage.createObject ();
    page.workoutid = id
    page.workoutname = name
    homeNavigationPane.push (page);

    I add these pages through a ComponentDefinition.

    Thank you in advance.

    -J

    It's expected behaviour

    You can do this way:

    page var = workoutPage.createObject ();
    page.workoutid = id
    page.workoutname = name

    page.init)
    homeNavigationPane.push (page);

    .. .and inside yopur page you have a

    function init() {}

    where you can use your properties

  • How Textfield text on another page qml property access

    Hello

    I started 10 BB development recently and need help. I searched this forum but could not find some information exactly related to my problem (unlike only), or I missed something from basically. My main.qml, I want to access the text property of the textfield of the InputControl.qml to be used as a parameter in my SQLQuery (attached object). I tried to use the fieldname method alias property, but it does not work. I can't feature outside. Here is my code:

    hand. QML

    import bb.cascades 1.4
    import bb.cascades.datamanager 1.2
    import bb.system 1.0
    import bb.data 1.0
    
    Page {
    
        id: root 
    
        titleBar: UIControls {
        }
    
        //! [0]
       content: Container {
    
            leftPadding: ui.du(2)
            rightPadding: ui.du(2)
            topPadding: ui.du(2)
            bottomPadding: ui.du(2)
    
            InputControl {
            }
    
            // The ListView that's used to display the artist data
            //! [1]
            ListView {
                id: myListView
    
                //property variant dq: defaultDataQuery
                // Associate the list view with the data model that's defined in the
                // attachedObjects list
                layout: StackListLayout {
                    headerMode: ListHeaderMode.Sticky
                }
                layoutProperties: StackLayoutProperties {
                    spaceQuota: 1.0
                }
                horizontalAlignment: HorizontalAlignment.Fill
                verticalAlignment: VerticalAlignment.Fill
    
                listItemComponents: [
    
                    ListItemComponent {
                        type:  "item"
    
                        Container {
                            Label {
                                text: ListItemData.Japanisch
                                layoutProperties: StackLayoutProperties {
    
                                }
                                topMargin: 5.0
                                textStyle {
                                    base: SystemDefaults.TextStyles.TitleText
                                    fontWeight: FontWeight.Bold
                                    color: Color.create("#7a184a")
                                }
    
                            }
                            Label {
                                text: ListItemData.Lesung
                                textFit.maxFontSizeValue: 9.0
                                textStyle {
                                    base: SystemDefaults.TextStyles.TitleText
                                    fontWeight: FontWeight.Normal
                                    color: Color.create("#ff1818e9")
                                }
    
                            }
                            Label {
                                text: ListItemData.Deutsch
                                textStyle {
                                    base: SystemDefaults.TextStyles.TitleText
                                    fontWeight: FontWeight.Normal
                                }
    
                                multiline: true
                                textFit.maxFontSizeValue: 8.0
                            }
                            Divider {}
                        }// Container
                    }
                    // Use a standard list item to display the data in the model
                ]    
    
            } // end of ListView
    
        }//![1]
    
        attachedObjects: [
            //! [2]
            // One of the default provided DataModel's
    
            GroupDataModel {
                id: dataModel
                grouping: ItemGrouping.None
            },
            DataSource {
                id: dataSource
    
                // Load the data from an SQL database, based on a specific query
                source: "WadokuJT.db"
                //query: "select Japanisch, Deutsch, Lesung from WadokuJT where Deutsch like '%Wasser%'"
                query: "select Japanisch, Deutsch, Lesung from WadokuJT where Deutsch like '%" + stext + "%'";
    
                onDataLoaded: {
                    // After the data is loaded, insert it into the data model
                    dataModel.insertList(data);
    
                }
                type: DataSourceType.Sql
            } // end of DataSource      
    
        ]//! [2]  
    
        actions: [
            //! [8]
            ActionItem {
                title: qsTr("Search")
                imageSource: "asset:///images/ic_search.png"
                ActionBar.placement: ActionBarPlacement.Signature
                onTriggered: {
                    myListView.dataModel = null
                    dataSource.load()
                    //myListView.dq = defaultDataQuery
                    myListView.dataModel = dataModel 
    
                }
            },
    
            ActionItem {
                title: qsTr("Settings")
                imageSource: "asset:///images/ic_settings.png"
                onTriggered: {
    
                }
            },
    
            ActionItem {
                title: qsTr("Help")
                imageSource: "asset:///images/ic_help.png"
                onTriggered: {
    
                }
            }                           
    
        ]//![8]
    
    } // end of Page
    

    And here is my InputControl.qml

    import bb.cascades 1.4
    
     Container {
         property alias stext: txtSearchText.text
    
        Label {
            id: lblSearchText
            text: "Searchtext\r\n"
    
        }
    
        TextField {
            id: txtSearchText
            layoutProperties: FlowListLayoutProperties {
    
            }
            hintText: "Enter Searchtext"
        }
    }
    

    Any help is greatly appreciated. Thank you.

    Give InputControl an id (in main.qml), for example someId.

    Access the variable an alias like someId.stext

  • JS function as a type of page in QML property

    Hi all

    I'm trying to create useful js 'class' for my blackberry application and save here some information about qml object here is the example of such file js:

    /* * my js */
    
    function Utils(devInfo){ this.devInfo = devInfo; this.text = "test text";
    
     this.getInfo = function(){ return this.text; };}
    

    I want to group some utils functions here and use this js in qml file object, but I don't want to create "Utils" every time, I would like to have a single instance of page qml. I tried to use properties:

    import bb.cascades 1.3
    import com.example.bb10_samples_states 1.0
    import "myscripts.js" as Scripts
    
    Page {
        property variant utils : new Scripts.Utils(deviceInfo)
    
        Container {
            Label {
                id: myLabel
                text: "Hello World"
            }
    
            onTouch: {
                var newLabeltext = utils.getInfo(); // freezing
                myLabel.text = newLabeltext;
            }
        }
    
        attachedObjects: [
            DevInfo{
                id: deviceInfo
            }
        ]
    }
    

    * DevInfo is registered object c ++

    I got the following in the notecard event error message:

    "asset:///main.qml:15: TypeError: result of expression 'utils.getInfo' [[object Object]] is not a function."

    If I do not use the property and only with variable work, everything is ok. The following code works correctly:

    import bb.cascades 1.3
    import com.example.bb10_samples_states 1.0
    import "myscripts.js" as Scripts
    
    Page {
        //property variant utils : new Scripts.Utils(deviceInfo)
    
        Container {
            Label {
                id: myLabel
                text: "Hello World"
            }
    
            onTouch: {
                var utils = new Scripts.Utils(deviceInfo);
    
                var newLabeltext = utils.getInfo();
                myLabel.text = newLabeltext;
            }
        }
    
        attachedObjects: [
            DevInfo{
                id: deviceInfo
            }
        ]
    }
    

    In general, I don't know where I can store object js in qml page to access my functions utils without need to create each time. Any ideas?

    I think I found the answer

    According to this link, there is no global js object and every instance of component QML has own unique copy resources imported from JS:

    ...

    Code-Behind implementation resources

    Most of the JavaScript files imported into a document QML are implementations with State of the QML importation document. In these cases, each instance of the QML object type defined in the document requires a separate copy of the JavaScript and State objects to behave properly.

    The default behavior when importing the JavaScript files must provide a unique and isolated copy for each instance of the QML component. If this JavaScript file any resources or modules with a statement .import, its code will be executed in the same scope as the instance of the QML component and therefore can access and manipulate objects and properties declared in the QML component. Otherwise, it will have its own unique scope, and the objects and properties of the QML component should be passed to the JavaScript file as parameters functions if they are required.

    ...

    http://Qt-project.org/doc/Qt-5/qtqml-JavaScript-resources.html

    So it seems there is no need to implement the model of sigleton or store JS resources in the QML document. I changed my code as follows:

    /**
     * js
     */
    var utils = {
      devInfo : null
    };
    
    function init(deviceInfo){
      utils.devInfo = deviceInfo;
    };
    
    function getText(){
      return utils.devInfo + " done.";
    };
    

    and qml:

    import bb.cascades 1.3
    import com.example.bb10_samples_states 1.0
    
    import "myscripts.js" as Scripts
    
    Page {
        Container {
            Label {
                id: myLabel
                text: "Hello World"
            }
    
            onCreationCompleted: {
                Scripts.init(deviceInfo);
            }
    
            onTouch: {
                myLabel.text = Scripts.getText("Tra-ta-ta");
            }
        }
    
        attachedObjects: [
            DevInfo{
                id: deviceInfo
            }
        ]
    }
    

    It works fine - I can store information in the variable 'utils' and work with qml js objects. Hope so, it will help someone

  • Setting a QML property in another file

    I'm pretty new to stunts, so I hope someone could help me with this. This piece of code is supposed to load main.qml, with a button to open a separate sheet (CountryList.qml). On this sheet, it loads a local XML database in a ListView. The user selects one of the items in the ListView, which is supposed to give selectedcountry.text. How would we do that last one?

    hand. QML:

    import bb.cascades 1.2
    
    Page {
        Container {
            Button {
                text: "Pick a country"
                onClicked: {
                    countryList.open()
                }
            }
            Label {
                text: "Selected Country: "
            }
            Label {
                id: selectedcountry
                text: ""
            }
        }
        attachedObjects: [
            CountryList{
                id: countryList
            }
        ]
    }
    

    CountryList.qml:

    import bb.cascades 1.2
    import bb.data 1.0
    
    Sheet {
        id: countryList
        content: Page {
            titleBar: TitleBar {
                title: "Pick a Country"
                dismissAction: ActionItem {
                    title: "Close"
                    onTriggered: {
                        countryList.close()
                    }
                }
            }
            Container {
                Header {
                    title: "List of countries"
                }
                ListView {
                    id: listView
                    dataModel: repoDataModel
                    listItemComponents: [
                        ListItemComponent {
                            type: "header"
                            Container {
                                Label {
                                    text: ""
                                }
                            }
                        },
                        ListItemComponent {
                            type: "item"
                            Container {
                                Label {
                                    text: ListItemData.countryname
                                }
                                Label {
                                    text: "Capital: " + ListItemData.capital
                                    textStyle.fontSize: FontSize.Small
                                }
                                Divider {
                                }
                            }
                        }
                    ]
                    onTriggered: {
                        //Something should go here
                    }
                }
            }
        }
        attachedObjects: [
            GroupDataModel {
                id: repoDataModel
                sortingKeys: [
                "countryname"
                ]
                sortedAscending: false
                grouping: ItemGrouping.ByFullValue
            },
            DataSource {
                id: repoDataSource
                remote: true
                source: "countries.xml"
                query: "repo/country"
                type: DataSourceType.Xml
                onDataLoaded: {
                    repoDataModel.clear();
                    repoDataModel.insertList(data)
                }
            }
        ]
        onCreationCompleted: {
            repoDataSource.load();
        }
    }
    

    onTriggered() your worksheet should issue a

    signal countrySelected (country)

    and the opening Page of the sheet must connect to this signal
    a function such as

    function onCountrySelected (country) {}

    selectedcountry. Text = country

    }

    your current solution always sets the value - even if the user does not select something and only closes the leaf

    This must be decoupled

  • Broken defaultSaveFileNames FilePicker component QML property?

    I'm trying to use a FilePicker to back up and restore user data in a JSON file.  I'm the pre-population of the property with the name of the file defaultSaveFileNames is to have its extension (".json") removed when the UI FilePicker slides in on the application user interface.  Is - this just broken?  There is a thread WebWorks describing the same problem here:

    http://supportforums.BlackBerry.com/T5/Web-and-WebWorks-development/invokeFilePicker-filter-options-...

            FilePicker {
                id: backupRestoreFilePicker
                type: FileType.Document
                directories : ["/accounts/1000/shared"]
                viewMode: FilePickerViewMode.ListView
            defaultSaveFileNames: ["userData.json"]
                onFileSelected: {
                    // handler code omitted
                }
            }
    

    The FilePicker UI does is display "userData" as suggests recorded file name.

    He adds the .json at the end of the file name, it it just hides the Textinput

    I use it and it adds .bar at the end of the file name, the user types into:
    {FilePicker}
    string saveName property
    ID: saver
    defaultSaveFileNames: ['.bar']
    mode: FilePickerMode.Saver
    Title: "download the update.
    directories: [' / accounts / "]

  • Can not access the context in QML property

    So I have an arraydatamodel in the CPP file, I use qml-> setContextProperty (...) to set it up to allow QML to access, the strangest part is, no matter if I put it in navigationPane Page or a container, it keeps saying can't find not variable, but in the same QML in ListView, they can access it without a problem. The other weird part, it is an another QML is able to access it in the tag of the page, the same model.

    By default of the Jun 02 9000 REVIEWS asset:///main.qml:24 09:12:59.416 com.example.IntervalTimer1.testDev_ervalTimer1a7a2c2e2.427733134: ReferenceError: can't find variable: eventsModel
    By default of the Jun 02 9000 REVIEWS asset:///main.qml:110 09:12:59.416 com.example.IntervalTimer1.testDev_ervalTimer1a7a2c2e2.427733134: ReferenceError: can't find variable: eventsModel

    Here is my code

    import bb.cascades 1.0
    
    NavigationPane {
        id: navigationPane
        backButtonsVisible: false
        // Javascript definition
        function udpateTotalTimeLabel() {
            console.log("In updateTotalTimeLabel function");
            var totalHour = 0, totalMinute = 0, totalSecond = 0;
            // To debug javascript object print function
            var print = function(o) {
                var str = '';
    
                for (var p in o) {
                    if (typeof o[p] == 'string') {
                        str += p + ': ' + o[p] + '; 
    '; } else { str += p + ': {
    ' + print(o[p]) + '}'; } } return str; } console.log("EventsModel: " + eventsModel.size()); for (var i = 0; i < eventsModel.size(); i ++) { var currentEvent = eventsModel.data([ i ]); console.log("EventsEvent: " + currentEvent["EventName"]); totalHour += currentEvent["EventHour"]; totalMinute += currentEvent["EventMinute"]; totalSecond += currentEvent["EventSecond"]; } if (totalHour < 10) totalHour = "0" + totalHour; if (totalMinute < 10) totalMinute = "0" + totalMinute; if (totalSecond < 10) totalSecond = "0" + totalSecond; totalTimeLabel.text = totalHour + ":" + totalMinute + ":" + totalSecond; } function onDataReady() { console.log("Received DataReady signal"); navigationPane.udpateTotalTimeLabel(); newEventSheet.close(); } Page { id: root titleBar: TitleBar { title: "Interval Timer" } ..... onCreationCompleted: { navigationPane.udpateTotalTimeLabel(); console.log("No of EventsModel: " + eventsModel.size()); console.log("In sheet creationCompleted"); mainObj.dataReady.connect(navigationPane.onDataReady); } }

    In the PRC

    // Default empty project template
    #include "applicationui.hpp"
    
    #include 
    #include 
    #include 
    #include "CountdownTimer.hpp"
    
    using namespace bb::cascades;
    
    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);
    
        // Initialize the Array Data Model for holding events
        this->eventsModel = new ArrayDataModel();
        // For Testing only
        QVariantMap event;
        event["EventName"] = "Event1";
        event["EventHour"] = "00";
        event["EventMinute"] = "01";
        event["EventSecond"] = "02";
        this->eventsModel->append(event);
    
        // create root object for the UI
        AbstractPane *root = qml->createRootObject();
    
        // Registering the QTimer type to QML
        qmlRegisterType("TimerLibrary", 1, 0, "CountdownTimer");
    
        // Setting the access for QML to member variable
        qml->setContextProperty("eventsModel",this->eventsModel);
        qml->setContextProperty("mainObj",this);
    
        // set created root object as a scene
        app->setScene(root);
    }
    
    .....
    
    void ApplicationUI::refreshData()
    {
        emit dataReady();
    }
    

    Thank you.

    The fixed.

    You must call setContextProperty before calling createRootObject.

  • QML createObject with parameters

    Is it possible to pass parameters to the function createObject QML?

    QML use us createObject to create objects of a definition of component dynamically.

    i.e.

    attachedObjects:]

    {ComponentDefinition}

    ID: myDef

    {Of container

    property int fooBar

    }

    }

    ]

    var myobject = myDef.createObject)

    Now, according to the documentation below, we can pass a JSON structure to initialize the properties of the new object, who get installation before creating objects and allow things like the links work correctly:

    https://developer.BlackBerry.com/Cascades/reference/QML-component.html#CreateObject-method

    In theory I should be able to do this:

    var myobject = myDef.createObject (null, {"fooBar": 1234})

    I can't get this work though - does anyone have a solution?

    Yes, this code does not work.

    Try this

    var component = Qt.createComponent("MyPage.qml");
    var mypage = component.createObject(null, {"fooBar": 1234});
    mycontainer.add(mypage)
    

    It should work.

  • InputComboBox not returned when binding property is

    Hi all

    I use Jdev 11.1.1.7

    I tried a stand alone, when in inputCombobox is added with the property binding.

    Due to this component is not visible.

    I would like to know if this is a known issue.

    The project is attached.

    Please check.

    Thank you

    ASHA

    Yes, it is a problem.

    Children of cannot share a value of binding EL

    A component instance can exist only once in a tree of components. Therefore, if one wants to have the bound component

    a managed bean, the connection must correspond to a property of different grains for each iteration of the loop. For example:

    http://docs.Oracle.com/CD/E35521_01/apirefs.111230/e17491/tagdoc/af_forEach.html

    But my advice is to use af:iterator instead, which is designed only to solve this problem:

    http://adfdiary.blogspot.RS/2014/03/difference-between-afforeach-and.html

  • Loop link detected for the property "previewImage" how to solve?

    Hello

    I'm periodiacally to receive the following error message:

    Asset:///controls/DisplayResultsNavPages.QML:118:25: SearchResultsListItem QML: link detected loop for the property "previewImage".

    Here's a sample of my code, the error occurs in ListItemComponent, I need to call a function that will scrape a page in real time and then update the datmodel if the previewImage is empty.   I don't know if there is a better place to call the scrapePictureIfNeeded() thereby avoiding loop link detected the error, if there is or if you have some tips on how to avoid this error, it would be greatly appreciated...

    Thank you, in advance...

    Container {
                ListView {
                    function scrapePictureIfNeeded( ExternalUrl, source, Index )
                    {
                        if ( sIndexesSoFar.indexOf(Index+"|") == -1 )
                         {
                             sIndexesSoFar += Index + "|";
                             netscrape2.setadImages("");
                             netscrape2.setadId(Index);
                             netscrape2.scrapeSite(ExternalUrl);
                        }
                        return "";
                    }
                    id: searchListView
                    dataModel: searchDataModel
                    listItemComponents: [
                        ListItemComponent {
                            id: listComponentSearchResultsListItem
                            type: ""
                            SearchResultsListItem {
                                pubDate: ListItemData.TimeStamp + " - " + ListItemData.Location
                                previewImage: ( ListItemData.PreviewImage == "" ) ? ListItem.view.scrapePictureIfNeeded( ListItemData.ExternalUrl, ListItemData.Source, ListItem.indexPath ):ListItemData.PreviewImage
                                sourceImage: ListItemData.Source
                            }
                        }
                    ]
                    onTriggered: {
                        // launch second page
                    }
                    attachedObjects: [
                            ScrapeHttp {
                            id: netscrape2
                            onComplete: {
                                var aPictures = netscrape2.adImages.split("|");
                                var data = searchDataModel.data([netscrape2.adId]);
                                if ( aPictures.length > 0 )
                                {
                                    data.PreviewImage = aPictures[0];
                                    searchDataModel.replace([netscrape2.adId], data);
                                }
                            }
                        }
    
                    ]
                 } // end of ListView
            }   // End of Container
    

    Hello

    I solved it, after some research, I have dicsocvering that QML actually binds the function to the property, so I moved the fuction call to: and now, everythign works...

    itemType function (data, row) {}

    scrapePictureIfNeeded (data. ExternalUrl, data. Source, row)

    Return ' ';

    }

  • Can't push to the navigation of a component outside the main.qml pane

    Here's some of my main.qml

     Container {
                id: main_content
    
                attachedObjects: [
    
                    ComponentDefinition {
                        id: listtodo
                        source: "mainList.qml"
                    }
                ]
    
                property variant listtodoObj
    
                onCreationCompleted: {
                    listtodoObj = listtodo.createObject();
                    if (!listtodoObj)
                        listtodoObj = listtodo.createObject();
    
                    listtodoObj.dataModel = Model.get();
                    main_content.add(listtodoObj);
                }   
    
            }
    

    I have not included of NavigationPane, but in the hand, I have a pane of navigation with the id "navigationPane.

    Here's the part of my mainList.qml:

    gestureHandlers: [
    
                        TapHandler {
    
                            attachedObjects: ComponentDefinition {
                                id: infoPage;
                                source: "asset:///taskInfo.qml"
                            }
    
                            onTapped: {
    
                                var page = infoPage.createObject();
    
                                navigationPage.push(page);                     
    
                            }
                        }
                    ]
    

    But I can't access navigationPane. In the console it says: "cannot find variable: navigationPage.

    What can I do?

    This should help:
    http://supportforums.BlackBerry.com/T5/native-development-knowledge/how-to-access-QML-properties-fro...

  • Cascades does not take sides property links in all components

    I believe that many elements found in the Cascades are poorly designed because they do not take sides QML property bindings. The worst example is the ActivityIndicator component that is not a race (or something similar named) property.

    Let me show you an example, I'll start with a snippet of code that does not have the property running:

    {ActivityIndicator}

    ID: indicator

    }

    WebView {}

    onLoadingChanged: {}

    If (loading)

    Indicator.Start)

    } else {}

    Indicator.Stop)

    }

    }

    }

    It is not declarative, it's imperative code. Now, let's take a look at the following example which shows how it would look like if the ActivityIndicator have had an ongoing execution property:

    {ActivityIndicator}

    running: webView.loading

    }

    WebView {}

    ID: webView

    }

    Much cleaner, easier to read and completely declarative. You also get the dependencies between the components on the right. In the first example, the Web mode has a dependency to the ActivityIndicator which is completely false. In the last example, you see that this time, the ActivityIndicator has the addiction to the Web mode, which is OK because the ActivityIndicator has a dependency for Web display and not vice versa.

    To make things even worse with ActivityIndicator-case, is that there is a function called isRunning which returns Boolean If the indicator is running or not. Why is it good?

    There are a couple of other components that have similarities with the ActivityIndicator, such as the cursor and TextField. Would be my pleasure to clarify if you are interested.

    Yes, we certainly do.

    With the cursor, there are 2 valueChanged and valueChanging, events which provide 2 different functionality, so should not in this case for valueChanged to send a signal until after the slider has ceased to be changed because the value itself is not changed until the cursor was placed, valueChanging provides instant feedback. Introducing the necessary logic to see if the user has lifted a finger, left the area of cursor or otherwise ceased to move the cursor would certainly complicate the case.

    The next point you have raised is very valid, but with the method used by Cascades, as described above, the value of the slider is defined not until after the cursor is moved and stopped. I suggest you connecting everything you see as strange behavior or unexpected in the Issue Tracker as a bug. We can step up to the development of review, this will allow developers also know that the behavior used by Cascades is not always what is expected, or exactly in line with QtQuick QML.

    Kind regards

Maybe you are looking for