那么,从android转移到黑莓级联qml编码。黑莓qml级联2秒开机画面
我想在qml中手动添加启动画面,时间限制为2-3秒。
我该如何做到这一点,因为在qml中没有与时间相关的选项。
在网上搜索和开发者论坛没有透露这种情况。
帮助!帮帮我!帮帮我!
这是我main.qml
import bb.cascades 1.0
import bb.myTimer 1.0 //error unknown library bb.myTimer
Page
{
Container {
layout: DockLayout {
}
onCreationCompleted: {
myTimer.start();
}
ImageView {
id: mImageViewIcon
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
imageSource: "asset:///splash1.png"
}
attachedObjects: [
QTimer { //error : The QTimer component might be an unknown or custom component. Its properties are not validated.
id: myTimer
interval: 3000
onTimeout: {
//Push New Page here
mysheet1.open();
}
},
Sheet
{
id: mysheet1
peekEnabled: false
Page
{
Container
{
background: Color.Transparent
ImageView
{
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
imageSource: "asset:///splash2.png"
}
}
}
}
]
}
}
我的main.cpp
#include <bb/cascades/Application>
#include <QLocale>
#include <QTranslator>
**#include <Qtimer>**
#include "applicationui.hpp"
#include <Qt/qdeclarativedebug.h>
using namespace bb::cascades;
Q_DECL_EXPORT int main(int argc, char **argv)
{
Application app(argc, argv);
**qmlRegisterType<QTimer>("my.timer", 1, 0, "QTimer");**
// Create the Application UI object, this is where the main.qml file
// is loaded and the application scene is set.
new ApplicationUI(&app);
// Enter the application main event loop.
return Application::exec();
}
在此先感谢。
你需要导入定时器为“import my.timer 1.0”,而不是“import bb.myTimer 1.0” – Kunal
你可以在这里找到更多的细节“http://kunalmaemo.blogspot。kr/2012/12/using-timer-with-bb10-cascade-qml-code.html“ – Kunal