[Moved] ListView inside ComboBox wont populate...PLz help
-
Hi all, im a newbie at Qt/QML and Symbian. Sorry for my english.
I have a situation and i am starting to get desperate without knowing what to do.
I got the QML ComboBox from "Qt Components":https://qt.gitorious.org/qt-components/qt-components/blobs/f97eb3eb5d6e9de3bfca69d291ffc1564aee8a01/ComboBox.qmlMy situation is that i want to populate the QML ComboBox with elements from C++ (a QStringList). Next i will present the errors and the code where i am trying to populate the ComboBox. Just a heads up: the ComboBox has a ListView where the items are inserted.
Errors:
@file:///C:/Users/andre.esteves/Launcher-build-simulator/qml/Launcher/styles/default/ComboBoxStyle.qml:108: Unable to assign [undefined] to QString text
file:///C:/Users/andre.esteves/Launcher-build-simulator/qml/Launcher/styles/default/ComboBoxStyle.qml:92: TypeError: Result of expression 'model.get' [undefined] is not a function.@C++ Code:
@
QStringList appName; //Im filling this in the real code, so no worries
QDeclarativeView view;
QDeclarativeContext *ctxt = view.rootContext();
ctxt->setContextProperty ("apps", appName);
view.setSource(QUrl::fromLocalFile("example.qml");
view.show();
@
view.show() isnt for display the example.qml file? Im trying to move from one QML file to another with this show() function.Part of the QML Code:
@
Item {
Column {
x: 33
y: 193
width: 251
height: 40
spacing: 10ComboBox{ id: appbox model:myModel ListView{ id:myModel model:apps } }
}
}
@If u need more details, ill be happy to provide.
Thanks for any help,
Estevex -
I do not understand why there is a ListView inside the ComboBox.
Are you able to show your QStringList items in ListView alone, or in ComboBox alone?
If not, you may simply copy from the QStringList example:
http://doc.qt.nokia.com/4.7-snapshot/declarative-modelviews-stringlistmodel.html -
[quote author="andresteves" date="1309796620"]
Part of the QML Code:
@
Item {
..............
ComboBox{
id: appbox
model:myModelListView{ id:myModel model:apps } }
}
}
@
[/quote]Briefly went through ComboBox code. You don't need to have ListView in your code. Its already defined inside ComboBox.
try below code
@Item {
..............
ComboBox{
id: appbox
model:myModel
}
}
}
@ -
Hi thx for the hint Vijay. Trying that.
For my other question:
I want to show a different qml file with view.show(). The thing is that i am inside a qml file and want to jump to another qml file. the show() function would do that?Thanks for the help
-
[quote author="andresteves" date="1310031538"]Hi thx for the hint Vijay. Trying that.
For my other question:
I want to show a different qml file with view.show(). The thing is that i am inside a qml file and want to jump to another qml file. the show() function would do that?Thanks for the help[/quote]
Are you coding for Symbian platform?? If so you should try ApplicationWindow, PageStack, and Page. You can easily do what you asked for with those elements.
-
Im coding for Symbian but on Qt 4.7. Goig to check if i can use those libraries on Qt 4.7 .