那麼,從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