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
About the Author
About the Reviewer

2D canvas in QML

In all the previous examples of this chapter, we have discussed the methods and techniques used to render 2D graphics with Qt's C++ API. However, we have yet to learn how to achieve similar results using the powerful QML script.

How to do it…

In this project, we'll be do something quite different:

  1. As usual, the first step we should do is to create a new project by going to File | New File or Project and selecting Qt Quick Application as the project template.

  2. Once you are done creating the new project, open up qml.qrc from the Resource folder in the project pane by right-clicking on it and selecting Open in Editor. Then, remove MainForm.ui.qml from your project's resources, as we don't need it for this project:

  3. Next, open up main.qml, which is listed under qml.rc in the project pane. After that, remove the entire section that references MainForm. Now what is left is only the Window object in main.qml. After that, set an ID for the window and adjust its width and height to higher...