| ID | Creation date | 29 December 2008 | |
| Platform | S60 3rd Edition, S60 5th Edition | Tested on devices | Emulator |
| Category | Qt for Symbian | Subcategory | Getting started |
| Keywords (APIs, classes, methods, functions): PushButton, TextLabel, Signal and Slot |
This article is for beginners who want to start development in Qt for Symbian. Before following the steps given here please make sure that Carbide.c++, S60 SDK and Qt for Symbian are properly installed.
Carbide.c++ preferences: Window > Preferences > Qt > Add...
In the above screen you will need to use the directory path for
the current version e.g. c:\Qt\4.6.0-beta\bin and c:\Qt\4.6.0-beta\include
Open the Carbide IDE and click File > New > Qt Project.
A new window will open on the screen. This will show the application types that can be created. Click Qt GUI Widget and then click Next.
Enter a name for the project and click Next.
Select the SDK to create the project for and click Next.
Select the module(s) and click Next. For our example, click Next without selecting any extra modules.
The class name is required. By default it is the application name. Click Finish to proceed.
After finishing these steps, the project is ready. Several files are created automatically as shown in the following screenshot.
If you have more than one version of Qt for Symbian installed on your machine, choose the correct version as shown here:
Carbide.c++ > Windows > Show View > Other... > Qt
#ifndef HELLO_H
#define HELLO_H
#include <QtGui/QWidget>
#include "ui_Hello.h"
class Hello : public QWidget
{
Q_OBJECT
public:
Hello(QWidget *parent = 0);
~Hello();
public slots: //We have added this section to handle "clicked()" event on "helloButton"
void ShowHelloText(); // Fill the label text on clicking "Hello" button
private:
Ui::HelloClass ui;
};
#endif // HELLO_H
#include "Hello.h"
Hello::Hello(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
// Signal and slot mechanism for "helloButton"
QObject::connect(ui.helloButton, SIGNAL(clicked()), this, SLOT(ShowHelloText()));
}
Hello::~Hello()
{
}
//We have implemented the following function to display "HelloWorld!!!" text in TextLabel
void Hello::ShowHelloText()
{
ui.label->setText("HelloWorld!!!");
}
Carbide.c++ >> Import >> Qt >> Qt Project >> Hello.pro
No related wiki articles found