02-04-2013 11:27 AM
In my C++ files I have a QMap of data that I would like to add to a DropDown that I have in QML.
I can't find any examples of how to add options to an already existing DropDown though. Here's what I have in my QML file right now:
DropDown {
id: account
title : "Account"
enabled : true
}It seems like it should be a fairly easy process to get the DropDown list by the id and insert data from my QMap into it.
Any help with this would be greatly appreciated!
Solved! Go to Solution.
02-04-2013 12:49 PM
02-04-2013 12:53 PM
02-04-2013 12:58 PM
02-04-2013 04:51 PM
02-04-2013 05:02 PM - edited 02-04-2013 05:13 PM
Hi,
Can you please show how do you call findChild? It's a template function. The following forms should work:
AbstractPane *root = qml->createRootObject<AbstractPane>();
QObject *button = root->findChild<QObject *>("button");
or
Container *container = root->findChild<Container *>("rootContainer");
Is the following line present in .cpp?
#include <bb/cascades/AbstractPane>
UPD:
I've checked that this function is actually defined in QObject and AbstractPane inherits QObject. I was able to compile the following code:
#include <bb/cascades/AbstractPane>
...
bb::cascades::AbstractPane *pane;
pane->findChild<QObject *>("test");
02-04-2013 05:05 PM
02-04-2013 05:17 PM - edited 02-04-2013 05:19 PM
This should work I think:
#include <bb/cascades/AbstractPane>
#include <bb/cascades/DropDown>
using namespace bb::cascades;
...
DropDown *dropDown = pane->findChild<DropDown *>("account");
dropDown->add(Option::create().text("Option 1"));