Can't access (outside) QML elements of ListItemComponent

Hello

I have a problem to access the variables of a ListItemComponent in my QML.

My QML is a container that contains a ListView with several ListItemComponents.

I updated my QML list as a contextProperty data model:

QML-> setContextProperty ("_dataModel", homeDataModel);

My data model has Q_INVOKABLE I want to call from my QML.

The problem is that, in ListItemComponent, I can not access or "_dataModel", or all the elements that are outside the component itself.

I found a solution that would use extended Qt such as:

onCreationCompleted: {}

Qt.homePage = home page;

Qt.homeList = homeList;

}

Using it, I could access variable outside of my ListItemComponent. The problem is that the scope of the Qt interval is too large. In effect, if I create multiple instances of the Pages using the QML, Qt.homePage/Qt.homeList will have the value given by the last instance of Page. This isn't a good solution for me because I use it to access the dataModel of the list and the dataModel has an associated NavigationPane.

Anyway, you know other solutions to access my data from my ListItemComponent model?

Thank you

I just hit this same question today...

You can get a handle to the item list to the view and from there, get what you need...

In my component list item:

                listItemComponents: [
                    ListItemComponent {
                        Container {
                            id: itemRoot...

You can then refer to the root element and finally the view... Here is a button that is located in my list item... Dumping a bunch of things and call for trigger on the list view...

                           Button {
                                text: qsTr("Go!")
                                horizontalAlignment: HorizontalAlignment.Center
                                onClicked: {
                                    console.debug("ListItemData: " + ListItemData);
                                    console.debug("itemRoot: " + itemRoot);
                                    console.debug("itemRoot.ListItem: " + itemRoot.ListItem);
                                    console.debug("itemRoot.ListItem.view: " + itemRoot.ListItem.view);
                                    console.debug("itemRoot.ListItem.view: " + itemRoot.ListItem.view.dataModel);
                                    console.debug("itemRoot.ListItem.view.trigger: " + itemRoot.ListItem.view.triggered(ListItemData.indexPath));...

Tags: BlackBerry Developers

Similar Questions

  • How can I access a qml component in C++ of a page has been dynamically generated?

    Hello

    I am new to QML and stunts development and I have the following scenario. On my main page, I have a ListView and when you tap on a list item, a new page is created dynamically and push in the navigation stack. I am able to see the new page, but it is empty. Qml to this new page code is defined in a separate file called DirectionViewer.qml. To achieve this, in my main.qml file I have the following code:

    attachedObjects:]
    {ComponentDefinition}
    ID: directionViewer
    Source: "DirectionViewer.qml".
    }
    ]

    In DirectionViewer.qml, I created another display of list and gave it a name of object called directionList. My question is, how do I access 'directionList' in C++, so that I can put the dataModel of the list of my C++ code?

    Thank you.

    Write a method in C++ and pass your ListView.

    void ListViewUtil::setDataModel(QObject* listViewObject)
    

    In C++, you can cast QObject to ListView.

    ListView listView = dynamic_cast(listViewObject);
    

    Then set the data model.

  • Can't access outside of the ESX of guest OS

    Hello

    I have a problem with communication outside invited BONES ESX servers.

    We use 1 ESX 4.

    It wasn't a problem before we moved into the ESX Server to the different network segment

    who caused the change of IP address. Since we migrated to the new network segment,

    Guest OS (all Windows servers) cannot access anything whatsoever outside of ESX Server.

    After troubleshooting, we found more.

    1 ESX Server itself can access both sides (virtual servers and virtual servers)

    2 impossible to access operating system invited to no virtual servers (outside of ESX Server) that

    is on the same network segment as the guest OS.

    3. same goes for the other sense. Cannot access virtual servers not for the guest OS.

    4. we confirmed this IP address of the "Service Console", comments from the IP addresses of the OS, not virtual

    IP addresses of the server are all on a same sagment (172.28.10.x/24)

    5 funny, sometimes, one OS comments CAN communicate with no virtual servers.

    but once the ESX is rebooted, unable to access it again.

    6. among the guest OS, communication is quite good.

    7 everything worked fine until we moved the ESX Server to the different network segment

    on these facts, the problem seems to lie on vSwitch.  We also tried on.

    1 create another group of ports with another physical NETWORK card, another vSwitch and migrate

    an operating system invited to it. It was working fine, however the migration all BONES invited back,

    the recurring problem...

    2. I tried all antivirus related services, but did not help

    If someone could help us, much appreciated.

    Thank you much in advance.

    Kind regards

    Takeshi

    Sounds as the physical switch or ports are configured for port security, allowing more than 1-2 MAC addresses connect to the same port. Check the settings with Cisco, it's something like "switchport mode access" that must be configured.

    André

  • Remote vpn client can't access outside networks

    I configured a remote vpn ASA 5510 the wizard remote vpn. Users are able to get the vpn connection and access the internal network; but IMPOSSIBLE to

    access the outside network. (For the internal network, I want to talk about network behind the vpn to ASA, outside networks refers to society outside the ASA).

    In short, the external network of the company has default route to the ROUTER1 points. The ROUTER1 has road for access network and a default route to the internet. The ASA has a default route to the ROUTER1 points. the ROUTER1 also has a route to the address of the user remote vpn refers to the ASA.

    Hope it wise.

    But I don't know if my nat statement is correct. below is my statement of nat, is there something obvious lack? There is no translation network here, routable internet addresses.

    NAT (inside) 0-list of access inside_nat0_outbound

    public static 111.1.0.0 (Interior, exterior) 111.1.0.0 netmask 255.255.255.0

    public static 111.1.1.0 (Interior, exterior) 111.1.1.0 netmask 255.255.255.0

    public static 111.1.2.0 (Interior, exterior) 111.1.2.0 netmask 255.255.255.0

    networks outside the company (111.1.3.0/24; 111.1.4.0/24)

    |

    |

    the user remote vpn <-------------->internet <--------------------->ROUTER1 - ASA - Cat6509 - inside the network

    Any suggestion is appreciated.

    Thank you

    have you enabled "same-security-traffic intra-interface.

  • I paid for the game of the 4 elements and I can't access it yet is not even appear on my computer HELP

    Saturday, 19 March 2011 19:47:17 Microsoft purchase confirmation: MICROSOFT * XBOX LIVE <*** email="" address="" is="" removed="" for="" privacy="" ***="">Add to Contacts to: * address email is removed from the privacy * Frances dear ____, this mail is confirmation that you have purchased the following items: Date Confirmation # item (s) amount _-4 items $9.99 subtotal: $9.99 fee: $0.60 Total amount: $10,59 for-profit of your account information, go to https://billing.microsoft.com and select one of the following options : To update payment information, click on link of payment under "Type of payment" on the next page, click on 'Go to payment method information' and on the next page, click "Edit payment method information. For more information on the cancellation of a service, click the service name, and then on the next page click on "cancel my service". To view a statement for a payment method, click the method of payment under "Type of payment". To view the contract that you have accepted when purchasing a service, click on the service name, and then, on the next page, click on "read-service agreement. Help with your account, click 'contact support '. Thank you for using Microsoft Billing Services. Microsoft Customer Support to receive notifications at a different e-mail address, sign in to your account at https://billing.microsoft.com, select 'Access to the personal information', then click 'Edit personal information', change the 'Contact email' and click 'save '. For more information about online safety, visit http://www.microsoft.com/phishing. Microsoft respects your privacy, to learn more, please read our privacy statement online at http://go.microsoft.com/fwlink/?LinkId=74170 Microsoft Corporation, One Microsoft Way Redmond, WA 98052 2929 N Central Avenue Suite 1400 Phoenix, AZ 85012 as you can see I bought the 4 elements game, but I can not access the game, what is happening.

    Hello
     
     
    I would ask you to contact Microsoft Customer support on this issue. See the article below for more information.
    How and when to contact Microsoft and support Customer Service
    http://support.Microsoft.com/kb/295539
     
    You can also check out the article below to activate the game once you have the product key.
    Activate your Microsoft games and mapping programs
    http://support.Microsoft.com/kb/927007
     
    I hope this helps.
  • 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.

  • I bought first elements 14 online just now, unfortunately, I saw that I bought the version of Windows on my Mac computer. How can I access the program to be a Mac?

    I bought first elements 14 online just now, unfortunately, I saw that I bought the version of Windows on my Mac computer. How can I access the program to be a Mac?

    Get a refund and go back and buy the correct version

    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific time) <===> NOTE DAYS AND TIME

    Don't forget to stay signed with your Adobe ID before accessing the link below

    Get help with orders, refunds and exchanges (non - CC)

    http://helpx.Adobe.com/x-productkb/global/service-b.html

  • I just bought photoshop elements 13, but I can only access the video editor. Help please.

    Can someone help me understand why I can only access the video editor after you download photoshop elements 13

    It seems that you downloaded Premiere Elements rather than Photoshop Elements.

    Premiere Elements video editing =

    Photoshop Elements = editing still images

    Download Photoshop Elements from here

    https://helpx.Adobe.com/Photoshop-elements/KB/Photoshop-elements-10-11-downloads.html

    If you received a serial number starting with 1057 then that is for Photoshop Elements. If the serial number starts with 1143, then it's a number of Premiere Elements.

    Brian

  • Can I access an element in the document parent edge animate function?

    Hi, very, very new to animate dashboard.

    I want to know if I can access items in the document parent of the function that I attach to the stage or another item in my animation.
    the equivalent of the window. parent . document . getElementById

    I noticed that the function automatically transmits "sym", which I assume is the animation so can I get to sym.parent document reference?

    Sorry if it's a bit basic but this is really new to me.  Thank you.

    Hello

    I had a similar problem, the need to access a DOM element of index.html Dreamweaver file from in the Actions of my composition of edge panel.

    In my example, I have a

    in the file index.html with id = "foot".

    That's how I got a JQuery style reference to the item in the Actions of the composition Panel:

    $("#footer", window.parent.document)

    This allowed me to access attributes, like this: $(«_#footer_»,_window.parent.document).html ()... or you could assign it to a variable, like this: var myFooter = $("#footer", window.parent.document);

    Hope that helps!

  • How can I access "photomerge" in 11 of the elements?

    How can I access "photomerge" in 11 of the elements? When I go into file == new all what happens is empty file and the image to the Clipboard. That's when it can be, it's somewhere else in this version.

    Title of the message was edited by: Brett N

    Hello

    It is present in the Enhance menu > Photomerge.

  • How can I access Photoshop elements 9 organizer of iMac Apple Dock &amp; move all photos from iPhoto

    I have been using Photoshop Elements 9 to change my digital photos from iPhoto.  I found using both these confusing applications and decided to only use Photoshop Elements 9 to edit and organize my photos.  Right now I can only access the editor of Photoshop Elements 9 of my iMac Apple Dock.  How can I access all the features of Photoshop Elements 9 of my iMac Apple Dock?  Should what steps I follow to move all of them now organized in iPhoto in the Photoshop elements 9 multimedia?

    The next time that you start the Organizer, go in the Dock, click on more and hold its icon there and go to options more > keep in dock.

    To copy your photos from iphoto, go to file > import from iphoto. This will duplicate your photos, however.

  • Data on the iMac, but can not access the files.

    Hi all

    I have a iMac Core 2 Duo (3.33, 21.5 inches) since end 2009, running 10.6.8 Snow Leopard and I'm trying to recover some files that seem to be there, but I can not access it due to an update of the unfinished software.

    A few years back, I tried the Mavericks update using an external hard drive as the boot drive (at that time there I ran 10.6.7 Lion), installation is never ending and I accidentally deleted this file to start on the outside, so I ended up coming back to his moose BONE, 10.6.8 Snow Leopard.

    He seems to resemble a new install of Snow Leopard, except my old files (about 350 GB) still live on this subject, but I can not access all of the files, or does not even appear in the Finder.

    Would appreciate any advice or tips on how to do to recover my invisible files. Thank you!

    Do you see the drive in disk utility?

    1. Connect the external drive
    2. If it has external power supply, make sure that that is connected
    3. If the external hard drive has a power button, make sure that it is set to
    4. Goto docking station
    5. Click on finder
    6. Goto menu bar
    7. Click the menu go
    8. Choose utility
    9. Double-click disk utility

    The drive will appear in the left column of the disk utility?

    If the answer is Yes, if you click on the drive, and then click on check, what disk utility say?

  • The word "Bookmarks" does not appear on my bookmarks toolbar, so I can't access to my favorites

    The word "Bookmarks" does not appear on my bookmarks toolbar, so I can't access to my favorites

    The bookmarks toolbar gives you elements of 'context' for bookmarks.

    Do a right click in a white spot on the Navigation toolbar or the Tabstrip control.

  • I lost the Firefox start page, so can't access the Firefox tab. I get Ask, I want

    For some reason, I started to get a type empty page, rather than the Firefox home page when I open firefox. White page has no tab of firefox at the top of the tab to the left so I can not access all the features of firefox. Also the white page does not show my favorite websites, which is a drawback. Whenever I type in a search word, the results come in a page of information promoted by "Ask" '. " I don't want to. I don't know how it happened, but I can't seem to find a solution. I uninstalled firefox and then reinstalled to see if it would work, but it didn't. Can anyone help please.

    You get the orange Firefox menu button when the menu bar is hidden.

    • Firefox menu button > Options
    • View > toolbars (press F10 to display the menu bar)
    • Right click on empty toolbar space

    See:

    Make sure the toolbars like the toolbar 'Navigation' and the 'personal bar' are visible.

    • Firefox menu button > Options
    • View > toolbars (press F10 to display the menu bar)
    • Right click on empty toolbar space

    Use the toolbar (Customize) to open the Customize and set the toolbar to display items.

    • Make sure the "bookmarks toolbar items" are on the personal bar
    • If "Bookmarks Toolbar items" is not on the bookmarks toolbar, then FRY it in the palette of the toolbar in the window the bookmarks toolbar Customize
    • If the missing elements are in the toolbar palette then drag them from the window, customize the toolbar
    • If you do not see an item on a toolbar in the toolbar palette and then click the button "Restore default" to restore the default toolbar configuration

    You can check the problems caused by a corrupt localstore.rdf file if it does not solve it.

  • Safari cannot find server Outlook can ' t access my e-mail?

    Safari cannot find server Outlook can ' t access my e-mail?

    Safari - no support for third-party modules can cause Safari to suddenly quit, or have performance problems

    Safari does not load a page or webpage elements are missing

    Safari / other browsers - Web site does not

Maybe you are looking for

  • How to remove all occurrences of Yahoo from my "subject: config ' file?"

    Thanks in advance for any help you can offer. Somehow, I hijacked by Yahoo yesterday and ends as my default search provider. And, after that, the small magnifying glass where search engines are listed have disappeared. Firefox doesn't have to feel ve

  • Impossible to find Movie Maker download

    I am running Windows XP Pro with SP3... I can't find the Movie Maker or download it... any help would be appreciated.

  • cannot receive/send emails with incredimail

    Suddenly asked for password, but do not think that I never had one for this - Incredimail.Also, yahoo has changed and does not accept my ID, which I know to be correct. I was notaccess my contacts or content of my files. What is going on? Someone at

  • USER DELETED A CLICKED SAVE FILES-CANT FIND FILES-WINDOWS 8

    I deleted a user - Windows 8 - he gave me an option to save the files, I chose, said he would put in a folder - I can't remember where it was to be.  Looked everywhere.  Any help?   Is there a way to reverse entirely? Thank you

  • A few questions to recruit...

    I only started using Illustrator for 2 weeks now, so MANY things are still confusing to me...1) how come that when I create a new document (for example) 750 x 750 pixels... when I export to a .jpg, all of a sudden the end result turns out to be 3125