×
Namespaces

Variants
Actions
(Difference between revisions)

How to use QtMobility to enable vibration in QML

From Nokia Developer Wiki
Jump to: navigation, search
ltdangkhoa2105 (Talk | contribs)
(Ltdangkhoa2105 -)
 
chintandave_er (Talk | contribs)
(Chintandave er - some minor changes)
Line 2: Line 2:
 
{{Note|This is an entry in the [[Symbian Qt Quick Components Competition 2012Q1]]}}
 
{{Note|This is an entry in the [[Symbian Qt Quick Components Competition 2012Q1]]}}
  
{{Abstract|This article explains how to}} ''use QtMobility to enable vibration in QML.''
+
{{Abstract|This article explains how to use QtMobility to enable vibration in QML.}}
  
 
{{ArticleMetaData <!-- v1.2 -->
 
{{ArticleMetaData <!-- v1.2 -->
Line 23: Line 23:
 
|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= <!-- Format YYYYMMDD -->
+
|creationdate= 20120306 <!-- Format YYYYMMDD -->
 
|author= [[User:ltdangkhoa2105]]
 
|author= [[User:ltdangkhoa2105]]
 
}}
 
}}
Line 67: Line 67:
 
Ok, now wherever you want to start the vibration, just easily call the rumbleEffect
 
Ok, now wherever you want to start the vibration, just easily call the rumbleEffect
  
<code>
+
<code cpp>
 
...
 
...
 
appWindow.rumbleEffect.start();
 
appWindow.rumbleEffect.start();
Line 74: Line 74:
  
 
== Sample source code ==
 
== Sample source code ==
 
+
You can download the sample source code of this article from below links.
 
[[File:Ltdk_vibrationQML.zip]]<br />
 
[[File:Ltdk_vibrationQML.zip]]<br />
  
 
[[File:Ltdk_vibrationQML.sis]]
 
[[File:Ltdk_vibrationQML.sis]]

Revision as of 08:42, 6 March 2012

Note.pngNote: This is an entry in the Symbian Qt Quick Components Competition 2012Q1

This article explains how to use QtMobility to enable vibration in QML.

Article Metadata
Tested with
Devices(s): Nokia E7-00, Nokia N950
Compatibility
Platform(s): Compatible platforms: Symbian^3 and later, Meego
Symbian
Article
Created: ltdangkhoa2105 (06 Mar 2012)
Last edited: chintandave_er (06 Mar 2012)

Introduction

As the previous article : http://www.developer.nokia.com/Community/Wiki/How_to_use_QVibra_to_enable_vibration_in_QML . This article will show another way to implement vibration using QML

Step by step

In the project file, put these settings first:

...
 
CONFIG += mobility
MOBILITY += feedback
 
...

Next step, I'll put some of these code below to main.qml file

import QtMobility.feedback 1.1
 
PageStackWindow {
id: appWindow
 
HapticsEffect {
id: rumbleEffect
attackIntensity: 0.0
attackTime: 250
intensity: 1.0
duration: 250 // set up the duration here, in millisecond
fadeTime: 250
fadeIntensity: 0.0
}
}

Ok, now wherever you want to start the vibration, just easily call the rumbleEffect

...
appWindow.rumbleEffect.start();
...

Sample source code

You can download the sample source code of this article from below links. File:Ltdk vibrationQML.zip

File:Ltdk vibrationQML.sis

101 page views in the last 30 days.
×