Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

用QtFeedback实现手机震动效果

From Wiki
Jump to: navigation, search

Delete instructional text in italic

This article explains how to ... Replace the abstract text with a short paragraph (or sentence) describing what the topic covers.

Enter article metadata as described below. Note that this template can be placed anywhere in the article. Do not remove parameters that you do not use

Article Metadata
Article
Created: ()
Last edited: hamishwillee (13 Jun 2012)

Introduction

本文介绍如果用QML 实现手机的震动效果.
在Meego系统的手机上实现手机的震动效果,直接使用QtMobility中的QtFeedBack就可。

实现

用QtFeedBack模块实现手机的震动效果的类为QFeedbackHapticsEffect,其对应的QML 元素为HapticsEffect,本文就用QML HapticsEffect ELement来实现震动效果。
1,在pro文件中导入feedback模块

 CONFIG += mobility
MOBILITY += feedback

2,在QML文件中导入feedback 模块

import QtMobility.feedback 1.1

3,在qml文件中的代码实现

HapticsEffect {
id: rumbleEffect
attackIntensity: 0.0
attackTime: 250
intensity: 1.0
duration: 500
fadeTime: 250
fadeIntensity: 0.0
}

代码下载:File:Testvibration.zip

相关连接


Add categories below. Remove Category:Draft when the page is complete or near complete

This page was last modified on 13 June 2012, at 10:59.
136 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×