30
Development of Cross Platform Apps using Qyoto and Qt Jeff Alstadt

Building Cross-Platform Apps using Qt and Qyoto

Embed Size (px)

DESCRIPTION

Building Cross-Platform Apps using Qt and Qyoto

Citation preview

Page 1: Building Cross-Platform Apps using Qt and Qyoto

Development of Cross Platform Apps using Qyoto and Qt

Jeff Alstadt

Page 2: Building Cross-Platform Apps using Qt and Qyoto

ABOUT CENTARE

fast. forward. thinking.

At Centare, every team member:Thinks strategicallySolves complex problemsCreates scalable solutionsIs passionate about what we do

Page 3: Building Cross-Platform Apps using Qt and Qyoto

OF NOTEAgile / ALM / Mobile / CloudMicrosoft

2011 Partner of the Year FinalistALM Gold CompetencyAzure Circle

Apple / Android / Windows PhoneiOS, Java, C#, Silverlight/XAML Scrum.org PartnerCertified Professional Scrum Trainers

Page 4: Building Cross-Platform Apps using Qt and Qyoto

Good Morning

Page 5: Building Cross-Platform Apps using Qt and Qyoto

AGENDA Why Qt and why Qyoto

GETTING STARTED WITH Qt and Qyoto

Page 6: Building Cross-Platform Apps using Qt and Qyoto

BUT ISNT QT DEAD?

Quite the opposite, it is living strong. Qt is being used by 450,000 developers in 70 industriesQt increases productivity by 70% with reduced development costs of 75%These guys are using Qt:

Page 7: Building Cross-Platform Apps using Qt and Qyoto

What is Qt?How is Qt Cross-Platform?How do Qyoto and Qt work together?How can I use Qyoto in my apps?

WHAT IS QT

Page 8: Building Cross-Platform Apps using Qt and Qyoto

WHAT IS QT?

Qt is a cross-platform UI framework that was developed by Trolltech, later acquired by Nokia for creating UIs that can run on the Mac, Linux and Windows platformQt utilizes a moc compiler known as the Meta Object Compiler with several macros to provide the Qt specifics of the Qt language

Page 9: Building Cross-Platform Apps using Qt and Qyoto

THE FOUNDERS OF QT

Haavard Nord and Eirik Chambe-Eng founded Qt with its initial development in 1991.The toolkit was called Qt becuase the letter Q looked appealing in Haavard‘s Emacs font and “t“ was inspired by Xt, the X toolkit

Page 10: Building Cross-Platform Apps using Qt and Qyoto

GETTING STARTED WITH QT CREATOR

Qt Creator is the cross-platform developer IDEIt has a C++ compiler support built in, Qt centric UI designer tools, and solid debugger. Works on all three platforms including Mac, Linux and Windows

Page 11: Building Cross-Platform Apps using Qt and Qyoto

WHAT IS QYOTO?

Qyoto is a C# language binding for Qt. It is not officially supported by Nokia or DigiaIt is an open source community driven project with a lot of the work coming from KDE contributorsThe top contributors of Kyoto are Arno Rehn, Ian Moore, and Dimitri Dobrev

Page 12: Building Cross-Platform Apps using Qt and Qyoto

CONCEPTS OF QT DESIGN

Signals and SlotsQt Property SystemQt Event SystemUsing Model View in Qt

Page 13: Building Cross-Platform Apps using Qt and Qyoto

SIGNALS AND SLOTSA MEANS TO COMMUNICATE DATA

SignalCreates the construct to

Specific concept in Qt every Qt developer needs to knowType safeDecoupledObjects inherited from QObject will only receive the signal notifcationsconnect connects the object signal to the respective slot

Page 14: Building Cross-Platform Apps using Qt and Qyoto

SHOW ME THE CODE:

Page 15: Building Cross-Platform Apps using Qt and Qyoto

SHOW ME THE C# CODE[Q_OBJECT]public class Counter{

public Counter(){}private int m_value;

[Q_SLOT]public void setValue(int value){ if ( m_value != value) { m_value = value; emit valueChanged(value); }}

}

Page 16: Building Cross-Platform Apps using Qt and Qyoto

QT PROPERTY SYSTEMThe Qt system provides a means to set any property in the Qt Meta-Object System

The Qt solution works with any standard C++ compiler Qt supports

Q_PROPERTY is a macro that is used to declare property

This declaration must be done inside a QObject

Page 17: Building Cross-Platform Apps using Qt and Qyoto

QT EVENT SYSTEM

An event is an object or a set of objects derived from the abstract class QEventEvents represent things that have happened either within an application or as a result of outside activity that the application needs to know aboutEvents are recieved and handled by instance of a derived QObject class

Page 18: Building Cross-Platform Apps using Qt and Qyoto

LIST OF COMMON EVENT TYPES

QResizeEvent (Window Resizing)QPaintEvent (Window Repainting)QMouseEvent (Mouse Input)QKeyEvent (Keyboard Input)QCloseEvent (Window close)

Page 19: Building Cross-Platform Apps using Qt and Qyoto

SENDING EVENTSIn Qt, we can utilize the QCoreApplication to create and send our own custom events.To do this, we utilize sendEvent() and postEvent().

sendEvent() processes the event immediatly. postEvent() posts the event on queue for later dispatch When Qt‘s main event loop runs, it will then dispatch all posted events.

To create a custom Qt Event type, simpily subclass your event from QEvent and ensure it has an event number that is greater than QEvent::User (1000 presently in 4.8)For all events, check here

Page 20: Building Cross-Platform Apps using Qt and Qyoto

USING MODEL VIEW IN QT

Qt has an advanced Model View archictecture concept that was inspired from the MVC approachInstead Qt utilizes a delegate instead of a controllerThe delegate is used to provide a fine control over how items are rendered and editedFor Qt specific views, Qt provides the appropriate delegate for that view

Page 21: Building Cross-Platform Apps using Qt and Qyoto

COMMON PREDEFINED QT MODELS

QStringListModelQStandardItemModelQDirModelQSqlQueryModelQSqlTableModelQSqlRelationalTableModelQSortFilterProxyModel

Page 22: Building Cross-Platform Apps using Qt and Qyoto

GREAT HOW DO I GET A ROCKIN‘ WITH QYOTO

To set up Qyoto you will need a fresh Linux install of your favorite Linux distro (I chose Ubuntu)Next you will need to download and install the Qt SDK, Mono, MonoDevelop, Gtk2.0, QScintella 2.0, Phonon lib, smoke genMy blog has more details how to set up your box.

Page 23: Building Cross-Platform Apps using Qt and Qyoto

QYOTO DEMO

Overview of using mono develop with qyotoWill be shown on Linux

Page 24: Building Cross-Platform Apps using Qt and Qyoto

QT IN MOBILE

Qt on AndroidQt on iOS

Page 25: Building Cross-Platform Apps using Qt and Qyoto

QT ON ANDROID

The Necessitas project is a community driven lighthouse based port of Qt to AndroidIt has a plugin for Qt Creator to do Android developmentAn installer application for Android called Ministro exists

Ministro is responsible for downloading the Qt libraries specific to that Android device

Page 26: Building Cross-Platform Apps using Qt and Qyoto

QT ON IOS

The Qt Lighthouse project was an initiative to get Qt running on the iOS platforms.It has had success, and is being integrated with Qt 5.0

Page 27: Building Cross-Platform Apps using Qt and Qyoto

ONWARD TO QT 5

Qt 5 brings on a lot of new changes.QML plays a bigger role in UI designJavaScript will be heavily used over C++

Its objectives areMake better use of the GPU, allowing you to create smooth (and accelerated) graphics performance even with limited resourcesMaking your creation of advanced applications and UIs easier and faster (with QML and Javascript)Make apps connected to the web be as powerful as possible, i.e. to embed and power up web content and services into any Qt appReduce the complexity and amount of code required to maintain and implement a port

Page 28: Building Cross-Platform Apps using Qt and Qyoto

VISION FOR QT 5

“Qt 5 should be the foundation for a new way of developing applications. While offering all of the power of native Qt using C++, the focus should shift to a model, where C++ is mainly used to implement modular backend functionality for Qt Quick” – Lars Knoll, Qt Project

Page 29: Building Cross-Platform Apps using Qt and Qyoto

QT 5 ARCHITECTURE CHANGESRearchitecture of the graphics stack

QtQuick and QML Scenegraph will be the center of the new graphics architectureQPainter will still be availableQt 5 will require OpenGL 2.0Qwidgets will be layered on top of the scene graph

Qt ports will be based on LighthouseLighthouse provides a better windows abstract system

Modular repository structureSpeeds up the integration process of contributions to the Qt framework

Seperation of all QWidget related functionality into its own libraryQML will be the UI defacto, where QWidget will be there to support older Qt apps

Page 30: Building Cross-Platform Apps using Qt and Qyoto

YOUR NAMEYOUR TITLESECOND TITLE LINE, IF NEEDED

SITE: www.centare.comomEMAIL: [email protected]: @myhandleBLOG: www.ifyouhaveone.comLINKEDIN: /yourhandle