×
Namespaces

Variants
Actions
(Difference between revisions)

Display SIM contacts using QML ContactModel

From Nokia Developer Wiki
Jump to: navigation, search
chintandave_er (Talk | contribs)
(Chintandave er - modified Abstract template)
hamishwillee (Talk | contribs)
m (Text replace - "Category:MeeGo" to "Category:MeeGo Harmattan")
 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[Category:Qt Mobility]][[Category:Qt Quick]][[Category:Qt]]
+
[[Category:Qt Mobility]][[Category:Qt Quick]][[Category:MeeGo Harmattan]][[Category:Symbian]]
{{Abstract|This article shows how to display sim card contacts on the screen using Qt Mobility Project. }}
+
{{Abstract|This article shows how to use [http://doc.qt.nokia.com/qtmobility-1.2/qml-contactmodel.html QML ContactModel Element]/[http://doc.qt.nokia.com/qtmobility/qml-contacts.html Contacts QML Plugin] to display [[SIM]] contacts on the screen.}} Note that contacts can also be accessed in C++, using the [http://doc.qt.nokia.com/qtmobility-1.2/contacts.html Qt Contacts API]. Note also that the snippet shows use of the API within a Symbian Qt Components framework - the code should work similarly on MeeGo using the MeeGo Qt Quick Components.
  
{{ArticleMetaData
+
{{ArticleMetaData <!-- v1.2 -->
|sourcecode=  
+
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
|installfile=  
+
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|devices= Nokia C6-01
 
|devices= Nokia C6-01
|sdk= <!-- Nokia Qt SDK 1.1.4 ) -->
+
|sdk= [https://www.developer.nokia.com/info/sw.nokia.com/id/da8df288-e615-443d-be5c-00c8a72435f8/Qt_SDK.html Nokia Qt SDK 1.1.4]
 
|platform= <!-- Symbian Anna Qt Mobility 1.2 -->
 
|platform= <!-- Symbian Anna Qt Mobility 1.2 -->
|devicecompatability= Symbian  
+
|devicecompatability= Symbian
|signing=<!-- -->
+
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
|capabilities=NetworkServices ReadUserData WriteUserData  
+
|signing= Self-Signed
|keywords= ContactModel  
+
|capabilities= NetworkServices ReadUserData WriteUserData
|id= <!-- -->
+
|keywords= ContactModel
|language=<!-- -->
+
|language= <!-- -->
|review-by=<!-- After re-review: [[User:username]] -->
+
|translated-by= <!-- [[User:XXXX]] -->
|review-timestamp=<!-- After re-review: YYYYMMDD -->
+
|translated-from-title= <!-- Title only -->
|update-by=<!-- After significant update: [[User:username]]-->
+
|translated-from-id= <!-- Id of translated revision -->
|update-timestamp=<!-- After significant update: YYYYMMDD -->
+
|review-by= <!-- After re-review: [[User:username]] -->
|creationdate= 20111213
+
|review-timestamp= <!-- After re-review: YYYYMMDD -->
|author= [[User:Devnull]]
+
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20111213
 +
|author= [[User:Devnull]]
 
}}
 
}}
 
== 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].
 
  
 
==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 a 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:
  
 
<code>
 
<code>
Line 36: Line 36:
 
</code>
 
</code>
  
*here is the project(.pro) file part related to Symbian capabilities.
+
* Here is the project (.pro) file part related to Symbian capabilities:
  
 
<code>
 
<code>
Line 46: Line 46:
 
</code>
 
</code>
  
==Qml file ==
+
==QML file ==
Here is the MainPage.qml.
+
Here is the MainPage.qml:
<code>
+
<code javascript>
 
import QtQuick 1.1
 
import QtQuick 1.1
 
import com.nokia.symbian 1.1
 
import com.nokia.symbian 1.1
Line 119: Line 119:
 
     }
 
     }
 
}
 
}
 
 
</code>
 
</code>

Latest revision as of 13:52, 13 June 2012

This article shows how to use QML ContactModel Element/Contacts QML Plugin to display SIM contacts on the screen. Note that contacts can also be accessed in C++, using the Qt Contacts API. Note also that the snippet shows use of the API within a Symbian Qt Components framework - the code should work similarly on MeeGo using the MeeGo Qt Quick Components.

Article Metadata
Tested with
Devices(s): Nokia C6-01
Compatibility
Platform(s):
Symbian
Device(s): Symbian
Platform Security
Signing Required: Self-Signed
Capabilities: NetworkServices ReadUserData WriteUserData
Article
Keywords: ContactModel
Created: Devnull (13 Dec 2011)
Last edited: hamishwillee (13 Jun 2012)

[edit] Preconditions

Qt SDK version 1.1.4 or later. Create a new Qt Quick application.

[edit] 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
}

[edit] 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
}
 
}
}
This page was last modified on 13 June 2012, at 13:52.
74 page views in the last 30 days.