Application Development with Qt Creator Second Edition
Table of Contents
Application Development with Qt Creator Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with Qt Creator
Downloading Qt and Qt Creator
Finding your way around Qt Creator
Your first application – Hello World
Hello World using the QtGui library
Hello World using Qt Quick
Summary
2. Building Applications with Qt Creator
Getting started – our sample library
Learning the landscape – the Build menu and the .pro files
Linking against our sample library
Getting lost and found again – debugging
Setting breakpoints and stepping through your program
Examining variables and memory
Examining the call stack
The Projects pane and building your project
A review – running and debugging your application
Summary
3. Designing Your Application with Qt Designer
Code interlude – signals and slots
Creating forms in Qt Designer
Creating the main form
Using application resources
Instantiating forms, message boxes, and dialogs in your application
Wiring the Qt Widgets' application logic
Learning more about Qt Widgets
Code interlude – Qt Quick and the QML syntax
Creating Qt Quick applications in Qt Designer
Creating a reusable button
The calculator's main view
Learning more about Qt Quick and QML
Summary
4. Qt Foundations
Representing data using Qt's core classes
Working with key-value pairs
Multithreading in Qt
Accessing files using Qt
Accessing HTTP resources using Qt
Performing HTTP requests
Parsing XML using Qt
Using XML parsing with HTTP
Implementing WorkerThread
Summary
5. Developing Applications with Qt Widgets
Your main application and its menus
Simple Qt Widgets
Managing the widget layout with layouts
Model-view-controller programming with Qt
Analyzing a concrete model subclass
Rendering web content with QWebView
Summary
6. Drawing with Qt
What we need to start drawing with Qt
Drawing with QPainter on QPaintDevice instances
Drawing off screen
Creating custom widgets
The Graphics View Framework
Summary
7. Doing More with Qt Quick
The fundamental concepts of Qt Quick
States and transitions in Qt Quick
Integrating Qt Quick and C++
Putting it all together – an image gallery application
Summary
8. Multimedia and Qt Quick
Multimedia in Qt
Playing audio clips and sound effects
Playing video clips
Accessing the camera
Summary
9. Sensors and Qt Quick
Sensors in Qt
Determining the device location
Obtaining a device's position – a simple example
Summary
10. Localizing Your Application with Qt Linguist
Understanding the task of localization
Marking strings for localization
Localizing your application with QLinguist
Including localized strings in your application
Localizing special parameters – currencies and dates with QLocale
Summary
11. Optimizing Performance with Qt Creator
The QML performance analyzer
QtSlowButton – a Qt Quick application in need of performance tuning
Finding memory leaks with Valgrind
QtLeakyButton – a Qt C++ application in need of memory help
Summary
12. Developing Mobile Applications with Qt Creator
A mobile software development primer
User attention is at a premium
Computational resources are at a premium
Network resources are at a premium
Storage resources are at a premium
To port or not to port?
A word on testing
Setting up Qt Creator for Android
Downloading all the pieces
Setting environment variables
Finishing the Android SDK installation
Configuring Qt Creator
Building and running your application
Supporting other mobile platforms
Summary
13. Qt Tips and Tricks
Writing console applications with Qt Creator
Integrating Qt Creator with version control systems
Configuring the coding style and coding format options
Building projects from the command line
Setting the Qt Quick window display options
Learning more about Qt
Debugging Qt's signal-slot connections
Summary
Index
Application Development with Qt Creator Second Edition
Copyright © 2014 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: November 2013
Second edition: November 2014
Production reference: 1221114
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78439-867-5
www.packtpub.com
Author
Ray Rischpater
Reviewers
Lee Zhi Eng
Andrea Flesca
Niels Holst
Sudhendu Kumar
Commissioning Editor
Usha Iyer
Acquisition Editor
Llewellyn Rozario
Content Development Editor
Ritika Singh
Technical Editors
Venu Manthena
Edwin Moses
Copy Editors
Dipti Kapadia
Deepa Nambiar
Project Coordinator
Aboli Ambardekar
Proofreaders
Ting Baker
Simran Bhogal
Paul Hindle
Steve Maguire
Indexers
Monica Ajmera Mehta
Rekha Nair
Graphics
Abhinash Sahu
Production Coordinators
Pooja Chiplunkar
Alwin Roy
Cover Work
Alwin Roy
Ray Rischpater is an engineer and author, with over 20 years of experience in writing about mobile computing platforms and developing for them.
During this time, he has participated in the development of Internet technologies and custom applications for Java ME, Qualcomm Brew™, Apple iPhone, Google Android, Palm OS, Newton, and Magic Cap, as well as several proprietary platforms. Presently, he's employed as a Senior Engineer at Microsoft in Mountain View, and he works on mapping and data visualization.
When he is not writing for software development or about it, he enjoys hiking and photography with his family and friends in and around the San Lorenzo Valley in Central California. Whenever he's able to, he provides a public service through amateur radio as the licensed Amateur Extra station KF6GPE.
Among ...