Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Application Development with Qt Creator - Third Edition

You're reading from  Application Development with Qt Creator - Third Edition

Product type Book
Published in Jan 2020
Publisher
ISBN-13 9781789951752
Pages 426 pages
Edition 3rd Edition
Languages
Author (1):
Lee Zhi Eng Lee Zhi Eng
Profile icon Lee Zhi Eng

Table of Contents (19) Chapters

Preface 1. Section 1: The Basics
2. Getting Started with Qt Creator 3. Building Applications with Qt Creator 4. Designing Your Application with Qt Designer 5. Qt Foundations 6. Developing Applications with Qt Widgets 7. Section 2: Advanced Features
8. Drawing with Qt 9. Doing More with Qt Quick 10. Implementing Multimedia with Qt Quick 11. Sensors and Qt Quick 12. Section 3: Practical Matters
13. Localizing Your Application with Qt Linguist 14. Optimizing Performance with Qt Creator 15. Developing Mobile Applications with Qt Creator 16. Embedded and IoT Development with Qt Creator 17. Qt Tips and Tricks 18. Other Books You May Enjoy

Wiring the Qt Widgets application logic

The application logic for the calculator is simple: we add a property setter to ResultDialog that lets us set the result field of the dialog, and then we wire up some arithmetic, signals, and slots in MainWindow, to do the actual computation and show the dialog. Let's have a look at the following steps:

  1. First, make the following change to ResultDialog:
void ResultDialog::setResult(float r) 
{ 
    ui->result->setText(QString::number(r)); 
} 

This method takes a float, the value to show in the dialog, and formats the result as a string, using Qt's default formatting. Qt is fully internationalized; if you do this in English-speaking locales, it will use a decimal point, whereas if you do it with a locale set to a region where a comma is used as the decimal separator, it will use a comma instead. The number method is a handy...

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 €14.99/month. Cancel anytime}