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
Arrow up icon
GO TO TOP
Qt5 C++ GUI Programming Cookbook

You're reading from   Qt5 C++ GUI Programming Cookbook Design and build a functional, appealing, and user-friendly graphical user interface

Arrow left icon
Product type Paperback
Published in Jul 2016
Last Updated in Feb 2025
Publisher Packt
ISBN-13 9781783280278
Length 300 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
 Eng Eng
Author Profile Icon Eng
Eng
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Look and Feel Customization 2. States and Animations FREE CHAPTER 3. QPainter and 2D Graphics 4. OpenGL Implementation 5. Building a Touch Screen Application with Qt5 6. XML Parsing Made Easy 7. Conversion Library 8. Accessing Databases 9. Developing a Web Application Using Qt Web Engine Index

Touch events


In this section, we will learn how to develop a touch-driven application that runs on mobile devices using Qt Quick.

How to do it…

  1. First of all, create a new Qt Quick application project.

  2. In Qt Creator, right-click on qml.qrc and select Open in Editor. Then, click Add | Add Files and add tux.png to the project:

  3. Next, open up MainForm.ui.qml. Drag an image widget from the Library window to the canvas. Then, set the source of the image to tux.png and set its fillmode to PreserveAspectFit. After that, set its width to 200 and its height to 220.

  4. Make sure both the mouse area widget and the image widget are exported as alias properties of the root item by clicking on the small icon besides their respective widget name.

  5. After that, switch over to the Script Editor by clicking on the Edit button on the side bar located at the left side of the editor. We need to change the mouse area widget to a multi-point touch area widget, like so:

    MultiPointTouchArea {
      id: touchArea
      anchors.fill: parent...
lock icon The rest of the chapter is locked
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Qt5 C++ GUI Programming Cookbook
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
Modal Close icon
Modal Close icon