Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Hands-On GUI Programming with C++ and Qt5
Hands-On GUI Programming with C++ and Qt5

Hands-On GUI Programming with C++ and Qt5: Build stunning cross-platform applications and widgets with the most powerful GUI framework

eBook
₹799.99 ₹2919.99
Paperback
₹3649.99
Subscription
Free Trial
Renews at ₹800p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Hands-On GUI Programming with C++ and Qt5

Qt Widgets and Style Sheets

One of the advantages of using Qt for software development is that it's very easy to design a program's graphical user interface (GUI ) using the tools provided by Qt. Throughout this book, we will try and create a single project that involves many different components and modules of Qt. We will go through each section of the project in each chapter, so that you will eventually be able to grasp the entire Qt Framework and at the same time complete demo projects, which is a really valuable item to add to your portfolio. You can find all the source code at https://github.com/PacktPublishing/Hands-On-GUI-Programming-with-C-QT5.

In this chapter, we will cover the following topics:

  • Introduction to Qt Designer
  • Basic Qt widgets
  • Qt Style Sheets

In this chapter, we will take a deep look into what Qt can offer us when it comes to designing sleek-looking...

Introduction to Qt Designer

There are two types of GUI applications in Qt, namely Qt Quick Application and Qt Widgets Application. In this book, we will cover mostly the latter, as it is the standard way of designing a GUI for desktop applications, and Qt Quick is more widely used for mobile and embedded systems:

  1. The first thing we need to do is to open up Qt Creator and create a new project. You can do so by either going to File | New File or Project, or by clicking the New Project button located at the welcome screen:
  1. After that, a new window will pop up and ask you to pick the type of project you want to create. Choose Qt Widgets Application under the Application category and click Choose..., Then, create a name for your project (I have chosen Chapter2 for mine) and select the project directory by clicking the Browse... button:
  1. Next, you will be asked to select a kit...

Basic Qt widgets

Now, we will take a look at the default set of widgets available in Qt Designer. You can actually create custom widgets by yourself, but that's an advanced topic which is out of the scope of this book. Let's take a look at the first two categories listed on the widget box—Layouts and Spacers:

Layouts and Spacers are not really something that you can directly observe, but they can affect the positions and orientations of your widgets:

  1. Vertical Layout: A vertical layout widget lays out widgets in a vertical column, from top to bottom.
  2. Horizontal Layout: A horizontal layout widget lays out widgets in a horizontal row, from left to right (or right to left for right-to-left languages).
  1. Grid Layout: A grid layout widget lays out widgets in a two-dimensional grid. Each widget can occupy more than one cell.
  2. Form Layout: A form layout widget lays out...

Qt Style Sheets

Qt's Widgets Application uses a styling system called Qt Style Sheets, which is similar to the web technology's styling system—CSS (Cascading Style Sheet). All you need to do is write the style description of the widget and Qt will render it accordingly. The syntax of Qt Style Sheets is pretty much the same as CSS.

Qt Style Sheets has been inspired by CSS and thus they are both very similar to each other:

  • Qt Style Sheets:
QLineEdit { color: blue; background-color: black; } 
  • CSS:
h1 { color: blue; background-color: black; } 

In the preceding example, both Qt Style Sheet and CSS contain a declaration block and a selector. Each declaration consists of a property and value, which are separated by a colon.

You can change a widget's style sheet by using two methods—using C++ code directly or by using the properties editor. If you&apos...

Summary

Qt Designer really revolutionized the way we design program GUIs. Not only does it include all the common widgets but it also has handy stuff like the layout and spacer, which makes our program run perfectly fine on different types of monitors and screen sizes. Also, notice that we have successfully created a working application with a beautiful user interface without writing a single line of C++ code!

What we've learned in this chapter merely scratches the surface of Qt, as there are many more features that we are yet to cover! Join us in the next chapter to learn how we can make our program truly functional!

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • • Explore Qt 5’s powerful features to easily design your GUI application
  • • Leverage Qt 5 to build attractive cross-platform applications
  • • Work with Qt modules for multimedia, networking, and location, to customize your Qt applications

Description

Qt 5, the latest version of Qt, enables you to develop applications with complex user interfaces for multiple targets. It provides you with faster and smarter ways to create modern UIs and applications for multiple platforms. This book will teach you to design and build graphical user interfaces that are functional, appealing, and user-friendly. In the initial part of the book, you will learn what Qt 5 is and what you can do with it. You will explore the Qt Designer, discover the different types of widgets generally used in Qt 5, and then connect your application to the database to perform dynamic operations. Next, you will be introduced to Qt 5 chart which allows you to easily render different types of graphs and charts and incorporate List View Widgets in your application. You will also work with various Qt modules, like QtLocation, QtWebEngine, and the networking module through the course of the book. Finally, we will focus on cross-platform development with QT 5 that enables you to code once and run it everywhere, including mobile platforms. By the end of this book, you will have successfully learned about high-end GUI applications and will be capable of building many more powerful, cross-platform applications.

Who is this book for?

This book will appeal to developers and programmers who would like to build GUI-based applications. Basic knowledge of C++ is necessary and the basics of Qt would be helpful.

What you will learn

  • • Implement tools provided by Qt 5 to design a beautiful GUI
  • • Understand different types of graphs and charts supported by Qt 5
  • • Create a web browser using the Qt 5 WebEngine module and web view widget
  • • Connect to the MySQL database and display data obtained from it onto the Qt 5 GUI
  • • Incorporate the Qt 5 multimedia and networking module in your application
  • • Develop Google Map-like applications using Qt 5's location module
  • • Discover cross-platform development by exporting the Qt 5 application to different platforms
  • • Uncover the secrets behind debugging Qt 5 and C++ applications

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 27, 2018
Length: 404 pages
Edition : 1st
Language : English
ISBN-13 : 9781788393744
Category :
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Apr 27, 2018
Length: 404 pages
Edition : 1st
Language : English
ISBN-13 : 9781788393744
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
₹800 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
₹4500 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₹400 each
Feature tick icon Exclusive print discounts
₹5000 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₹400 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 11,396.97
Learn Qt 5
₹3649.99
Game Programming using Qt 5 Beginner's Guide
₹4096.99
Hands-On GUI Programming with C++ and Qt5
₹3649.99
Total 11,396.97 Stars icon

Table of Contents

17 Chapters
Introduction to Qt Chevron down icon Chevron up icon
Qt Widgets and Style Sheets Chevron down icon Chevron up icon
Database Connection Chevron down icon Chevron up icon
Graphs and Charts Chevron down icon Chevron up icon
Item Views and Dialogs Chevron down icon Chevron up icon
Integrating Web Content Chevron down icon Chevron up icon
Map Viewer Chevron down icon Chevron up icon
Graphics View Chevron down icon Chevron up icon
The Camera Module Chevron down icon Chevron up icon
Instant Messaging Chevron down icon Chevron up icon
Implementing a Graphics Editor Chevron down icon Chevron up icon
Cloud Storage Chevron down icon Chevron up icon
Multimedia Viewers Chevron down icon Chevron up icon
Qt Quick and QML Chevron down icon Chevron up icon
Cross-Platform Development Chevron down icon Chevron up icon
Testing and Debugging Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
(8 Ratings)
5 star 12.5%
4 star 37.5%
3 star 12.5%
2 star 12.5%
1 star 25%
Filter icon Filter
Top Reviews

Filter reviews by




Istvan Dec 24, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
IT is correct
Amazon Verified review Amazon
Amine Aug 25, 2021
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Contains interesting Qt code snippets.
Amazon Verified review Amazon
Ersin Söbütay Oct 31, 2018
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Passt
Amazon Verified review Amazon
Donato Bolzani Jul 14, 2021
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
É um livro básico, para iniciantes.Consegui alcançar alguns objetivos através de seu conteúdo.Entretanto, apresenta algumas falhas. Começo a imaginar que a Editora não seja muito exigente quanto à correspondência entre o conteúdo do livro e os códigos de exemplo - indicados no próprio livro - baixados do site da editora.Já havia percebido essas diferenças em outros títulos.
Amazon Verified review Amazon
Birdski Nov 15, 2018
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
Lots of errors in this book. It makes it hard to follow some chapters.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.