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
Zmey
Posts: 1,514
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: QSettings Drop Down Saving Selected Index

[ Edited ]

I was wrong about "new TestApp(&app)" line - it was perfectly fine. Updated the post.

 

 

I've tried to run the project on device & checked the logs:

 

Dec 31 05:34:38.515 [...] bb::cascades::QmlDocument: error when loading QML from: QUrl( "file:///apps/[...]/main.qml" )
Dec 31 05:34:38.517 [...] assets//main.qml:39:21: Cannot assign to non-existent property "selectedIndexChanged"
selectedIndexChanged: {
^)

 

Then changed "selectedIndexChanged: {" to "onSelectedIndexChanged: {"

 

Also replaced

                        _TestApp.saveValueFor(style.objectName, style.getSelectedIndex())

with:

                        _TestApp.saveValueFor(style.objectName, style.selectedIndex)

When using properties in QML "get" is usually omitted.

 

Now it works! State is saved. :smileyhappy:

 

To check the logs in Target Navigator View right click on device; "Launch SSH session", then run:

slog2info -w

or, to filter spam:

slog2info -w | grep someString

 


Andrey Fidrya, @zmeyc on twitter
Developer
mapleleafs90
Posts: 374
Registered: ‎02-12-2011
My Device: Bold 9780

Re: QSettings Drop Down Saving Selected Index

Great, thanks!

 

I wish in qml when you hit the '.' it would show a list of the the possible options rather than me trying to guess. Also wish it would underline these errors.