logo资料库

QML学习教程——qt5_cadaques.pdf

第1页 / 共193页
第2页 / 共193页
第3页 / 共193页
第4页 / 共193页
第5页 / 共193页
第6页 / 共193页
第7页 / 共193页
第8页 / 共193页
资料共193页,剩余部分请下载后查看
Content
Meet Qt 5
Get Started
Qt Creator IDE
Quick Starter
Fluid Elements
Model-View-Delegate
Canvas Element
Particle Simulations
Shader Effects
Multimedia
Networking
Chapter Queue
Index
Qt5 Cadaques Release 2014-01 JRyannel,JThelin January 20, 2014 at 18:00 CET
CONTENTS . 3 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Content . . . . . . . . . . . . 1.1 Meet Qt 5 . . . 1.2 Get Started . . . 1.3 Qt Creator IDE . . 1.4 Quick Starter . . 1.5 . Fluid Elements . 1.6 Model-View-Delegate . . Canvas Element 1.7 . . Particle Simulations 1.8 . . 1.9 Shader Effects . . 1.10 Multimedia . 1.11 Networking . . . . . . . . . . . . . . . . . . . . . . . . 2 Chapter Queue Index 187 189 i
ii
Qt5 Cadaques, Release 2014-01 Last Build: January 20, 2014 at 18:00 CET Welcome The entire collection of chapters covering Qt5 programming, written by Juergen Bocklage-Ryannel and Johan Thelin, is available here. All book content is licensed under the Creative Commons Attribution Non Commercial Share Alike 4.0 license and examples are licensed under the BSD license. About this book. Welcome to the online book of Qt5 Cadaques! Why Qt5? Because Qt5 is awesome! Why cadaques? Because one of the authors had a great holiday in this rocky coast line in the north-east of spain. We are heavily working on this book and that means several things: 1. It’s not done. We will be releasing new chapters from time to time and updating existing chapters on the go. 2. We love your support. If you find any errors or have suggestions, please use our feedback system 3. Be patient. We are working in our spare time on the book and we depend on the support of our links). It will create a new ticket-entry in our ticket system and (the help us to keep track. companies and family. Download this book in PDF, or ePub form for free. Enjoy! CONTENTS 1
Qt5 Cadaques, Release 2014-01 2 CONTENTS
CHAPTER ONE CONTENT 1.1 Meet Qt 5 Section author: jryannel Note: The source code of this chapter can be found in the assets folder. This book shall provide you a walk through the different aspect of application development using Qt version 5.x. It focuses on the new Qt Quick technology but also provides necessary information of writing C++ back-ends and extension for Qt Quick. This chapter provides an high level overview of Qt 5. It shows the different application models available for developers and a Qt 5 showcase application to get a sneak preview of things to come. Additionally the chapter aims to provide a wide overview of the Qt 5 content and how to get in touch with the makers of Qt 5. 1.1.1 Preface History Qt 4 has evolved since 2005 and provided a solid ground for thousands of applications and even full desktop and mobile systems. The usage patterns computer users changed in the recent years. From stationary PCs towards portable notebook and nowadays mobile computers. The classical desktop is more and more replaced with mobile touch-based always connected screens. With it the desktop UX paradigms also changes. Where as in the past Windows UI has dominated the world we spend more time nowadays on other screens with another UI language. Qt 4 was designed to satisfy the desktop world to have a coherent set of UI widgets available on all major platforms. The challenge for Qt users has changed today and it lies more to provide a touch-based user interface for a customer driven user interface and to enable modern user interface on all major desktop and mobile systems. Qt 4.7 started to introduce the QtQuick technology which allows users to create a set of user interface components from simple elements to achieve a complete new UI, driven by customer demands. Qt5 Focus Qt 5 is a complete refreshment of the very successful Qt 4 release. With Qt 4.8, the Qt 4 release is almost 7 years old. It’s time to make an amazing toolkit even more amazing. Qt 5 is focused on the the following: • Outstanding Graphics: Qt Quick 2 is based on OpenGL (ES) using a scene graph implementation. The recomposed graphics stack allows a new level of graphic effects combined with an ease of use never seen before in this field. • Developer Productivity: QML and JavaScript are the primary means for UI creation. The back-end will be driven by C++. The split between JavaScript and C++ allows a fast iteration for front-end developers concentrating on creating beautiful user interfaces and back-end C++ developers concentrating on stability, performance and extending the runtime. 3
Qt5 Cadaques, Release 2014-01 • Cross-platform portability: With the consolidated Qt Platform Abstraction, it is now possible to port Qt to a wider range of platforms easier and faster. Qt 5 is structured around the concept of Qt Essentials and Add-ons, which allows OS developer to focus on the essentials modules and leads to a smaller runtime altogether. • Open Development: Qt is now a truly open-governance project hosted at Qt-Project. The development is open and community driven. 1.1.2 Qt5 Introduction Qt Quick Qt Quick is the umbrella term for the user interface technology used in Qt5. Qt Quick itself is a collection of several technologies: • QML - Markup language for user interfaces • JavaScript - The dynamic scripting language • Qt C++ - The highly portable enhanced c++ library Similar to HTML, QML is a markup language. It is composed of tags called elements in QtQuick enclosed in curly brackets Item {}. It was designed from the ground up for the creation of user interfaces, speed and easier reading for developers. The user interface can be enhanced using JavaScript code. Qt Quick is easily extend able with your own native functionality using Qt C++. In short the declarative UI is called the front-end and the native parts are called the back-end. This allows you to separate the computing intensive and native operation of your application from the user interface part. In a typical project the front-end is developed in QML/JavaScript and the back-end code, which interfaces with the system and does the heavy lifting is developed using Qt C++. This allows a natural split between the more design oriented developers and the functional developers. Typically the back-end is tested using Qt own unit testing framework and exported for the front-end developers to be used. Digesting an User Interface Let’s create a simple user interface using QtQuick, which showcases some aspects of the QML language. At the end we will have a paper windmill with rotating blades. 4 Chapter 1. Content
分享到:
收藏