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
Developer
bmorr
Posts: 331
Registered: ‎04-13-2013
My Device: Z10

Re: pass childCardDone data to a textfield in QML?

This worked THANK YOU!
Developer
bmorr
Posts: 331
Registered: ‎04-13-2013
My Device: Z10

Re: pass childCardDone data to a textfield in QML?

actually it didn't work.  this is the result I get from it:

 

bb::cascades::Label(0x8303668, "filePathLabel")

 

That's what shows up.

Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: pass childCardDone data to a textfield in QML?

Is this a message from the log file or what shows up in the label?

If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
bmorr
Posts: 331
Registered: ‎04-13-2013
My Device: Z10

Re: pass childCardDone data to a textfield in QML?

This is what what shows up in the label.  When I debug it gives me the correct filepath

Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: pass childCardDone data to a textfield in QML?

Okay so somehow you are not passing the string but passing the object data, can you post your code so far and I'll see where it is going wrong.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: pass childCardDone data to a textfield in QML?

... and just to confirm are you saying it works in debug but not when you run a release?


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
bmorr
Posts: 331
Registered: ‎04-13-2013
My Device: Z10

Re: pass childCardDone data to a textfield in QML?

[ Edited ]

I'm really sorry if this is kind of annoying, I really do appreciate the help.

 

This is exactly how I have my function.

 

void App::childCardDone(const bb::system::CardDoneMessage &message)
{
	QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
	    qml->setContextProperty("_app", this);

	    AbstractPane *root;
	    root = qml->createRootObject<AbstractPane>();
	if (message.reason() == "done") {

		Label* cardLabel = root->findChild<Label*>("filePathLabel");

	cardLabel->setText("file://" + message.data());
	}
	qDebug() << message.reason() << "\n";
	qDebug() << message.dataType() << "\n";
	qDebug() << "file://" + message.data() << "\n";
}

then in qml:  the camera is invoked in the same sheet and the reply is sent to the childcardone once a picture is taken.  I was hoping to have that reply show up in the itemPic label.  But not sure if it is possible.

 

Sheet {
                    id: addSheet
                    Page {
                        titleBar: TitleBar {
                            id: addBar
                            title: qsTr("Add") + Retranslate.onLanguageChanged
                            visibility: ChromeVisibility.Visible
                            
                            .....

acceptAction: ActionItem { title: qsTr("Save") + Retranslate.onLanguageChanged onTriggered: { _app.addObject(itemPic); } } } ....... attachedObjects: [ Label { id: itemPic objectName: "filePathLabel" } ...... ] }

 Could it be because the sheet doesn't update the value when the invoke reply comes in from the camera?

 

Developer
bmorr
Posts: 331
Registered: ‎04-13-2013
My Device: Z10

Re: pass childCardDone data to a textfield in QML?

I'm saying the debug show the filepath while running the app.

Developer
BBSJdev
Posts: 6,116
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: pass childCardDone data to a textfield in QML?

That's okay it's a slow day and I'm playing GTA V in between the responses. :-)

Can you add this after the findChild() line,

Label* cardLabel = root->findChild<Label*>("filePathLabel");
if (cardLabel == null)
qDebug() << "Object not found";

It could be that if sheet is not in the scene graph at the time the result is returned it won't be set.
If this is the case then you will have to go back to method two I suggested where you are setting a global variable in the QML file.

If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
bmorr
Posts: 331
Registered: ‎04-13-2013
My Device: Z10

Re: pass childCardDone data to a textfield in QML?

[ Edited ]

i get the error " 'null' was not declared in this scope"  how do I define null for it?  I believe you're rirght though