Revision as of 07:45, 6 March 2012 by ltdangkhoa2105 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to use QtMobility to enable vibration in QML

From Nokia Developer Wiki
Jump to: navigation, search

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
Platform(s): Compatible platforms: Symbian^3 and later, Meego
Created: ltdangkhoa2105 ()
Last edited: ltdangkhoa2105 (06 Mar 2012)


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


Sample source code

File:Ltdk vibrationQML.zip

File:Ltdk vibrationQML.sis

80 page views in the last 30 days.