Developing Symbian applications with QT in Windows (traditional Edition)

Source: Internet
Author: User

Developing Symbian applications with QT in Windows (traditional Edition)



At http://blog.csdn.net/htttw/article/details/7630831,we introduced how to use QT quick to develop Symbian applications. However, I am not very familiar with the new design methods introduced by NOKIA. Therefore,Today, we can use the traditional QT development method to develop Symbian applications., Our example is very simple:Show current time. Finally, we need to put it in Nokia
5230 run in mobile phone:



1.

Install QT:

See http://blog.csdn.net/htttw/article/details/7630831 for details



2.

Open QT and select "QT Control Project --> qt gui application" (do not think it can only create the QT program of the desktop version. After testing, you can also use the mobile version !) :



Click Next



3.

Enter Timer:



Click Next




4.

Select all three targets:




Click Next



5.

Select qwidget from the drop-down list box. Keep the default values for other widgets:



Click Next and keep default.



6.

Open the widget. UI. Because the screen size of my Nokia 5230 is 360*640Change the window size to 360x640.And then put some controls. The link will be provided at the end of this article to download the source code:

The time displayed above is a label, and the button below is a Pushbutton:





7.

Modify widget. h as follows:

#ifndef WIDGET_H#define WIDGET_H#include <QWidget>#include <QtGui>#include <QTime>namespace Ui {    class Widget;}class Widget : public QWidget{    Q_OBJECTpublic:    explicit Widget(QWidget *parent = 0);    ~Widget();private:    Ui::Widget *ui;    QTimer * timer;    bool running;private slots:    void startRunning();    void timerShot();};#endif // WIDGET_H


Modify widget. cpp as follows:

# Include "widget. H "# include" ui_widget.h "Widget: widget (qwidget * parent): qwidget (parent), UI (new UI: widget) {/* avoid Chinese garbled characters */qtextcodec * codec = qtextcodec: codecforname ("system"); // obtain the system code qtextcodec: setcodecforlocale (codec); qtextcodec :: setcodecforcstrings (codec); qtextcodec: setcodecfortr (codec); UI-> setupui (this); running = false; timer = new qtimer (this); qobject: connect (timer, signal (timeou T (), this, slot (timershot (); qobject: connect (ui-> btnstart, signal (clicked (), this, slot (startrunning ();} Widget ::~ Widget () {Delete UI; Delete timer;} void Widget: startrunning () {If (! Running) {timer-> Start (1000); UI-> btnstart-> settext (TR ("pause");} else {timer-> stop (); UI-> btnstart-> settext (TR ("START");} running =! Running;} void Widget: timershot () {qtime T = qtime: currenttime (); qstring STR; UI-> labeltime-> settext (Str. sprintf ("% 02d: % 02d: % 02d", T. hour (), T. minute (), T. second ()));}



8.

Select the QT simulator as the target in the lower left corner of QT. The running result is as follows:



Click Start to display the current time of the program. Refresh once every second. Click pause to pause the program.



9.

If the target in the lower-left corner of QT is a Saipan device, the error message indicating that no device is connected is displayed. However, time has been generated in the timer project folder directory. sys, directly download it to your mobile phone for installation. The result of running the mobile phone is as follows (InstallationDo not forget to install the QT library before time. sys.):

Start interface:




Running interface:




From the above description, we can use the traditional QT Method to Design Symbian applications. Due to the chaos in the past few days, I will.



Finally, for convenience, I have uploaded the source code:

Http://download.csdn.net/detail/htttw/4351994




Done!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.