Sunday, August 30, 2009

Qt Tutorial Part 2

After long gaps I am able to write and publish part 2 of my 3 series tutorials of Qt on s60.
Here is the Part 2 for everyone to read.
Qt_for_s60 Part 2

Saturday, August 8, 2009

Qt Tutorial Part 1

Finally I have been able to write up some tutorial. This tutorial would be a 3 part series. I have written the first part and second is partially complete.

Here is the part one of the series.

Wednesday, July 8, 2009

30Sec FAQ -- Addendum - Command Line

1) How to build application from command line?
Using a basic command navigate to the directory that contains your .cpp file. (Say c:\Qt\demos\boxes\)
c:\> cd c:\Qt\demos\boxes\

c:\Qt\demos\boxes\> qmake

c:\Qt\demos\boxes\> make

2) How to create .pro file for the project?
c:\Qt\demos\boxes\> qmake -project

This command will automatically generate project file(.pro file).

3) How to add library to Command Line command?
qmake -project QT+=network

Tuesday, July 7, 2009

Back to Qt on s60

After taking big break from Qt on s60, I am back at working on Qt on s60.

Between the break, Nokia released the Tower release in June.

With it, it brings QtSql, Experimental QtWebkit most notable modules in the release.

With QtSql, now one can access sqlite3 database. This release is going to be play around with.

Currently I am building tutorials for Qt on s60, so keep watching this blog.

Tuesday, January 20, 2009

30secs FAQ

1) Screen Resolution not correct on 3.1 Device. Your application runs out of bounds when created from Template.

Check the settings for the default window. There is nothing wrong in your setup. The Templates are not stable yet. So some manipulation is required.

2) Unable to close QT application.
Just press Red key on your phone and the application would be closed.

3) Unable to find custom slot created in my class, when using Signal/Slot dialog box. How do I use the custom slot in such a scenario?
Probably you need to work a way around this. Edit "MyApplication.cpp"(Name of Application in this case is MyApplication. Add your signal slot call in constructor of your MyApplication Class function. And there you go :)
for Eg:
class GUIWidget : public QWidget
public slots:
void plusClicked();

GUIWidget::GUIWidget(QWidget *parent)
: QWidget(parent)
QObject::connect(ui.pushButton1, SIGNAL(clicked()), this, SLOT(plusClicked()));
NOTE: "pushButton1" is the button created using GUI toolbox(QT C++ Widget Box).

4) New Signal/slot information is not reflected (after new interaction is added using Signal/Slot dialog Box) to the class is not reflected in ui_MyApplication.h, when seen in Carbide.
Just close the MyApplication.ui (after addition of new Signal/Slot information in Signal/Slot Dialog Box )and open ui_MyApplication.h. It should now work for you. You can verify the changes simultaneously by opening the ui_MyApplication.h file in some other editor.

5) How to Change UID of the application

Edit .pro file of the application.

6) How do I add new src paths and files

Edit the .pro file of the application.

7) How do I add icon to PushButton?
QPixmap pixmap("c:\\ncim_logo.png");
QIcon icon("c:\\ncim_logo.png");
pushButton = new QPushButton("PushButton");

NOTE: The png file should be placed at following location /epoc32/winscw/c/Data

8) How to open a large image file?
Open load using QPixmap and edit .pro as follows.
symbian: {
TARGET.EPOCHEAPSIZE = 0x20000 0x1000000
A better approach would be to use Image Reader class than using QPixmap as the images load faster than QPixmap.
NOTE: Avoid using large files as the mobile has limited resources and this way of manipulating epoc heap size is not recommended.

8) How to access Private Path?
Use QCoreApplication::applicationDirPath

Keep watching this post for further updates.

Monday, January 19, 2009

Tracing Errors occuring during QT (temple) installation on s60 ( On WinXP)

Here are some of the errors and their resolution(fixes)

a) Gmake Not Found

If you are facing an error similar to this

Running syncqt...
Creating qmake...
mwccsym2 -gccinc -stackcommit 1024000 -stackreserve 1024000 -w all -w nonotused
-w nonotinlined -w noimplicit -w nopadding -w noemptydecl -w nounusedexpr -c -o
project.o -O -I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\
mac -Igenerators\symbian -IC:\Qt\4.4.2-pyramid\include -IC:\Qt\4.4.2-pyramid\inc
lude\QtCore -IC:\Qt\4.4.2-pyramid\include -IC:\Qt\4.4.2-pyramid\include\QtCore -
IC:\Qt\4.4.2-pyramid\src\corelib\global -IC:\Qt\4.4.2-pyramid\mkspecs\win32-mwc
\Qt\4.4.2-pyramid\include\QtScript -DQMAKE_OPENSOURCE_EDITION project.cpp
process_begin: CreateProcess((null), mwccsym2 -gccinc -stackcommit 1024000 -stac
kreserve 1024000 -w all -w nonotused -w nonotinlined -w noimplicit -w nopadding
-w noemptydecl -w nounusedexpr -c -o project.o -O -I. -Igenerators -Igenerators\
unix -Igenerators\win32 -Igenerators\mac -Igenerators\symbian -IC:\Qt\4.4.2-pyra
mid\include -IC:\Qt\4.4.2-pyramid\include\QtCore -IC:\Qt\4.4.2-pyramid\include -
IC:\Qt\4.4.2-pyramid\include\QtCore -IC:\Qt\4.4.2-pyramid\src\corelib\global -IC
:\Qt\4.4.2-pyramid\mkspecs\win32-mwc -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQ
QT_NO_DATASTREAM -DQT_NO_LIBRARY -IC:\Qt\4.4.2-pyramid\include\QtScript -DQMAKE_
OPENSOURCE_EDITION project.cpp, ...) failed.
make (e=2): The system cannot find the file specified.
C:\Symbian\9.2\S60_3rd_FP1\epoc32\tools\make.exe: *** [project.o] Error 2
Creating makefiles in src...
Generating Makefiles...
execute: File or path is not found (C:\Qt\4.4.2-pyramid\bin\qmake)
Qmake failed, return code -1



Check whether you have set the "\Qt\4.4.4-temple\bin" directory correctly in your path. If still you face the problem, intiate the batch file (Configure environment for WINSCW command line) that comes alongwith Carbide Installation.
That should fix the errors if any you might face.

b) Sdk Not Found in carbide when creating QT application from template
Check have you extracted the "qtlibs-4.4.4-temple.exe" given in the instructions. It can be found over here "\QT\Qt4.4.4_temple\". This package contains all the binaries and libraries and headers required to integrate QT as part of sdk.

c) Emulator Option not shown
This will happen, if you forgot to build QT for emulator.
You should do
bldmake bldfiles
abld build winscw udeb
after extracting qtlibs-4.4.4-temple.exe

d) Installation not getting signed
If you sign an application with your developer certificate and you try to install this sometimes it won't work (atleast in my case it doesn't work)
Yet to find a solution for this. :(