Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
BlackBerry Development Advisor (Retired)
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha

Re: Setting QML objectName for StandardListItem properties

I would need to see your code on the C++ side;

 

Also a few quick validations: Are you querying the correct qml document object in your C++ code to access the item? Are you specifying your objectName as astring in your QML file? Make sure you have the double quotations;

objectName: "page1"

Developer
Posts: 136
Registered: ‎02-01-2009
My Device: Not Specified

Re: Setting QML objectName for StandardListItem properties

[ Edited ]

I think the double quotes shouldnt be an issue when the objectName are coming from the C++

so, i can imagine the QML like
objectName: ""+ListItemData.indentifier

but the issue, if it happens to be - that would be ridiculous since as per the API, the UI changes as soon as the DataModel is changed, and to change the DataModel you would need the "indexPath"

Which i think could be the limitation being encountered here.

BlackBerry Development Advisor (Retired)
Posts: 499
Registered: ‎05-07-2012
My Device: developer

Re: Setting QML objectName for StandardListItem properties

So, how are you faring?

 

As for the original question, it seems the answer is: the leaf-level object for communication is a QObject.

 

The quotes was for string literals in your QML:

  objectName: "myObjectName"

 

Are there any additional unresolved questions?

 

Stuart

Developer
Posts: 46
Registered: ‎08-21-2012
My Device: Blackberry z10 LE

Re: Setting QML objectName for StandardListItem properties

Yes, you can safely use objectName and findChild<>
Nokia Qt Ambassador
http://www.softairrealfight.net
Developer
Posts: 136
Registered: ‎02-01-2009
My Device: Not Specified

Re: Setting QML objectName for StandardListItem properties

NO in this case i'll go with 'soman' , the findChild would not return you the listItemComponent and the refrence would be 0x0.

 

The QML Structure:

 

...

ListComponents[

type: "item"

MyListItem{

objectName:"test"

status:"123"

description:"234"

}

]

...

 

I do get the list on the UI, now If you try

 

QObject temp=root->findChild<QOBject*>("test");

qDebug()<<temp;

 

would print --- 0x0

 

Thus its unable to locate the exact list item/component.

BlackBerry Development Advisor (Retired)
Posts: 499
Registered: ‎05-07-2012
My Device: developer

Re: Setting QML objectName for StandardListItem properties

[ Edited ]

There seem to be 2 questions in this thread:

 

Q1.  If I assign an ObjectName to something that is not a QObject, can I find it with findObject<QObject*>

A1.  No.

 

Q2.  If I give a list component an ObjectName, can I find the object with this name?

A2.   Are you trying to find all objects of this component type?  What are you trying to find, and what are you expecting to have returned?  The component definition?

 

Stuart

Developer
Posts: 136
Registered: ‎02-01-2009
My Device: Not Specified

Re: Setting QML objectName for StandardListItem properties

On A2 - we are trying to find the specific StandarListItem by having QML like

StandardListItem{
objectName: ListItemData.index
text:ListItemData.title
}

Thus, if the expectation is, for the use case if I want to change the imageSource or title of a specific List Row.

then ,

findChild("listItemIndex");

should return the StandardListItem compoenent which would enable then setProperty , to change the indentifiers.
BlackBerry Development Advisor (Retired)
Posts: 499
Registered: ‎05-07-2012
My Device: developer

Re: Setting QML objectName for StandardListItem properties

Is it possible you have the wrong type of object in the findChild<>?

You want the row with the data, or the underlying data?  It may be you just want to query your data model?

 

Stuart