用QtFeedback实现手机震动效果
(Renlin -) |
hamishwillee
(Talk | contribs) m (Text replace - "Category:MeeGo" to "Category:MeeGo Harmattan") |
||
| (2 intermediate revisions by one user not shown) | |||
| Line 1: | Line 1: | ||
| − | [[Category:Qt Mobility]][[Category:MeeGo]][[Category:Lang-Chinese]] | + | [[Category:Qt Mobility]][[Category:MeeGo Harmattan]][[Category:Lang-Chinese]] |
''Delete instructional text in italic'' | ''Delete instructional text in italic'' | ||
| Line 33: | Line 33: | ||
==实现== | ==实现== | ||
用QtFeedBack模块实现手机的震动效果的类为QFeedbackHapticsEffect,其对应的QML 元素为HapticsEffect,本文就用QML HapticsEffect ELement来实现震动效果。<br> | 用QtFeedBack模块实现手机的震动效果的类为QFeedbackHapticsEffect,其对应的QML 元素为HapticsEffect,本文就用QML HapticsEffect ELement来实现震动效果。<br> | ||
| − | + | 1,在pro文件中导入feedback模块 | |
<code> | <code> | ||
CONFIG += mobility | CONFIG += mobility | ||
MOBILITY += feedback | MOBILITY += feedback | ||
</code> | </code> | ||
| − | + | 2,在QML文件中导入feedback 模块 | |
<code> | <code> | ||
import QtMobility.feedback 1.1 | import QtMobility.feedback 1.1 | ||
</code> | </code> | ||
| − | + | 3,在qml文件中的代码实现 | |
<code> | <code> | ||
HapticsEffect { | HapticsEffect { | ||
| Line 56: | Line 56: | ||
代码下载:[[File:Testvibration.zip]] | 代码下载:[[File:Testvibration.zip]] | ||
| + | |||
== 相关连接== | == 相关连接== | ||
*[[Qt 开发]] | *[[Qt 开发]] | ||
| − | *[[ | + | *[[Meego开发]] |
*[[用Qt控制Symbian Device震动 ]] | *[[用Qt控制Symbian Device震动 ]] | ||
''Add categories below. Remove Category:Draft when the page is complete or near complete'' | ''Add categories below. Remove Category:Draft when the page is complete or near complete'' | ||
Latest revision as of 13:59, 13 June 2012
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
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
}相关连接
Add categories below. Remove Category:Draft when the page is complete or near complete

