How to call static functions in QML.?
Am relatively new to QML though i have studied a bit in tutorials.
I am planning to use Qt Mobility feedback API in QML.
But certain functions in QFeedbackEffect (for ex ,playThemeEffect) are static and are resulting in errors when QML files are interpreted during runtime.
Wondering how to use them in this case and any help here will be appreciated.
To be able to invoke a c++ method from QML, the method declaration should have Q_INVOKABLE in header file. I don't see this method have Q_INVOKABLE in qfeedbackeffect.h file.
May be we need a c++ wrapper class with Q_INVOKABLE methods which intern call these API's.
Thanks , Will try this way.
I am trying to implement QFeedbackEffect::playThemeEffect(QFeedbackEffect::ThemeBasicButton)
from one of the wrapper class (Needed for accessing from QML).
The above functions returns false , i wonder if system theme is currently not supporting this feedback effect.
Any pointers on how to access the current default system theme.?
Are you wrapping the classes yourself, or using the mobility-provided QML wrappers ( http://doc.qt.nokia.com/qtmobility-1.2/qml-feedback-api.html )?
I am not trying to implement my custom feedback , Just trying to play using the API (QFeedbackEffect::playThemeEffect(QFeedbackEffect::ThemeBasicButton)). I understand this API will be using the system theme and playing for playing this feedback effect.
I assume the above classes in above link relate if we are trying to implement the feedback plugin.
The classes in the link provide native QML elements for accessing the feedback API. From a brief look, it looks like http://doc.qt.nokia.com/qtmobility-1.2/qml-themeeffect.html is the one that would work for you (includes an example of playing a ThemeEffect.BasicButton effect).
Hi, I tried it out.. and to make feedback work, we need to do below things...
In .pro file have below code
@QT += declarative
CONFIG += mobility
MOBILITY = feedback@
and in your qml file
@import QtMobility.feedback 1.1@
and now define a ThemeEffect element like below
effect : ThemeEffect.BasicButton
and call @ buttonThemeEffect.play() @ when ever you want the feedback to be played.
Would try this way.Thanks.