Namespaces
Variants
Actions
(Difference between revisions)

How to use QtMobility to enable vibration in QML

Jump to: navigation, search
m (Hamishwillee - Bot update - Fix metadata etc)
m (Text replace - "Category:MeeGo" to "Category:MeeGo Harmattan")
Line 1: Line 1:
[[Category:Qt Quick]][[Category:Qt Mobility]][[Category:Symbian]][[Category:MeeGo]][[Category:UI]]
+
[[Category:Qt Quick]][[Category:Qt Mobility]][[Category:Symbian]][[Category:MeeGo Harmattan]][[Category:UI]]
 
{{Abstract|This article explains how to use QtMobility to enable vibration in QML.}} This uses an alternative mechanism to that proposed in [[How to use QVibra to enable vibration in QML]].  
 
{{Abstract|This article explains how to use QtMobility to enable vibration in QML.}} This uses an alternative mechanism to that proposed in [[How to use QVibra to enable vibration in QML]].  
  

Revision as of 13:54, 13 June 2012

This article explains how to use QtMobility to enable vibration in QML. This uses an alternative mechanism to that proposed in How to use QVibra to enable vibration in QML.

Article Metadata

Code Example
Installation file: Media:Ltdk vibrationQML.sis

Tested with
Devices(s): Nokia E7-00, Nokia N950

Compatibility
Platform(s): Compatible platforms: Symbian^3 and later, Meego

Article
Created: ltdangkhoa2105 (06 Mar 2012)
Last edited: hamishwillee (13 Jun 2012)

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

113 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved