Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.
Harmattan Booster for Qt Quick Applications
[toc align_right="yes" depth="3"]
Manually Enabling Harmattan Booster Library
Up until and including Qt Creator 2.3.0, the "Qt Quick Application" wizard doesn't make use of the Harmattan booster library. This has a negative impact on application startup time, and might even lead to problems when submitting the application to the Ovi store.
Qt Creator 2.3.1 (which is now included in the latest updates to the Qt SDK) already enables the booster by default! The instructions below are only for people who have already projects created with 2.3.0 or older, or are not willing to update for whatever reasons.
This page outlines the changes you can do by hand to the source code to enable the booster. However, by making these changes your application will not compile any more for other targets!
Changes to main.cpp
Replace your main.cpp with following code (obviously replacing "YourApp" by the name of your app):
<br />#include <QtGui/QApplication&gt;<br />#include <QtDeclarative/QDeclarativeView&gt;<br />#include <QtDeclarative/QDeclarativeEngine&gt;<br />#include <MDeclarativeCache&gt;
Q_DECL_EXPORT int main(int argc, char *argv[])<br />{<br /> QScopedPointer&lt;QApplication&gt; app(MDeclarativeCache::qApplication(argc, argv));<br /> QScopedPointer&lt;QDeclarativeView&gt; view(MDeclarativeCache::qDeclarativeView());
view->setSource(MDeclarativeCache::applicationDirPath()<br /> + QLatin1String("/../qml/YourApp/main.qml&quot;));
QObject::connect(view->engine(), SIGNAL (quit()), view.data(), SLOT (close()));
view->showFullScreen();
app->exec&amp;#40;&#41;;<br />}<br />
Changes to .pro file
Add
<br />CONFIG += qdeclarative-boostable<br />
to the .pro file, and don't forget to do a full recompile!
Changes to .desktop file
Open YourApp_harmattan.desktop in the project directory, and change
<br />Exec=/usr/bin/single-instance /opt/YourApp/bin/YourApp<br />
to
<br />Exec=/usr/bin/invoker —type=d -s /opt/YourApp/bin/YourApp<br />
Do you have questions, or suggestions? Raise them under http://developer.qt.nokia.com/forums/viewthread/9164