Archived:Vibrating device programmatically in Qt

From Qt Wiki
Jump to navigation Jump to search

Template:Archived


Template:ArticleMetaData

Overview[edit | edit source]

Template:Abstract

This snippet can be self-signed. As it does not use any API which require developer/certified signing.

Preconditions[edit | edit source]

Headers required[edit | edit source]

#include <XQVibra>

.pro file[edit | edit source]

symbian:LIBS += -lhwrmvibraclient

Source[edit | edit source]

// Create the vibra object XQVibra* vibra = new XQVibra(this); // Set the vibration intensity to 50%. Possible values are between -100% and 100%. vibra->setIntensity(50); //vibrate for 5 second vibra->start(5000);


Code Example[edit | edit source]

  • The Code Example will vibrate your device for 5 seconds and is tested on Nokia 5800 XpressMusic.

Notes:

  • This will not compile when built for the Simluator, only for Symbian device targets.
  • Note: The sample will run without error, but will not vibrate if the USB cable is plugged in. Symbian devices will not vibrate with the USB cable attached.