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 now! 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
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
QT5 Blueprints

You're reading from   QT5 Blueprints Design, build, and deploy cross-platform GUI projects using the amazingly powerful Qt 5 framework

Arrow left icon
Product type Paperback
Published in Mar 2015
Publisher
ISBN-13 9781784394615
Length 272 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Symeon Huang Symeon Huang
Author Profile Icon Symeon Huang
Symeon Huang
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Creating Your First Qt Application FREE CHAPTER 2. Building a Beautiful Cross-platform Clock 3. Cooking an RSS Reader with Qt Quick 4. Controlling Camera and Taking Photos 5. Extending Paint Applications with Plugins 6. Getting Wired and Managing Downloads 7. Parsing JSON and XML Documents to Use Online APIs 8. Enabling Your Qt Application to Support Other Languages 9. Deploying Applications on Other Devices 10. Don't Panic When You Encounter These Issues Index

Making use of the progress bar


An intuitive way to indicate the downloading progress is by using a progress bar. In Qt, it is the QProgressBar class that provides a horizontal or vertical progress bar widget. It uses minimum, value, and maximum to determine the completed percentage. The percentage is calculated by the formula, (value – minimum) / (maximum – minimum). We'll use this useful widget in our example application by performing the following steps:

  1. Go back to the MainWindow class.

  2. Edit the mainwindow.ui file in the Design mode.

  3. Drag Push Button and rename it as newDownloadButton with New Download as its text.

  4. Drag Progress Bar just beneath newDownloadButton.

  5. Change the layout to Lay Out Vertically.

  6. Uncheck textVisible in the progressBar widget's property.

The push button, newDownloadButton, is used to popup DownloadDialog to get a new download task. We need to apply some modifications to mainwindow.h, as suggested here:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime