Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
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
Getting Started with Qt 5
Getting Started with Qt 5

Getting Started with Qt 5: Introduction to programming Qt 5 for cross-platform application development

eBook
$9.99 $22.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/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
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

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

Getting Started with Qt 5

Creating Widgets and Layouts

In this chapter, we shall take a look at what widgets are and the various kinds that are available for creating GUIs. For most GUI applications that you will write, Qt is laden with sufficient widgets to implement it. Coupled with widgets are layout classes, which help us to arrange and position the widgets for better appeal.

By the end of this chapter, you should be aware of the following:

  • Understand and know how to use widgets
  • Know the classes needed to lay out widgets

Widgets

Widgets are the graphical components with which we construct user interfaces. A familiar example of such a component is a textbox. This is the component that is used to capture our email address or last and first names on forms in a GUI application.

There are a few critical points to note regarding widgets in Qt:

  • Information is passed to widgets by way of events. For a textbox, an example of an event could be when a user clicks within the textbox or when the return key has been pressed while a textbox cursor is blinking.
  • Every widget can have a parent widget or children widgets.
  • Widgets that do not have a parent widget become a window when the show() function is called on them. Such a widget will be enclosed in a window with buttons to close, maximize, and minimize it.
  • A child widget is displayed within its parent widget.

Qt organizes its classes with heavy use of inheritance...

Layouts

Up to this point, we have been creating applications that only have one widget serving as the main component and, by extension, a window too. However, GUI applications are usually made up of several widgets that come together to communicate a process to the user. One way in which we can make use of multiple widgets is to use layouts to serve as the canvas into which we insert our widgets.

Consider the following class inheritance diagram:

It is important to consider the classes used in laying out widgets. As usual, the top class from which the QLayout abstract class inherits is QObject. Also, QLayout makes use of multiple inheritances by inheriting from QLayoutItem. The concrete classes here are QBoxLayout, QFormLayout, QGridLayout, and QStackedLayout. QHBoxLayout and QVBoxLayout further refine what the QBoxLayout class is by adding orientation to how the widgets within...

Summary

In this chapter, we have looked at a number of widgets that are useful in creating GUI applications. The process of compilation remains the same. We also learned how to use layouts to present and arrange multiple widgets.

Up to this point, our application does not do anything. The QPushButton instances, when clicked, do nothing along with the other widgets that are action driven.

In the next chapter, we shall learn how to animate our application so that it responds to actions, thus making them useful.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Learn how to write, assemble, and build Qt application from the command line
  • Understand key concepts like Signals and Slots in Qt
  • Best practices and effective techniques for designing graphical user interfaces using Qt 5

Description

Qt is a cross-platform application framework and widget toolkit that is used to create GUI applications that can run on different hardware and operating systems. The main aim of this book is to introduce Qt to the reader. Through the use of simple examples, we will walk you through building blocks without focusing too much on theory. Qt is a popular tool that can be used for building a variety of applications, such as web browsers, media players such as VLC, and Adobe Photoshop. Following Qt installation and setup, the book dives straight into helping you create your first application. You will be introduced to Widgets, Qt's interface building block, and the many varieties that are available for creating GUIs. Next, Qt's core concept of signals and slots are well illustrated with sufficient examples. The book further teaches you how to create custom widgets, signals and slots, and how to communicate useful information via dialog boxes. To cap everything off, you will be taken through writing applications that can connect to databases in order to persist data. By the end of the book, you should be well equipped to start creating your own Qt applications and confident enough to pick up more advanced Qt techniques and materials to hone your skills.

Who is this book for?

Anyone trying to start development of graphical user interface application will find this book useful. One does not need prior exposure to other toolkits to understand this book. In order to learn from this book you should have basic knowledge of C++ and a good grasp of Object Oriented Programming. Familiarity with GNU/Linux will be very useful though it's not a mandatory skill.

What you will learn

  • Set up and configure your machine to begin developing Qt applications
  • Discover different widgets and layouts for constructing UIs
  • Understand the key concept of signals and slots
  • Understand how signals and slots help animate a GUI
  • Explore how to create customized widgets along with signals and slots
  • Understand how to subclass and create a custom windows application
  • Understand how to write applications that can talk to databases.

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 28, 2019
Length: 136 pages
Edition : 1st
Language : English
ISBN-13 : 9781789955125
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
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Feb 28, 2019
Length: 136 pages
Edition : 1st
Language : English
ISBN-13 : 9781789955125
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 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
$199.99 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 $5 each
Feature tick icon Exclusive print discounts
$279.99 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 $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 130.97
Hands-On High Performance Programming with Qt 5
$48.99
Getting Started with Qt 5
$32.99
Mastering Qt  5
$48.99
Total $ 130.97 Stars icon
Banner background image

Table of Contents

7 Chapters
Introducing Qt 5 Chevron down icon Chevron up icon
Creating Widgets and Layouts Chevron down icon Chevron up icon
Working with Signals and Slots Chevron down icon Chevron up icon
Implementing Windows and Dialog Chevron down icon Chevron up icon
Managing Events, Custom Signals, and Slots Chevron down icon Chevron up icon
Connecting Qt with Databases 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 Half star icon Empty star icon 3.1
(7 Ratings)
5 star 28.6%
4 star 28.6%
3 star 0%
2 star 14.3%
1 star 28.6%
Filter icon Filter
Top Reviews

Filter reviews by




George McGinn Jul 03, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I new nothing about Qt5 before I got this book. After working the 6 chapters in it, I am designing my own GUI and even creating, updating and using MySQL databases in C++.This book is a great introduction and you will come away with a basic understanding of Qt5. If you want to advance to more features and a better understanding, you can supplement this book with one that goes into greater detail, like the Qt5 Cookbook or the Mastering Qt5 book.If you are not versed in C++, then this book will not help you with the C++ code. You need to be at least an intermediate level (understand the "this" pointer and other object-oriented principles) to carry the knowledge gained forward.
Amazon Verified review Amazon
Ian Mars P. Acut Feb 04, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Nice to have Qt 5 book on my shelf!
Amazon Verified review Amazon
Brendan Chong Aug 15, 2019
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Description was a little deceiving, doesn't really show you how to develop cross platform. But still worth the purchase
Amazon Verified review Amazon
Cliente Amazon Aug 20, 2022
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Il libro costituisce un buon mezzo per entrare nel mondo delle qt5 per chi ne fosse del tutto digiuno. Tutti gli esempi sono corredati del codice da scaricare da github. Il codice viene spiegato in dettaglio nel libro. Tutti gli esempi sono funzionanti senza dover operare correzioni. In definitiva un buon testo per novizi, dove trovare i principi di base delle qt5. Necessaria una conoscenza, anche minima, di C e C++.
Amazon Verified review Amazon
Retired Developer Sep 24, 2022
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
Book gives a good overview of QT 5.Oriented to Linux or MacOS user.Have been unable to get the examples in the book to run in a Windows environment.If there were a book out there focused on QT 5 in a Windows environment, I'd return this book.
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.