Why can't I access object inside the ListItemComponent.onCreationCompleted C++... ?

Hello world

My application has a HTTP connection to retrieve the XML stream and insert data to the ListView using DataSource and DataModel, and I want to hear at each of its ListView ListItem is created and completely to use a ListItemData for my c++ object. So I write my code like this

In main.cpp

int main (int argc, char * argv)

{

App app (argc, argv);

new MyApp (&app);)

returnApplication::exec();

}

In MyApp.cpp

MyApp::MyApp (bb::cascades:Application * app): //constructor

{QObject (app)}

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

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

AbstractPane * stream = qml-> createRootObject)

App-> setScene (NCA);

}

void MyApp::doMyFunction (const QString & someData) {}

qDebug()< "yes!!="">

}

In main.qml
{Page}

{Of container

{To ListView

dataModel: myDataModel

listItemComponents:]

{ListItemComponent}

type: 'point '.

{Of container

onCreationCompleted: {}

Console.log ("-LISTITEM ONCREATION COMPLETED");

app.doMyFunction (ListItemData.someData);    //<  but="" console="" print="" about="" "can't="" find="" variable="" "app"="">

}

}

}

]

} //end listview

} //end container

onCreationCompleted: {}

myDataSource.load ();

}

attachedObjects:]

{GroupDataModel}

ID: myDataModel

},

DataSource {}

ID: myDataSource

Source: "some URLs to get RSS... blah blah."

type: DataSource.Xml

onDataLoaded: {}

myDataModel.clear ();

myDataModel.insertList (data);

}

]

}

I try to run mycode. But a console is printed on "can't find variable: app". " How can I solve this problem?

Thanks for any suggestions.
MAZ

Its because the listitem is not in the same document as the Page tree really, he lives with ListView and does not have direct access to the elements of the Page.

What you can do is create a javascript function in the ListView, and then the listitemcomponent facing, which in turn can relay to your environment variable "app."

int listitemcomponent add id: itemContainer your container can
itemContainer.ListItem.view.someFunctionDefinedInTheListView (data)

in the listview:

function somefunctiondefinedinlistview (data) {}
app.doMyFunction (data)
}

Tags: BlackBerry Developers

Similar Questions

  • Why can I not move objects to the bottom of the timeline in the video?

    Hello

    Why can't I move the new object I inserted (this is a PNG image) all down the timeline just above the video/audio? That's where I need?

    I edit the video with stripes, zooms and slices. I really hope that I can move it to the bottom of the timeline.

    Thank you

    This a cpvc of the project, right? Several chronologies are open when necessary, and it is indeed not possible (as in cptx projects) to change the stacking order. However, this could be a workaround: move the timeline you want to down horizontally until you have an empty space: you can then move it to the bottom. You'll go up the other deadlines in the location where you want to have this object at the bottom... Then, you will have to move again. Very heavy, I think it's much easier to think before you add objects and add them in the right order. CPVC-feature did not get much attention, after it was introduced, it is probably not that popular?

  • Why can I not access some of the fonts I have installed on my Mac? This never happened before creative cloud.

    I use a Macbook with the font book. I am not able to access all the fonts in the font by Illustrator book, which has never been a problem before the creative cloud. I buy fonts - they are some fonts free janky. They are .otf and there is no problem with the installation.

    Hi Eileen,.

    Fonts are not displayed to the top? Do you see fonts show in other applications? Try resetting the Illustrator preferences first. You have another like suitcase font management software? Are able to install other fonts and ask them to show you? Can you give us to download it for free. I can test on my end

    http://helpx.Adobe.com/Illustrator/KB/preference-file-location-Illustrator.html

    Thank you

    Scott

  • I can't resize any object inside a tab control and control of the tab itself

    Hi all

    Since this morning I noticed that I can't always resize the object placed inside a tab control or the control tab itself.

    I have a few objects (controls, indicators, etc.) outside of the tab control, and they are resizable (I can see the dark blue squares and I am able to adjust the object); Instead, any object inside the tab control is still not resizable (when I select the dark blue boxes are not visible and I can't access the properties of the object by clicking with the right button of the mouse over it). If I have access to the properties of the object to the block diagram, the appearance of her-> frame size is gray and I can't change the size fields.

    It seems that something was changed when I try to adjust the minimum window size and appearance of windows in the proposals of VI, but I restore the previous values...

    How can I solve this problem?

    Sure, tab control is not locked.

    If the tab control is locked that resize is not possible

    Lucast85 wrote:

    Hi all

    Since this morning I noticed that I can't always resize the object placed inside a tab control or the control tab itself.

    I have a few objects (controls, indicators, etc.) outside of the tab control, and they are resizable (I can see the dark blue squares and I am able to adjust the object); Instead, any object inside the tab control is still not resizable (when I select the dark blue boxes are not visible and I can't access the properties of the object by clicking with the right button of the mouse over it). If I have access to the properties of the object to the block diagram, the appearance of her-> frame size is gray and I can't change the size fields.

    It seems that something was changed when I try to adjust the minimum window size and appearance of windows in the proposals of VI, but I restore the previous values...

    How can I solve this problem?

  • Why can't I access my CC of libraries in all applications? Get the message ' something going wrong initialization Cloud creatives library "any help greatly appreciated.

    Why can't I access my CC of libraries in all applications? Get message "something went wrong initialization library creative cloud" any help greatly appreciated.

    Hi Paul,.

    Please, try the following steps:

    • Close all applications CC
    • Complete the process monitor activity/task manager (CCLibrary).
    • Restart any application and check.

    Hope that helps!

    Kind regards

    Sheena

  • Why can't I access the Photoshop CS4 online help?

    Why can't I access the Photoshop CS4 online help?

    http://helpx.Adobe.com/Photoshop/archive.html?AH_ION=true

    This is the link where you can find help for PS CS4 PDF version

    Online help shows you only the help of current version

  • Why can't I access a book that I just bought my iPhone using iBooks on my MacBook Pro using iBooks?

    Why can't I access a book that I just bought my iPhone using iBooks on my MacBook Pro using iBooks?

    Perhaps one of the main reasons is that the Apple ID, I used on my iPhone is different from the AppleID that I use on my MacBook Pro.

    But when I went to add that Apple ID for my 'family' I get the message that the 2nd "" Apple ID is already part of the family.

    Any ideas how to make this happen?

    Steve

    You need to get them on the same Apple ID choose one registered with the family and change it on the computer or device that has different ID.

  • [Q] can Vision track multiple objects in the same area - objects that might cross?

    Hello

    Sorry for this long title, but this is my question.

    Can Vision track multiple objects in the same area - objects that could cross?

    Because I'm able to do, extraction of XY, but it seems that "IMAQ County objects ' don't follow framework after but framework opposed, but extract the coordinates XY always in the same way, as for example from top and whenever he sees an object, it retrieves the XY, but if the objects pass through (then it will extract XY without worrying that the objects was the earlier but just based on"scan from top to bottom").

    That's why I open this topic in the forum of Vision no part: http://forums.ni.com/t5/LabVIEW/Sort-XY-by-closest/td-p/2440428

    Thank you

    Sébastien

    Thank you for your response.

    My problem is that we work with very small insects and the shape/color is the same for all.

    Then the solution is: Let's wait for "IMAQ County objects 3 ' then .

    Thank you

    Sébastien

  • Why can I not access / open my outlook e-mail account?

    Why can I not access / open my outlook e-mail account? Recently, I can't open my microsoft office outlook account.  Whenever I try to open it it comes up with the message: cannot start microsoft office outlook.  Cannot open the outlook window.

    I tried to fix it.  When it did not work, I removed & tried to re - install again.  It still does not work & I really need to get to my emails!  I am connected to a remote server, someone else is also related to the so they can access emails from same as me & they have no problems at the moment.

    Why can I not access / open my outlook e-mail account? Recently, I can't open my microsoft office outlook account.  Whenever I try to open it it comes up with the message: cannot start microsoft office outlook.  Cannot open the outlook window.

    I tried to fix it.  When it did not work, I removed & tried to re - install again.  It still does not work & I really need to get to my emails!  I am connected to a remote server, someone else is also related to the so they can access emails from same as me & they have no problems at the moment.

    Try if it works. It does for most people, but one of the posters said recently he did not for him or her.
    Start button > run > type /resetnavpane outlook.exe in the box > OK

    Note (space) between exe and / '.

    If you do not have the option RUN, use the start search box instead.

    Please post back the result.

    t-4-2
    t-4-2

  • where my sweet im gone for messenger and why can I not access my winks when I'm chatting on messenger?

    Why can I not access my winks in messenger and where my sweetim has disappeared that I used to have here as well?

    Hello

    Messenger questions are asked and answered in different Forums as these.

    Here is the link to them:

    http://windowslivehelp.com/product.aspx?ProductID=2

    There is a list of Messenger Forums, including one for Instant Messages.

    See you soon.

  • Why can't retouch a photo in the version of windows xp

    Why can't retouch a photo in the version of windows xp

    but it can in windows 7

    Why can't retouch a photo in the version of windows xp

    but it can in windows 7

    ======================================
    More than likely that you look at the picture in Windows
    Picture And Fax Viewer and out of the rotation, there
    None of the editing functions.

    Try to open the picture in paint, or try to install an application
    who has features such as Windows Live Photo Gallery of edition
    or the freeware IrfanView.

  • Don't understand why can't listen to videos on the web sites ie HULU and ads. Using Vista + Adobe Flash player.

    Don't understand why can't listen to videos on the web sites ie HULU and ads. Using Vista + Adobe Flash player

     

    Hello

    1. what happens when you try to play videos on the mentioned website?

    2. you use Internet Explorer browser to play videos on the mentioned website? If so, which version?

    3. are you able to play videos on other websites like YouTube, etc?

     

    See the following article: If you use the Internet Explorer browser.

    The video problems when you use Internet Explorer:

    http://support.Microsoft.com/kb/2532294

  • Why can't I paste it from the Clipboard?

    Why can't I paste it from the Clipboard on my desk?

    Hello

    I suggest you post the question in the forums and check them off below if it helps:

    http://answers.Microsoft.com/en-us/Office/Forum/word?page=1

    It will be useful.

  • Why can't I type letters in the fields of serial number?

    Why can't I type letters in the fields of serial number?

    There is a difference between a serial number and a redemption code

    Redemption Code http://helpx.adobe.com/x-productkb/global/redemption-code-help.html

    - and https://forums.adobe.com/thread/1572504

  • BlackBerry Q5 What is the 'protected_media' file and why can't I access it?

    I went to file manager and saw a folder called 'protected_media '. Trying to open it gives me a "record not available: you don't have permission to access this folder" message. Why do I have this folder, and why I can't access it?

    In addition, what is the "miscellaneous"? Why have a folder inside called "android"? Why can I go/misc/android/DCIM/camera and find copies of what is in the file/device? Delete "misc" without messing anything?

    They said that with the ghost Commander you can open it but I do not use or install it ever cause depends on what you use. If you really want to put the files here you can do with the Commander gost and since this post is old enough, if you found nothing more useful to open it with or without any application you are happy to include it. Thank you.

Maybe you are looking for

  • Mac OS 10.6.8

    Hello! My Mac OS 10.6.8. I don't want to update because of lack of memory. Please recommend a good program for MAC Clean. In App store, all programs require Mac OS 10.10 and later versions. Where can I download 10.6.8 cleaner Thank you very much!

  • iMac with upgrade to El Capitan stands out

    In the case where you want to look at the code of my Console at this event, here is the link: http://pastebin.com/DkfmN0eS I disabled Dropbox at first upward, since this seems to slow down, but it is intermittent.  Today, I waited a few minutes even

  • HP Officejet pro l7680 - paper jam error

    original title: HP Officejet pro l7680 Guard gives me paper jam error. I removed all stuffed with material, redefinition and still not stop send MSG does anyone have any suggestions? Says the error is in the area of the print cartridge. Nothing there

  • Hotmail no 23/02/12?

    my macbook or may I call you can access hotmail.   Is there a problem today?

  • Vista's easy transfer using external drive

    Purpose: Transferring files from origin of the external hard drive HP recovered / clean, install the system. WETransfer dialogue does not navigate to a success for external drives. Online help in the absence on this, too. So here I am.