vendredi 7 mars 2008

Using QT for creating cool apps. Part 1

Jukebox3D is my first QT4 application, porting it from gtk has been a challenge for me. Why ?

- First it was c++, if you are not fluent in object oriented tricks and vocabular, you will need to learn some basics skill like polymorphism/functions overload.

Because QT Frameworks use a lot of overloaded functions, you will encounter in your first program some errors ( yes sometimes I forget a thing :) ) containing overload output, and it's better to be aware about that for understanding the real error.

- Learn qmake tool and it's very easy, the manual appear to be complex but if you see an example ( jukebox3D.pro ) i 'am sure you will understand:

TEMPLATE = app

INCLUDEPATH += src/libQtAmazon/
CONFIG += opengl warn_on qt release link_pkgconfig debug
QT += gui opengl core xml network
FORMS += ui/optionswindow.ui ui/savebox.ui
RESOURCES += data/optionsimpl.qrc
PKGCONFIG +=
DEFINES += QT_NO_DEBUG_OUTPUT GL_GLEXT_PROTOTYPES

SOURCES += src/main.cpp \
src/window.cpp \
src/glwidget.cpp \
src/model.cpp \
src/optionsimpl.cpp \
src/saveboximpl.cpp \
src/xmlconfig.cpp \
src/libmpdclient.c \
src/item.cpp \
src/song.cpp \
src/iconvasciicodec.cpp \
src/covermanager.cpp \
src/libQtAmazon/QAmazon.cpp \
src/libQtAmazon/QAmazonImage.cpp

HEADERS += src/window.h \
src/glwidget.h \
src/model.h \
src/libmpdclient.h \
src/optionsimpl.h \
src/main.h \
src/xmlconfig.h \
src/saveboximpl.h \
src/libmpdclient.h \
src/item.h \
src/song.h \
src/iconvasciicodec.h \
src/covermanager.h \
src/libQtAmazon/QAmazon.h \
src/libQtAmazon/QAmazonImage.h
Thats all, if you need to regenerate the MakeFile you only need to type qmake (equivalent to autogen.sh && ./configure ) in a shell. After that you can type make and see a magic wand in action !

In Part 2, i will abord the IDE problem ;)

Aucun commentaire: