mirror of https://github.com/cutefishos/appmotor
Changes: Add examples of using qdeclarativebooster with qmake and cmake.
RevBy: TrustMepull/1/head
parent
faa959762d
commit
b5c05a6fc7
@ -0,0 +1,9 @@
|
|||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
find_package(Qt4 4.7.0 REQUIRED)
|
||||||
|
include(${QT_USE_FILE})
|
||||||
|
include(FindPkgConfig)
|
||||||
|
pkg_check_modules(QDECLARATIVE_BOOSTABLE REQUIRED qdeclarative-boostable)
|
||||||
|
add_definitions(${QDECLARATIVE_BOOSTABLE_CFLAGS})
|
||||||
|
link_libraries(${QDECLARATIVE_BOOSTABLE_LDFLAGS} ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY})
|
||||||
|
add_executable(qml-helloworld main.cpp)
|
||||||
|
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
This example shows how to build a booster-enabled QML Helloworld with cmake.
|
||||||
|
|
||||||
|
Build the example: cmake . && make
|
||||||
|
Run the example without booster: ./qml-helloworld
|
||||||
|
Run the example with booster: invoker --type=d ./qml-helloworld
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** All rights reserved.
|
||||||
|
** Contact: Nokia Corporation (directui@nokia.com)
|
||||||
|
**
|
||||||
|
** This file is part of applauncherd
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at directui@nokia.com.
|
||||||
|
**
|
||||||
|
** This library is free software; you can redistribute it and/or
|
||||||
|
** modify it under the terms of the GNU Lesser General Public
|
||||||
|
** License version 2.1 as published by the Free Software Foundation
|
||||||
|
** and appearing in the file LICENSE.LGPL included in the packaging
|
||||||
|
** of this file.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <Qt/QtDeclarative>
|
||||||
|
#include <applauncherd/mdeclarativecache.h>
|
||||||
|
|
||||||
|
Q_DECL_EXPORT int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
QApplication *app = MDeclarativeCache::qApplication(argc, argv);
|
||||||
|
QDeclarativeView *window = MDeclarativeCache::qDeclarativeView();
|
||||||
|
|
||||||
|
// Use MDeclarativeCache::applicationDirPath()
|
||||||
|
// instead of QCoreApplication::applicationDirPath()
|
||||||
|
// because the latter does not work with the booster.
|
||||||
|
QDir::setCurrent(MDeclarativeCache::applicationDirPath());
|
||||||
|
|
||||||
|
window->setSource(QUrl::fromLocalFile("main.qml"));
|
||||||
|
window->showFullScreen();
|
||||||
|
return app->exec();
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
import Qt 4.7
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 854
|
||||||
|
height: 480
|
||||||
|
Text {
|
||||||
|
id: text1
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: "Hello Boosted QML World!"
|
||||||
|
font.pixelSize: 60
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
This example shows how to build a booster-enabled QML Helloworld with qmake.
|
||||||
|
|
||||||
|
Build the example: qmake && make
|
||||||
|
Run the example without booster: ./qml-helloworld
|
||||||
|
Run the example with booster: invoker --type=d ./qml-helloworld
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** All rights reserved.
|
||||||
|
** Contact: Nokia Corporation (directui@nokia.com)
|
||||||
|
**
|
||||||
|
** This file is part of applauncherd
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at directui@nokia.com.
|
||||||
|
**
|
||||||
|
** This library is free software; you can redistribute it and/or
|
||||||
|
** modify it under the terms of the GNU Lesser General Public
|
||||||
|
** License version 2.1 as published by the Free Software Foundation
|
||||||
|
** and appearing in the file LICENSE.LGPL included in the packaging
|
||||||
|
** of this file.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <Qt/QtDeclarative>
|
||||||
|
#include <applauncherd/mdeclarativecache.h>
|
||||||
|
|
||||||
|
Q_DECL_EXPORT int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
QApplication *app = MDeclarativeCache::qApplication(argc, argv);
|
||||||
|
QDeclarativeView *window = MDeclarativeCache::qDeclarativeView();
|
||||||
|
|
||||||
|
// Use MDeclarativeCache::applicationDirPath()
|
||||||
|
// instead of QCoreApplication::applicationDirPath()
|
||||||
|
// because the latter does not work with the booster.
|
||||||
|
QDir::setCurrent(MDeclarativeCache::applicationDirPath());
|
||||||
|
|
||||||
|
window->setSource(QUrl::fromLocalFile("main.qml"));
|
||||||
|
|
||||||
|
window->showFullScreen();
|
||||||
|
return app->exec();
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
import Qt 4.7
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 854
|
||||||
|
height: 480
|
||||||
|
Text {
|
||||||
|
id: text1
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: "Hello Boosted QML World!"
|
||||||
|
font.pixelSize: 60
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
TEMPLATE = app
|
||||||
|
QT += declarative
|
||||||
|
|
||||||
|
CONFIG += qdeclarative-boostable
|
||||||
|
|
||||||
|
TARGET = qml-helloworld
|
||||||
|
SOURCES += main.cpp
|
||||||
|
|
||||||
|
OTHER_FILES += main.qml
|
||||||
Loading…
Reference in New Issue