Quickstart: Qt for Windows, Symbian and Maemo / Meego v2.0.8 (January 10th, 2011)
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Quickstart: Qt for Windows, Symbian and Maemo / Meego v2.0.8 (January 10th, 2011)

  • 13,712 views
Uploaded on

Complete instructions on how to set up your development environment to develop using Qt and deploy with one click to Windows, Symbian, Maemo / MeeGo and the Qt Simulator. Based on the Nokia Qt SDK......

Complete instructions on how to set up your development environment to develop using Qt and deploy with one click to Windows, Symbian, Maemo / MeeGo and the Qt Simulator. Based on the Nokia Qt SDK Beta.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Seems like a useful presentation for getting started with Qt on Maemo/Meego. Will be following these steps.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
13,712
On Slideshare
13,509
From Embeds
203
Number of Embeds
6

Actions

Shares
Downloads
294
Comments
1
Likes
6

Embeds 203

http://www.slideshare.net 81
http://websites.networksolutions.com 59
http://www.evolvebeyondmoney.com 35
http://evolvebeyondmoney.com 16
http://blogs.nokia.com 11
http://localhost:3000 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Quickstart Qt for Windows, Symbian and Maemo / MeeGo Andreas Jakl Senior Technical Consultant Forum Nokia 23 August, 2010 v2.0.3
  • 2. 23.08.2010 © 2010 Nokia 2 Task • Run a Hello World application on – Windows – Maemo 5 device – Symbian device Windows 7 Maemo 5 Symbian^1 (S60 5th Edition)
  • 3. 17.06.2010 © 2010 Nokia 3 Prerequisites • Requirements for this tutorial: – Windows XP / 7 – Development on Linux / Mac OS will be similar; full support coming soon! • General hints: – Install all tools to the same drive (e.g., C:) – Do not use network drives – Use default installation paths. Be wary of paths that contain spaces / special characters
  • 4. General Qt (plus: for Windows)
  • 5. 23.08.2010 © 2010 Nokia 5 All In: Qt SDKs Common Qt APIs Qt SDK for Nokia Qt Qt SDK for Qt SDK for Qt SDK for Qt SDK for Embedded SDK Windows Windows CE Mac OS Linux / X11 Linux Windows Other Symbian Simulator Mac OS X Linux (X11) CE / Mobile devices Windows MeeGo You can of XP / Vista / 7 course install multiple SDKs at the same time
  • 6. 23.08.2010 © 2010 Nokia 6 Nokia Qt SDK • One-Click installation: – Development tools – Build for and debug in real devices • Symbian • MeeGo / Maemo – Test on host PC • Simulator – Qt Mobility • No extra device SDKs required anymore
  • 7. 04.06.2010 © 2010 Nokia 7 Installation • Install Nokia Qt SDK – For mobile development • Install Qt SDK for Windows – Optional – For desktop development http://www.forum.nokia.com/Library/Tools_and_downloads/ http://qt.nokia.com/downloads
  • 8. 23.08.2010 © 2010 Nokia 8 New Qt Project File → New File or Project… Empty Qt Project Project properties – Name: Hello World – Create in: workspace directory on same drive as tools, without space characters Qt versions – Select all targets you are interested in
  • 9. 23.08.2010 © 2010 Nokia 9 Main Source File Project management – Accept defaults Right-click on project → Add New… → C++ source file – Name: main.cpp – Path: project path (default) – Accept defaults on next page
  • 10. 23.08.2010 © 2010 Nokia 10 Hello World – Source Code Write following code into empty main.cpp: main.cpp #include <QApplication> #include <QPushButton> int main(int argc, char *argv[]) { QApplication app(argc, argv); QPushButton helloButton("Hello World"); helloButton.resize(150, 50); helloButton.show(); return app.exec(); }
  • 11. 23.08.2010 © 2010 Nokia 11 Run the Application Make sure “Desktop” is current build target Click on play arrow
  • 12. 23.08.2010 © 2010 Nokia 12 Hello World – Components • QApplication – One per GUI app – Manages app-wide resources (default font, cursor, ...) • QPushButton – Default widget, based on QWidget – Can process user input and draw graphics
  • 13. 23.08.2010 © 2010 Nokia 13 Extend Hello World: Quit • Add functionality to exit the Hello World example: QObject::connect(&helloButton, SIGNAL(clicked()), &app, SLOT(quit())); – Button emits clicked() signal – Connected to QApplication::quit()
  • 14. 17/03/2010 © 2010 Nokia 14 Signals & Slots • Signal – Emitted when a particular event occurs (e.g., clicked()) – Qt widgets: predefined signals – Also create your own signals • Slot – Function called in response to a signal – Qt widgets: predefined slots (e.g., quit()) – Also create your own slots • Connection signals  slots established by developer, handled by Qt framework
  • 15. 23.08.2010 © 2010 Nokia 15 Nokia Qt SDK: Simulator • Efficient Testing – Quick launch – Scripting possibilities • Using JavaScript – Simulate phone events & Qt Mobility features • Location, contacts, battery, messages, etc. – Skins for different platforms / form-factors • Resolutions, orientation, etc. – No full phone emulator • Only interact with your application. No ARM compiler involved.
  • 16. 23.08.2010 © 2010 Nokia 16 Launching the Qt Simulator • Execute Hello World on Simulator – Select Qt Simulator target – Click on Play
  • 17. 23.08.2010 17 Qt for Maemo / MeeGo
  • 18. 23.08.2010 © 2010 Nokia 18 Qt for Maemo • Development options – Full Linux Environment (Scratchbox) • Install Linux on your PC (e.g., Ubuntu) • Guide: http://wiki.maemo.org/Documentation/Maemo_5_Final_SDK_Installation • Or use VMware on Windows / Mac (a bit outdated) – http://maemovmware.garage.maemo.org/ – Nokia Qt SDK (based on MADDE) • Works on Windows, Linux, Mac OS X • Full Qt support out of the box!
  • 19. 23.08.2010 © 2010 Nokia 19 MADDE • MADDE? – Comes with Nokia Qt SDK – Maemo Application Development and Debugging Environment – Toolchain that supports compiling and deploying MeeGo applications without setting up an own Linux environment – Cross-Compilation – http://wiki.maemo.org/MADDE
  • 20. 04.06.2010 © 2010 Nokia 20 Maemo → MeeGo • MeeGo fully compatible to Qt & Qt Creator – As a 3rd party developer, most changes to the OS are irrelevant to you if you use Qt – Start developing now on Maemo 5!
  • 21. 04.06.2010 © 2010 Nokia 21 Setting up the Device • Configure your N900 – To enable direct deployment and debugging from Qt Creator – Requires installing MAD Developer tools • Add developer repositories to download tools – Open the App manager on the N900 – Menu → Application catalogues → New • Catalogue name: Extras • Web address: http://repository.maemo.org/extras/ • Distribution: fremantle • Components: free non-free
  • 22. 23.08.2010 © 2010 Nokia 22 Mad Developer • Download and install – mad-developer package – In Application manager, click on Download → All → start typing “mad-” on hardware keyboard to filter list and search for apps
  • 23. 04.06.2010 © 2010 Nokia 23 Qt Mobility (optional) • N900 PR 1.2 Firmware (current) – Contains Qt 4.6.2 – Doesn’t ship with Qt Mobility packages • Installation of Qt Mobility libraries – Install package “rootsh” through App Manager – Start X Terminal, type: $ sudo gainroot $ apt-get update $ apt-get install libqtm-*
  • 24. 04.06.2010 © 2010 Nokia 24 Connect the Device • Select connection mode – Start the “Mad Developer” application on the N900 – Click on “Manage USB” → “Load g_ether” • In any connection mode prompts that pop up, just close the dialog by clicking outside of it – Make sure “Module in use” is “g_ether” and click close
  • 25. 04.06.2010 © 2010 Nokia 25 Connect the Device • Configure USB / Ethernet connection – Click on “Edit” and ensure following setup • IP Address: 192.168.2.15 • Netmask: 255.255.255.0 – Click on “Configure” to apply
  • 26. 04.06.2010 © 2010 Nokia 26 Configure the PC Windows 7: Network and Sharing Center → Change adapter settings • Set a static IP for the USB Ethernet connection to the N900 – Open the Network Connections – Right-click on the Local Area Connection of the “Linux USB Ethernet/RNDIS Gadget” device → Properties – Select “Internet Protocol (TCP/IP)” → Properties – Enter a static IP setting • IP address: 192.168.2.14 • 255.255.255.0 • Default gateway: 192.168.2.15 (or leave empty)
  • 27. 04.06.2010 © 2010 Nokia 27 Connect Qt Creator to Maemo Device • Test the connection – Start Qt Creator – Options → Qt4 → Maemo Devices – Add a device, choose a configuration name (e.g., “N900”) – Ensure setup is as shown in screenshot • Authentication type: Password • Host Name: 192.168.2.15
  • 28. 04.06.2010 © 2010 Nokia 28 Connection Password • Create password – In Mad Developer, click on “Developer Password” • Different pwd than in screenshot! • New pwd generated every time • Do not close the dialog window showing the pwd! – Enter the password in Qt Creator – Click on “Test”
  • 29. 23.08.2010 © 2010 Nokia 29 Deploy to N900 • Execute Hello World on N900 – Select Maemo target – Click on Play
  • 30. 23.08.2010 © 2010 Nokia 30 Faster Execution: SSH Key • Create SSH keys once instead of defining a new password for every connection – Make sure your active connection with the password is working Generate SSH Key … → Generate SSH Key Save both the public and the private key to your computer Deploy the public key to your device, specify the private key on the PC
  • 31. 23.08.2010 © 2010 Nokia 32 Creating .deb for delivery I Want to have an icon in the menu? • Creating project – Create skeleton project through MADDE Terminal: http://wiki.maemo.org/MADDE/Qt_example • In default directory of MADDE Terminal, type: mad pscreate –t qt_simple <prj_name> • Project will be located in: C:NokiaQtSDKMaemo4.6.2home<user><prj_name> – Integrate your project into the skeleton • Go to <prj_name>src-dir of the new project, delete qtmain.cpp and copy your sources and resources to it • Open <prj_name>qtprog.pro in main project dir and integrate your own project’s .pro file • Open <prj_name>data<prj_name>.desktop, change Name=Mad Qt example to your own project name
  • 32. 23.08.2010 © 2010 Nokia 33 Creating .deb for delivery II • Create .deb and deploy – Use MADDE terminal to build and create .deb $ cd <prj_name>/ $ mad qmake $ mad make $ mad dpkg-buildpackage – Connect N900 in mass storage mode to PC, copy .deb to “Nokia N900 disc” / “removable disk” – On device: start file manager, go to “Nokia N900/” and click on the .deb file to initiate installation
  • 33. 23.08.2010 © 2010 Nokia 34 Optification • Storage memory on the N900 – 256 MB NAND memory: Fast, but high power requirements → not so big by design. For bootloader, kernel and root. – 32 GB eMMC: large, but slower. The “Storage Usage” application • /home: ~ 2 GB gives a graphical overview of memory usage • /home/usr/MyDocs: ~ 29 GB and also lists the memory by package • Memory usage rules for applications – Put large files on eMMC memory, not into small rootfs → “Optification” – Required for Ovi Store submission: http://wiki.maemo.org/Ovi_Store_publishing – Documentation: http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Packaging,_Deploying_and_Distributing/Installing_u nder_opt_and_MyDocs
  • 34. 23.08.2010 © 2010 Nokia 35 Faster .deb deployment and Un-Installing • Instead of manually copying .deb, deploy through MADDE – Create device runtime in MAD Terminal: http://wiki.maemo.org/MADDE/Device_runtime – Deploy to N900 through terminal: Step 10 @ http://wiki.maemo.org/MADDE/Packaging • Uninstallation – Through N900 Application Manager – Or Step 11 @ http://wiki.maemo.org/MADDE/Packaging
  • 35. 23.08.2010 36 Qt for Symbian
  • 36. 23.08.2010 © 2010 Nokia 37 Symbian & Qt Nokia N95 (2007) • Qt for Symbian: – Compatible to S60 3.1+ (Nokia N95, E71) – Get your app running on 130 000 000 devices! – Nokia devices platform versions: http://www.forum.nokia.com/devices/ Qt Compatibility Qt Pre-Installed Series 60 Series 60 S60 S60 S60 S60 Symbian^2 Symbian^3 Symbian^4 1.0 2.0 3.0 3.1 3.2 5.0 (+ 3 FPs) = Symbian^1
  • 37. 23.08.2010 © 2010 Nokia 38 Install Qt to the Device < Symbian^3 • .sis-file: Symbian installation file • Qt installation files in your Qt/Symbian SDK dir – C:NokiaQtSDKSymbiansisqt_installer.sis: Installs Qt libraries – C:NokiaQtSDKSymbiansisqt_mobility.sis: Contains additional Qt Mobility APIs – C:NokiaQtSDKSymbiansisfluidlauncher.sis: Installs demos • Installation to mass memory. Choose one method: 1. Send through Bluetooth to device 2. Use Ovi Suite, connect your device and double-click .sis-file 3. Copy .sis-file to device / SD card and start installation through file manager on device • Restart the device
  • 38. 23.08.2010 © 2010 Nokia 39 Automatic Deployment & On-Device Debug • Requires debug agent running on device: App TRK • Install: – C:NokiaQtSDKSymbiansiss60_5_0_app_trk_3_x_x.sisx (for S60 5.0. Choose appropriate TRK for your phone. S^3 requires different TRK* than S60 5.0!) – Install to phone memory (C:) • Run the TRK on the device – Setup connection using Bluetooth or USB cable – Recommended: USB * http://tools.ext.nokia.com/trk/s60_tb_9_2_app_trk_3_2_7.sisx
  • 39. 23.08.2010 © 2010 Nokia 40 TRK: USB Connection • Debugging through USB is faster and easier – Very first start of TRK on device: cancel Bluetooth connection attempt
  • 40. 23.08.2010 © 2010 Nokia 41 Testing the Device Connection Go to the Run Settings tab of the Symbian Device Click on the i symbol to check the active TRK connection Press play to deploy and run
  • 41. 23.08.2010 © 2010 Nokia 42 Hello World on Symbian
  • 42. 23.08.2010 © 2010 Nokia 43 Smart Installer • Distribute Qt apps on Symbian devices – Qt pre-installed Symbian^3 onwards – Solution for pre-Symbian^3: installation / update on demand – Package Smart Installer with your app • More information – http://wiki.forum.nokia.com/index.php/Nokia_Smart_Installer_for_Symbian
  • 43. 23.08.2010 © 2010 Nokia 44 Signing & Certificates Open Signed (Developer Certificate) • Self-Signed application (default): – Security warning during installation – No access to restricted features (e.g., powering off the device) • Reasons for signing: – Prevent sabotage of installation files (.sis) – Identification of the software developer – Access to APIs (Capabilities) for sensitive features (calendar, location, etc.) Self-Signed app installation
  • 44. 23.08.2010 © 2010 Nokia 45 Symbian Distribution • Now free through Ovi Publish program – Sign up: • Publisher ID from TrustCenter http://www.forum.nokia.com/Distribute/Pack – $200 / year, only for companies aging_and_signing.xhtml – Allows creating developer certificate – http://www.trustcenter.de/en/products/tc_publi – Get test certificate for development sher_id_for_symbian.htm (if you require restricted capabilities in • Sign your app through: your app) – Express Signed: instant, €10 – Certified Signed: external test house, €185+ – Thoroughly test your app: – https://www.symbiansigned.com/ http://tiny.symbian.org/testcriteria – Submit finished app to Ovi Store for free • Test your app according to test criteria
  • 45. 23.08.2010 46 Good to Know
  • 46. 04.06.2010 © 2010 Nokia 47 Taking Screenshots • Maemo – Ctrl + Shift + P: Saves to /home/user/MyDocs/.images/Screenshots • Symbian – Download Best Screen Snap for S60 (Freeware) http://www.smartphoneware.com/screen_snap-for-s60-5th-edition-download.php – Set image type to “BMP – true color” for maximum quality
  • 47. 23.08.2010 © 2010 Nokia 48 Working with GIT from Windows • Use bleeding edge code? – Qt developed as open source – You can download latest development source from GIT repositories – Warning: not for beginners! Needs manual compilation. Commercial ARM compiler required for compiling Qt for Symbian. • Install Windows client software – msysgit: http://code.google.com/p/msysgit/ – TortoiseGit: http://code.google.com/p/tortoisegit/
  • 48. 23.08.2010 © 2010 Nokia 49 Downloading from GIT • Search repository you want to download locally (clone) – http://qt.gitorious.org/ – Get repository URL • Clone the repository – In Windows Explorer, go to parent of target directory (e.g., C:Qt) – Right-click → Git Clone…
  • 49. 23.08.2010 © 2010 Nokia 50 Downloading from GIT • Configure download – Enter repository URL – Make sure your firewall / proxy doesn’t block download
  • 50. 23.08.2010 51 Troubleshooting
  • 51. 23.08.2010 © 2010 Nokia 52 Troubleshooting: Qt Not Found Platform: Windows • Situation – Full Qt for Windows SDK is installed, created a Qt Creator project • Problem – Error when compiling, similar to: No valid Qt version set. Set one in Tools/Options Error while building project GuiTest When executing build step 'QMake' Canceled build. • Solution – Go to Tools → Options → Qt4. Click on the “+” button to define a manual Qt version. Set the QMake and MinGW location to your SDK dirs (see screenshot on next slide)
  • 52. 23.08.2010 © 2010 Nokia 53 Troubleshooting: Qt Not Found Platform: Windows Solution: Add Qt manually
  • 53. 23.08.2010 © 2010 Nokia 54 Troubleshooting: Network Drives Platform: Windows • Situation – Created / opened a project on a network drive on Windows • Problem – Error when compiling, similar to: Error processing project file: //fshome/.../TestProject.pro Exited with code 3. Error while building project TestProject When executing build step 'QMake' • Solution – Create your project on a local drive, not a network drive. If a network drive is required, make sure it is accessed through a drive letter instead of the //…/-path
  • 54. 23.08.2010 © 2010 Nokia 55 Troubleshooting: vtable references Platform: Generic • Situation – Added metaobject functionality to existing plain C++ class (signals / slots, added derivation from QObject, added Q_OBJECT macro) • Problem – Error when compiling, similar to: debug/myclass.o: In function `MyClass': C:QtworkspaceFoo/myclass.cpp:3: undefined reference to `vtable for MyClass' C:QtworkspaceFoo/myclass.cpp:3: undefined reference to `vtable for MyClass' collect2: ld returned 1 exit status mingw32-make[1]: *** [debugFoo.exe] Error 1 mingw32-make: *** [debug] Error 2 Exited with code 2. – Build → Clean All doesn’t help
  • 55. 23.08.2010 © 2010 Nokia 56 Troubleshooting: vtable references II Platform: Generic • Solution – Qt Creator doesn’t necessarily recognize changes, as your class now needs to be processed using the meta object compiler (moc) during the compilation process. – Simple solution: Directly delete makefiles from explorer / terminal and compile again. This ensures that all makefiles are re-generated.
  • 56. 23.08.2010 © 2010 Nokia 57 Troubleshooting: Widgets Not Declared Platform: Generic • Situation – Created a console application – Added GUI elements • Problem – Error when compiling, similar to: main.cpp:9: error: 'QPushButton' was not declared in this scope • Solution – Remove the following lines from the .pro-file: QT -= gui CONFIG += console
  • 57. 23.08.2010 © 2010 Nokia 58 Troubleshooting: Qt DLLs Platform: Windows • Situation – Successfully compiled application, execution through Qt Creator works. • Problem – When executing .exe-file directly through Windows Explorer: error message – DLL files not found. – Common: mingwm10.dll, qtcore4.dll, qtgui4.dll, qtcored4.dll, qtguid4.dll
  • 58. 23.08.2010 © 2010 Nokia 59 Troubleshooting: Qt DLLs II Platform: Windows • Solution – Search for location of DLL files on PC, add directories to system environment variables. – -Key + Pause → Advanced system settings → Advanced → Environment Variables… Add at the end of Path variable in user or system variables. – Commonly needed: C:NokiaQtSDKmingwbin; C:Qt2010.02qtbin – Not allowed to modify PATH? Copy required DLLs to executable directory. – More information: http://doc.qt.nokia.com/deployment- windows.html
  • 59. 23.08.2010 © 2010 Nokia 60 Troubleshooting: DLL Entry Point Platform: Windows • Situation – Successfully compiled application, executing .exe through Windows Explorer • Problem – Error message like: The procedure entry point ?end@QListData@@QBEPAPAXXZ could not be located in the dynamic link library QtCore4.dll • Solution – Wrong version of dynamically linked Qt Dll was found and is used by Windows. – Modify PATH environment variable, move Qt directories to the front of System Variables. Or: copy DLLs to executable directory.
  • 60. 23.08.2010 © 2010 Nokia 61 .sis Installation Fails Platform: Symbian • Situation – Successfully compiled application for a Symbian device • Problem – Installation fails with an error message like: Deploying application to 'Nokia N97 mini USB (COM9)'... Copying installation file... Installing application... Could not install from package C:xxx.sis on device: General OS-related error Finished. • Solution – Install the .sis-file manually through the Nokia Ovi Suite or by simply sending the .sis-file to the phone using Bluetooth or an USB connection. You will then see the full error message on the device. For example, you might have an old Qt version installed on your phone.
  • 61. 23.08.2010 © 2010 Nokia 62 .sis Installation Fails II Platform: Symbian • Common issues – Certificate validity: are both PC and device date & time correct? – Changed certificate type or UID: uninstall old app version from device before installing new version – Correct certificate: only “User Capabilities” can be used with self-signed certificate created by default from Qt Creator. For other capability groups, you need a developer certificate – get this for free through Publish to Ovi. http://developer.symbian.org/wiki/index.php/Capabilities_%28Symbian_Signed%29 – Checklist: http://developer.symbian.org/wiki/index.php/Troubleshoot_install_errors • Getting more details – Install ErrRd utility to the phone: http://www.symbianresources.com/cgi-bin/schlabo/dl.pl?ErrRd – You will get error code during installation. Overview of codes: http://blogs.forum.nokia.com/blog/lucian-tomutas-forum-nokia-blog/2009/09/29/the-ultimate- software-installer-debug-guide
  • 62. 23.08.2010 © 2010 Nokia 63 Troubleshooting: .sis vs .sisx? Platform: Symbian • What’s the difference? – No difference to Symbian device, it’s just the filename. – Common: .sisx = signed version of unsigned .sis. But: – Nokia Qt SDK: .sis is already signed, no .sisx is created! • When not specifying own certificate: .sis is self-signed with automatically generated certificate • Installation of self-signed apps not allowed by default on some operator branded devices – Change: Application manager  Installation settings  Software installation  change from “Signed only” to “All”
  • 63. Thank You. Want to learn more? www.forum.nokia.com/Qt