Symbian-Developers

The Official Developers Section => Symbian Software Development Discussions => The Developers Section => Qt Application Development => Topic started by: huellif on March 25, 2013, 12:03:00 am

Title: How to: Qt Splashscreen for QML/Qt apps
Post by: huellif on March 25, 2013, 12:03:00 am
Hi
I tried to make an QML Splashscreen, it worked fine but I think this isn't the best way.

After research I figured out how to use a Qt Splashscreen, everything is inside of main.cpp:

- you have to import:

Code: [Select]
#include <QtGui/QSplashScreen>
#include <QtGui/QPixmap>

than edit your main method:
(you have to add this part before the QmlApplication viewer)

Code: [Select]
QSplashScreen *splash = new QSplashScreen(QPixmap(":/splash/splash.jpg"));
    splash->show();

than after the viewer code put:

Code: [Select]
splash->finish(&viewer);
splash->deleteLater();

of course before the "return app->exec();"


This will brick the Qt Simulator, so comment this parts if you test your app!

the path ":/splash/splash.jpg" is for qrc, so add:
Code: [Select]
<RCC>
    <qresource prefix="/">
        <file>splash/splash.jpg</file>
    </qresource>
</RCC>
to your qrc file.


The best picture size is 640*640, because the picture get's croped (depending on your devices orientation)

I attached an example.

Sources:
http://harmattan-dev.nokia.com/docs/library/html/qt4/qsplashscreen.html?tab=3&q=splash&sp=all
https://github.com/dicksonleong/GagBook

[attachment deleted by admin]
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: symster on February 08, 2014, 01:28:37 pm
More tips.To prevent users from accidentally closing the splashscreen when they touch the screen,add the code below.With this even when users touch the screen,the splashscreen will still show instead of disappear when touched.

Code: [Select]
splash->setEnabled(false);
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: huellif on February 10, 2014, 12:03:14 am
are you sure it's needed with Qt 4.8?
For me touching the splashscreen does nothing.
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: symster on February 10, 2014, 09:51:46 am
Well for my n8 belle refresh it is needed.Without this line,the splashscreen disappear when touched.Tested few times so it is confirm.
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: matthew on February 10, 2014, 07:12:12 pm
It seems to do the same in Anna; but i only have a few Qt apps with splashscreens so i have little testing to back that statement.
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: symster on February 10, 2014, 08:04:32 pm
It seems to do the same in Anna; but i only have a few Qt apps with splashscreens so i have little testing to back that statement.
You mean your app have splashscreen disappear when touched or i misunderstood what you wrote.
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: matthew on February 10, 2014, 08:51:24 pm
Well, i installed a few more to test and it seems that this is inconclusive.
Some can be closed by touch and some can not.
i am aware of the difference between a loading screen and a splashscreen, too, so it's not a question of misunderstanding here.
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: symster on February 10, 2014, 09:15:09 pm
Well the app you test,does it use qt or qml splashscreen?.Anyway it could be just due different qt versiom only.I don't really understand what you mean inconclusive.Maybe some developers do the method above and some don't.
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: matthew on February 10, 2014, 09:18:46 pm
Well the app you test,does it use qt or qml splashscreen?.Anyway it could be just due different qt versiom only.I don't really understand what you mean inconclusive.Maybe some developers do the method above and some don't.
Inconclusive means not conclusive. Not able to be concluded.
ie, the results were mixed and i haven't read any of the QML so i can't say for certain one way or another about the splash.
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: matthew on February 10, 2014, 09:20:52 pm
^(And i am still a bit shaky with QML. i haven't found it as easy to read as some other code.)^
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: symster on February 10, 2014, 09:56:27 pm
^(And i am still a bit shaky with QML. i haven't found it as easy to read as some other code.)^

I even took 2month just to understand the syntax but once you know the way it is easier than c++ which is prone to syntax error
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: matthew on February 10, 2014, 10:06:30 pm
http://harmattan-dev.nokia.com/docs/library/html/qt4/qsplashscreen.html?tab=3&q=splash&sp=all returns:
Quote
An error occurred while processing your request.
Reference #97.e9e90cc3.1392051768.1bd27b70
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: symster on February 10, 2014, 10:16:58 pm
Harmattan online documentation is no longer available since they reshuffle nokia developer.Now they only provide offline document at http://developer.nokia.com/resources/download/4255/?id=4255 and the wiki http://developer.nokia.com/resources/download/4255/?id=4255 .If you are more active in harmattan then this site is probably more suitable http://talk.maemo.org/ .This is where all great developers like burning plaform and cutetube dev active
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: matthew on February 10, 2014, 10:19:39 pm
@symster Thanks for the links, mate.
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: symster on February 10, 2014, 10:27:07 pm
 ;)
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: Allstar12345 on February 10, 2014, 11:05:33 pm
I even took 2month just to understand the syntax but once you know the way it is easier than c++ which is prone to syntax error

Took me a while too, now I'm unstoppable :P
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: matthew on February 11, 2014, 09:08:44 pm
You guys are all significantly more knowledgable about this than i am, so i want to ask if Qt is really that great a place for a square-one student of programming.
My only previous experience with anything even remotely programming is HTML, but when i look at javascript it seems fairly straightforward and understandable for me. QML is like Chinese to me.
Ignoring a goal of Symbian programming, do you really feel like QML is the best first step for an absolute noob? It doesn't even have to be related to an S60 framework; any programming language i can test in Windows/Linux/Symbian is cool by me.

And sorry for the off-topic this has become (my fault).
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: Allstar12345 on February 11, 2014, 10:12:16 pm
QML is the best example of a declerative langauage, you see you declare a component Menu{} for example then do as you please, it probably is the best for noobs.
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: matthew on February 12, 2014, 05:57:05 am
Thank you - you've put it into context for me :)
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: symster on February 12, 2014, 04:57:23 pm
Infortunately the qml itself is quite limited to Ui and simple application logic.To be able to to create a more complicate/powerful app you need some c++ include.
Title: Re: How to: Qt Splashscreen for QML/Qt apps
Post by: Allstar12345 on February 12, 2014, 10:54:41 pm
Infortunately the qml itself is quite limited to Ui and simple application logic.To be able to to create a more complicate/powerful app you need some c++ include.

Well, depends what you want to do really.