ebook img

Qt5 C++ GUI Programming Cookbook PDF

301 Pages·2016·5.808 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Qt5 C++ GUI Programming Cookbook

www.it-ebooks.info Qt5 C++ GUI Programming Cookbook Use Qt5 to design and build a graphical user interface that is functional, appealing, and user-friendly for your software application Lee Zhi Eng BIRMINGHAM - MUMBAI www.it-ebooks.info Qt5 C++ GUI Programming Cookbook Copyright © 2016 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: July 2016 Production reference: 1220716 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78328-027-8 www.packtpub.com www.it-ebooks.info Credits Author Copy Editor Lee Zhi Eng Safis Editing Reviewer Project Coordinator Symeon Huang Izzat Contractor Commissioning Editor Proofreader Kartikey Pandey Safis Editing Acquisition Editor Indexer Indrajit Das Rekha Nair Content Development Editor Production Coordinator Priyanka Mehta Aparna Bhagat Technical Editors Cover Work Dhiraj Chandanshive Aparna Bhagat Ravikiran Pise www.it-ebooks.info About the Author Lee Zhi Eng is a 3D artist-turned-programmer who worked in the video game industry as a game artist, game programmer, and a game programming lecturer. Later, he decided to take a break from games and ventured into software engineering by co-founding his current company, Reonyx Tech. Since then, he has been involved in multiple projects that are different from what he used to do, including geolocation and near-real-time navigation systems, Big Data analytics, and augmented reality. You can find out more about him at http://www. zhieng.com, or you can find out about his company at http://www.reonyx.com. www.it-ebooks.info About the Reviewer Symeon Huang is an experienced C++ GUI software developer and the author of Qt 5 Blueprints, Packt Publishing. He has finished his master's degree in high performance computing and has been working as a software engineer in industry. I'd like to thank Packt Publishing for giving me the opportunity to review this book. As a reviewer, I've also learnt from this book and I'm sure this book will be of great use to all readers. www.it-ebooks.info www.PacktPub.com eBooks, discount offers, and more Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM https://www2.packtpub.com/books/subscription/packtlib Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books. Why Subscribe? f Fully searchable across every book published by Packt f Copy and paste, print, and bookmark content f On demand and accessible via a web browser www.it-ebooks.info Table of Contents Preface v Chapter 1: Look and Feel Customization 1 Introduction 1 Use style sheets with Qt Designer 2 Basic style sheet customization 6 Creating a login screen using style sheets 11 Using resources in style sheets 19 Customizing properties and sub-controls 23 Styling in QML 27 Exposing QML object pointer to C++ 36 Chapter 2: States and Animations 39 Introduction 39 Property animation in Qt 39 Using easing curves to control property animation 42 Creating an animation group 44 Creating a nested animation group 47 State machines in Qt 50 States, transitions, and animations in QML 53 Animating widget properties using animators 57 Sprite animation 59 Chapter 3: QPainter and 2D Graphics 65 Introduction 65 Drawing basic shapes on screen 66 Exporting shapes to SVG files 69 Coordinate transformation 75 Displaying images on screen 80 i www.it-ebooks.info Table of Contents Applying image effects to graphics 85 Creating a basic paint program 88 2D canvas in QML 94 Chapter 4: OpenGL Implementation 99 Introduction 99 Setting up OpenGL in Qt 100 Hello world! 103 Rendering 2D shapes 106 Render 3D shapes 109 Texturing in OpenGL 114 Lighting and texture filter in OpenGL 118 Moving an object using keyboard controls 122 3D canvas in QML 125 Chapter 5: Building a Touch Screen Application with Qt5 131 Introduction 131 Setting up Qt for mobile applications 132 Designing a basic user interface with QML 138 Touch events 142 Animation in QML 149 Displaying information using Model View 155 Integrating QML and C++ 160 Chapter 6: XML Parsing Made Easy 167 Introduction 167 Processing XML data using stream reader 167 Writing XML data using Stream Writer 173 Processing XML data using the QDomDocument class 176 Writing XML data using the QDomDocument class 179 Using Google's Geocoding API 182 Chapter 7: Conversion Library 187 Introduction 187 Data conversion 187 Image conversion 192 Video conversion 196 Currency conversion 202 ii www.it-ebooks.info Table of Contents Chapter 8: Accessing Databases 207 Introduction 207 Connecting to a database 213 Writing basic SQL queries 216 Creating a login screen with Qt 221 Displaying information from a database on a model view 227 Advanced SQL queries 233 Chapter 9: Developing a Web Application Using Qt Web Engine 245 Introduction 245 Introduction to Qt WebEngine 246 WebView and web settings 252 Embedding Google Maps in your project 259 Calling C++ functions from JavaScript 264 Calling JavaScript functions from C++ 271 Index 279 iii www.it-ebooks.info

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.