Archived:Simple Helloworld in Qt
Qt Quick should be used for all UI development on mobile devices. The approach described in this article (based on QWidget) is deprecated.
In this (archived) article we will learn how to start Qt programing using Qt in Carbide.c++. We will create a simple Hello World program which can be written in Qt.
Article Metadata
Tested with
Compatibility
Article
Prerequisites
Note :If you already have Carbide C++ setup and you are the Symbian developer then move on and just install Qt SDK only, Or else follow this steps
- Install Active Perl
- Install JRE
- Install S60 SDK
- Install Carbide C++
- Guide to install Carbide C++ (Optional)
- Install Qt If you don't find it please try here
Creating Hello World Project
- Launch Carbide C++
- Click on File->New->Qt Project->Select Qt GUI Main Window (Under Qt GUI) -> Put project name ->Select SDK->Check Qt Modules
- Your project will be created and ready to build.
- Open main.cpp from the project explorer
- Paste the below code in your main.cpp file. Build and run the project.
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton helloButton("Hello World");
helloButton.resize(80, 20);
helloButton.show();
return app.exec();
}
First we include the definitions of the QApplication and QPushButton classes. For every Qt class, there is a header file with the same name (and capitalization) as the class that contains the class's definition.Inside {{Icode|main()} the QApplication object to manage application-wide resources. The QApplication constructor requires argc and argv because Qt supports a few command-line arguments of its own. The QPushButton which is a button widget class in Qt and we set the button name as Hello World. resize() helps us to make the size of the button. show() display the button on the screen.
Screenshot
This screenshot was taken from Qt running on an old Symbian emulator (S60 3rd Edition FP2).



18 Sep
2009
22 Sep
2009