Display SIM contacts using QML ContactModel
m (moved DisplaySimContactWithQtMobility to Display SimCard Contacts With QtMobility: moved page to proper pagename) |
(Chintandave er - added Abstract template, Modify Article metadata, added Qt Category) |
||
| Line 1: | Line 1: | ||
| − | [[Category:Qt Mobility]][[Category:Qt Quick]] | + | [[Category:Qt Mobility]][[Category:Qt Quick]][[Category:Qt]] |
| + | {{Abstract|This code snippet shows how to use [http://doc.qt.nokia.com/qtmobility-1.2/qml-contactmodel.html QML ContactModel ] model using [http://developer.qt.nokia.com/wiki/Category:Qt_Labs_Projects Qt Mobility Project] and display sim contacts on the screen. }} | ||
| + | |||
{{ArticleMetaData | {{ArticleMetaData | ||
|sourcecode= | |sourcecode= | ||
| Line 16: | Line 18: | ||
|update-by=<!-- After significant update: [[User:username]]--> | |update-by=<!-- After significant update: [[User:username]]--> | ||
|update-timestamp=<!-- After significant update: YYYYMMDD --> | |update-timestamp=<!-- After significant update: YYYYMMDD --> | ||
| − | |creationdate= | + | |creationdate= 20111213 |
| − | |author= | + | |author= [[User:Devnull]] |
}} | }} | ||
| − | |||
== Overview == | == Overview == | ||
| − | |||
This code snippet shows how to use [http://doc.qt.nokia.com/qtmobility-1.2/qml-contactmodel.html QML ContactModel ] model using [http://developer.qt.nokia.com/wiki/Category:Qt_Labs_Projects Qt Mobility Project] and display sim contacts on the screen. This Example use [http://doc.qt.nokia.com/qtmobility/qml-contacts.html Contacts QML Plugin] of [http://doc.qt.nokia.com/qtmobility/qml-plugins.html QtMobility QML Plugins]. | This code snippet shows how to use [http://doc.qt.nokia.com/qtmobility-1.2/qml-contactmodel.html QML ContactModel ] model using [http://developer.qt.nokia.com/wiki/Category:Qt_Labs_Projects Qt Mobility Project] and display sim contacts on the screen. This Example use [http://doc.qt.nokia.com/qtmobility/qml-contacts.html Contacts QML Plugin] of [http://doc.qt.nokia.com/qtmobility/qml-plugins.html QtMobility QML Plugins]. | ||
==Preconditions== | ==Preconditions== | ||
| − | |||
Qt SDK version 1.1.4 or later. Create an new Qt Quick application. | Qt SDK version 1.1.4 or later. Create an new Qt Quick application. | ||
==Project File (.pro file)== | ==Project File (.pro file)== | ||
| − | |||
* Add the Qt Mobility project configuration option in the .Pro file as shown below | * Add the Qt Mobility project configuration option in the .Pro file as shown below | ||
Revision as of 16:51, 13 December 2011
This code snippet shows how to use QML ContactModel model using Qt Mobility Project and display sim contacts on the screen.
Article Metadata
Tested with
Devices(s): Nokia C6-01
Compatibility
Device(s): Symbian
Platform Security
Capabilities: NetworkServices ReadUserData WriteUserData
Article
Keywords: ContactModel
Created: Devnull
(13 Dec 2011)
Last edited: chintandave_er
(13 Dec 2011)
Contents |
Overview
This code snippet shows how to use QML ContactModel model using Qt Mobility Project and display sim contacts on the screen. This Example use Contacts QML Plugin of QtMobility QML Plugins.
Preconditions
Qt SDK version 1.1.4 or later. Create an new Qt Quick application.
Project File (.pro file)
- Add the Qt Mobility project configuration option in the .Pro file as shown below
CONFIG += mobility
MOBILITY += contacts
- here is the project(.pro) file part related to Symbian capabilities.
symbian {
TARGET.CAPABILITY = NetworkServices ReadUserData WriteUserData
}Qml file
Here is the MainPage.qml.
import QtQuick 1.1
import com.nokia.symbian 1.1
import QtMobility.contacts 1.1
Page {
id: mainPage
Text {
id: title
text: "Contacts"
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 6
color: platformStyle.colorNormalLight
}
ListView {
id: mainList
anchors.left: parent.left
anchors.leftMargin: 3
anchors.right: parent.right
anchors.rightMargin: 3
anchors.top: title.bottom
anchors.bottom: parent.bottom
anchors.topMargin: 3
cacheBuffer: 100
clip: true
highlightFollowsCurrentItem: true
snapMode: ListView.SnapOneItem
model: contactModel.contacts
delegate: listDelegate
ContactModel {
id: contactModel
manager: "symbiansim" // "symbian" for other contact manager
autoUpdate :true
sortOrders:
SortOrder {
detail: ContactDetail.Name
field: Name.LastName
direction: Qt.AscendingOrder
}
}
Component {
id: listDelegate
ListItem {
id: contactItem
subItemIndicator: true
ListItemText {
id: nameItem
mode: contactItem.mode
role: "Title"
text: displayLabel
}
}
}
ScrollDecorator {
flickableItem: mainList
}
}
}

