I don't think you should be calling a full reset on the model. I only know the non-qml solution, but I'm assuming that it works the same. The model has a beginRemoveRows() and endRemoveRows() for this sorta work. It just notifies that one row is being removed. Make sure your internal data structure matches the external one and all will be fine.
Odd, I just found "this thread":http://lists.qt.nokia.com/pipermail/qt-qml/2011-May/002577.html on the mailing list from a few months ago and after I commented out the width of the tabDelegate Component (not included in my minimal example above), the onAdd callback works as expected. But if the width is set, it doesn't fire. (I tested with a log statement.)
Does anyone know why this would be so? Should I file a bug report?
I’d also be concerned about ripping one model out from under the QML and replacing it with another. Without the beginRemoveRows etc. from an ItemModel how does the QML know that the model has changed?
It doesn't. So the user have to reset property each time the model changed.
[quote author="Vijay Bhaska Reddy" date="1311061589"]These properties defined with Q_PRIVATE_PROPERTY() macro.. and tried searching for the definition of this macro, but could not find it anywhere ...[/quote]
Because those macros are replaced by moc instead of the preprocessor (like Q_OBJECT).
I tried to use a other ContactManager:
And now all my contacts that are stored on my SIM are shown. But manager "symbian" shows no contacts. It is also no QML specific problem. I tried to retrieve contacts in my main.cpp:
qDebug() << contactManager.availableManagers();
QList<QContact> contacts = contactManager.contacts();
But the "contacts" list is empty.
Hi zhouquan, i don't think QML can display html file directly. But the Text element can be display as css styled text. When you use a listView, the most important part for your page is how you design your delegate.
As you use a html file to store the data, you can use a webpage(QML webview element) as your delegate, but it's need webkit, so you can not ignore the cost of webkit. And also, if you html file is simple(simple to read, simple to parse), you can try parse it yourself, and determin how to layout your delegate.
ListView can make your pages continuously :-)
Btw, if you still confused, you can post a topic using Chinese in Chinese forum:
Found notice on the Screen component. I interpret it as a lack in the documentation. The QML Screen Element is part of the new set of Qt Quick components recently released. It is tru that are experimental but following the link in the Qt labs you go to the new developer documentation area so why don't add links to the rest of the documentation ?
This is not so clear and not intuitive: people expect that Qt-Quick components are objects to build UI - as described in most of the posts relative to this useful update - The QML Screen Element is part of them and I have found no links in the documentation. In the Qt elements page maybe useful for example a bottom secion with womething like "Experimental components" or "new released components" I think it maybe sufficient to invite the developers to investigate in-depth.
In the actual Qt-Creator local documentation the QML Screen Element is mentioned without any reference to the fact that it is part of the Qt-Qtuick new tools components that should be imported in the user space.
The example reports:
so how will i do it? is there any possible means of loading another qml file without overlaying the previous one?? my game involves many levels of which will took place on different areas and different format of game..
For Qt Quick components we can not modify these attributes unless they are made available through the elements. This looks like a big problem as many customers wants the UI components to look certain way ( eg: toolbar should be in blue color etc ).
You just have to code a QDeclarativeItem subclass in C++ with the methods (and the internal state information like current directory, etc.) you need and register it at runtime so it becomes accessible as a QML Element as described here: http://doc.qt.nokia.com/4.7-snapshot/qml-extending.html
Better if you define a QDeclarativeItem subclass that performs the file handling operations including most of the complex stuff and then emits a signal when done or exposes a QML ListModel with the result of the operations performed.
For example, when you change the source property in the QML Image element , the element performs lots of file operations and data conversions, but on the UI side you just get onStatusChanged signals and the UI perform a refresh of the image.
i created a screen with Qt.createComponent and then saved a pointer to it in a container used as history. I would set the opacity to 0 when I created another screen. This was part of a Back Button feature but I scrapped the pointer approach and use a Loader.
Since the loader deletes screens as it loads new ones there is no resource contention.
If you are trying in QtQuick 1.1, you could use Qt.application.active to check if application is active or not. Otherwise you could listen for QEvent::ApplicationActivate, QEvent::ApplicationDeActivate in your cpp code and then communicate it to qml objects in your QtQuick app