Transcript
Page 1: Mobile Development with Qt for Symbian

Mobile Application Developmentwith Qt for Symbian

Page 2: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Visit:

bit.ly/qtsymbian...get Qt for your phone

Page 3: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

About Me

Jason Barron

3

Started July, 2005

Began in Support

Switched to Development

Page 4: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

About Me

Alessandro Portale

09/02 – 01/07Color management

02/07 – 03/08Qt tools

04/08 – todayQt port to Symbian

Page 5: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Goal

• Why use Qt for Symbian?

• Learn what you need to get started.

• Learn how to make great apps on Symbian.

Page 6: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Agenda

• Getting Started

• Application Development

• UI Types

• New “Mobile-esque” Features in 4.6

• Advanced integration

Page 7: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Why use Qt for Symbian?

1. Symbian is a relevant mobile platform.

2. Qt is an easy way to access Symbian.

3. Many of you already know Qt!

Page 8: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

The Symbian Landscape

S60 3.1, 3.2 S60 5.0

Symbian^1 S^2 S^3 S^4

Today

Page 9: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

The Developer’s Shopping List

SDK

IDE

Open C plugin (POSIX)

Qt

Page 10: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Compilers

Free Available From Binaries Can be used to compile

Qt Apps

WINSCW Yes Carbide.c++ Win32* Yes Yes

GCC-E Yes S60 SDK(CodeSourcery)

ARM No** Yes

RVCT No ARM Ltd. ARM Yes Yes

* Win32 binaries run in the Symbian Emulator

** Technically can compile Qt, but libraries containing WSD will not run

Page 11: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Agenda

• Getting Started

• Application Development

• UI types

• New “Mobile-esque” Features in 4.6

• Advanced integration

Page 12: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Demo

Page 13: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Application Development – From Scratch

• Carbide's Qt project wizard• Editing the Ui Form• show(), showMaximized() or

showFullScreen()?• Running the application in the emulator• Running the application on the phone

Page 14: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Demonstration

Page 15: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Carbide's Qt project wizard

Page 16: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Carbide's Qt project wizard

Page 17: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Carbide's Qt project wizard

Page 18: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Carbide's Qt project wizard

Page 19: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Carbide's Qt project wizard

Page 20: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Carbide's Qt project wizard

Page 21: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Editing the Ui Form

Page 22: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Editing the Ui Form

Page 23: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Editing the Ui Form

Page 24: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Editing the Ui Form

Page 25: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Editing the Ui Form

Page 26: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Editing the Ui Form

Page 27: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Adjusting the show() call

Page 28: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Adjusting the show() call

Page 29: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Running the application in the emulator

Page 30: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Running the application in the emulator

Page 31: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Running the application in the emulator

Page 32: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Running the application in the emulator

Page 33: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Building and deploying for the device

Page 34: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Command Line

C:\qt\...\analogclock> qmake

C:\qt\...\analogclock> make debug-winscwC:\qt\...\analogclock> make release-gcceC:\qt\...\analogclock> make release-armv5

C:\qt\...\analogclock> make sis

Page 35: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Port an existing application

• Original application on the Desktop

• Carbide's Qt .pro file import• Running the application in the emulator• Desktop Ui vs. Mobile Ui

Page 36: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Carbide's Qt .pro file import

Page 37: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Carbide's Qt .pro file import

Page 38: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Carbide's Qt .pro file import

Page 39: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Running the application in the emulator

Page 40: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Running the application in the emulator

Page 41: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Desktop Ui vs. Mobile Ui

Successful port?

Page 42: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Desktop Ui vs. Mobile Ui

Mobile friendly Ui

Page 43: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Desktop Ui vs. Mobile Ui

Including different Ui headers

Page 44: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Desktop Ui vs. Mobile Ui

Instantiating and showing different Uis

Page 45: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Desktop Ui vs. Mobile Ui

AppController knows the view as QObjectthat emits colorChanged()

Page 46: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Desktop Ui vs. Mobile Ui

Both Uis emit a colorChanged() signal

Page 47: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Agenda

• Getting Started

• Application Development

• UI Types

• New “Mobile-esque” Features in 4.6

• Advanced integration

Page 48: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

UI Types

Page 49: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Agenda

• Getting Started

• Application Development

• UI Types

• New “Mobile-esque” Features in 4.6

• Advanced integration

Page 50: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

qmake Keywords

• MMP_RULES• BLD_INF_RULES

• TARGET– .UID3– .EPOCHEAPSIZE– .CAPABILITY

• DEPLOYMENT• ICON

• QMAKE_CXXFLAGS– .ARMCC– .WINSCW

Page 51: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Input Method Hints

… QWidget::inputMethodHints() const;

void QWidget::setInputMethodHints(…);

Page 52: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Input Method Hints

• Change Behavior:– Qt::ImhHiddenText– Qt::ImhNoAutoUppercase– Qt::ImhPreferNumbers– Qt::ImhPreferUppercase– Qt::ImhPreferLowercase– Qt::ImhNoPredictiveText

• Restrict Input:– Qt::ImhDigitsOnly– Qt::ImhFormattedNumbersOnly– Qt::ImhUppercaseOnly– Qt::ImhLowercaseOnly– Qt::ImhDialableCharactersOnly– Qt::ImhEmailCharactersOnly

• Masks:– Qt::ImhExclusiveInputMask

Page 53: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Soft keys

QAction::setSoftKeyRole(…);…QAction::softKeyRole() const;

enum SoftKeyRole {QAction::NoSoftKey, //(default)QAction::PositiveSoftKey,QAction::NegativeSoftKey,QAction::SelectSoftKey,}

Page 54: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Navigation Modes

void QApplication::setNavigationMode(...);... QApplication::navigationMode();

enum NavigationMode {NavigationModeNone,NavigationModeKeypadTabOrder,NavigationModeKeypadDirectional,NavigationModeCursorAuto,NavigationModeCursorForceVisible

};

Page 55: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Exceptions

MyWidget::MyWidget(QWidget *parent) : QDialog(parent),label(new QLabel("Name?", this)),edit(new QLineEdit(this)),button(new QPushButton("Ok"))

{setLayout(new QVBoxLayout);layout()->addWidget(label);layout()->addWidget(edit);layout()->addWidget(button);

}

What happens if ‘new’ on line 4 throws std::bad_alloc?

Page 56: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

QScopedPointer

class MyWidget: public QDialog{

Q_OBJECT

public:MyWidget(QWidget *parent = 0);

private:#ifdef USE_SCOPED_POINTER

QScopedPointer<QLabel> label;QScopedPointer<QLineEdit> edit;QScopedPointer<QPushButton> button;

#elseQLabel *label;QLineEdit *edit;QPushButton *button;

#endif};

Deletes it’s object when the scope terminates.

Page 57: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Agenda

• Getting Started

• Application Development

• UI Types

• New “Mobile-esque” Features in 4.6

• Advanced integration

Page 58: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Event Dispatcher – Active Scheduler

• Active objects can be used as normal

ActiveScheduler

Qt

Page 59: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Handling Symbian Leaves

• QT_TRAP_THROWING– Converts leaves to exceptions

• QT_TRYCATCH_ERROR– Converts exceptions to errors

• QT_TRYCATCH_LEAVING– Converts exceptions to leaves

Page 60: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

RWindow, CCoeControl and QWidget

• QWidget::winId() – Returns a CCoeControl

• Always window owning:

CCoeControl *c = widget->effectiveWinId();RWindow *rw =

static_cast<RWindow*>(c->DrawableWindow());

Page 61: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Thank You!Questions?

Page 62: Mobile Development with Qt for Symbian

Qt for Symbian:  bit.ly/qtsymbian

Reference

• Download an SDK from:

– Forum Nokia (http://forum.nokia.com)

– Samsung Mobile Innovator (http://innovator.samsungmobile.com)

– Symbian Foundation (http://developer.symbian.com)

62


Recommended