Book Image

Qt5 C++ GUI Programming Cookbook

By : Lee Zhi Eng
Book Image

Qt5 C++ GUI Programming Cookbook

By: Lee Zhi Eng

Overview of this book

With the advancement of computer technology, the software market is exploding with tons of software choices for the user, making their expectations higher in terms of functionality and the look and feel of the application. Therefore, improving the visual quality of your application is vital in order to overcome the market competition and stand out from the crowd. This book will teach you how to develop functional and appealing software using Qt5 through multiple projects that are interesting and fun. This book covers a variety of topics such as look-and-feel customization, GUI animation, graphics rendering, implementing Google Maps, and more. You will learn tons of useful information, and enjoy the process of working on the creative projects provided in this book
Table of Contents (16 chapters)
Qt5 C++ GUI Programming Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

3D canvas in QML


In this recipe, we will learn how to render 3D images using Qt's powerful QML scripting language.

How to do it…

  1. Let's start this example by creating a new project in Qt Creator. This time around, we will create Qt Canvas 3D Application and not the other options that we chose in all previous examples:

  2. After that, Qt Creator will ask you whether to create a project that is based on three.js. Leave the option checked and press the Next button to proceed:

  3. Once the project is created, you will notice there are some JavaScript (.js) files already added to your project's resources. This is normal as the Qt Canvas 3D application uses JavaScript and WebGL technology to render 3D images on screen. In this case, it's running a WebGL-based rendering library called three.js, which makes our programming job simpler and easier compare to writing pure WebGL code:

  4. Next, add an image file to our project resources as we'll be using it in this example. Open up qml.qrc with Qt Creator by right-clicking...