Sign up for the KDAB Newsletter
Stay on top of the latest news, publications, events and more.
Go to Sign-up
Find what you need - explore our website and developer resources
9 December 2024
With your current knowledge of QPainter, you would likely have a hard time if I asked you to draw an analog clock. Obviously, you know you can draw a line between two points with drawLine, but how do you determine these two points for say the 5 o'clock marker?
To the rescue comes coordinate transformations, which is the topic of this episode.
Links:
* KDAB Consulting: https://www.kdab.com/services/software-consulting/
The example code showcased in this video is available here: https://github.com/KDABLabs/kdabtv/tree/master/Programming-With-Qt-Widgets
00:00 Introduction
00:44 Translate
01:21 Scale
01:35 Shear
02:04 Rotate
02:20 drawRotatedText
06:50 QTransform
08:12 Example with QTransform
9:54 QMatrix doesn't exists anymore
10:13 Perspective Projection
12:13 Analog clock
13:40 Ad: Migrating from Raspberry Pie to Banana Pie
14:02 Analog clock continued
19:50 Making the y axis point upwards
22:49 What's up next
All 'Introduction to Qt Widgets - Module 1' videos: https://www.youtube.com/playlist?list=PL6CJYn40gN6hgf7zCKF2Rv9Y0WoN8RVGf
All 'Introduction to Qt Widgets - Module 2' videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6j_c41CFMprvg9EiWz0WdSy
All 'Introduction to Qt Widgets - Module 3' videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6hWZO_viEf1rfjgk4E6SCKd
All 'Introduction to Qt Widgets - Module 4' videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6iXUNQMb2GkEjV_oK6Xid9-
All 'Introduction to Qt Widgets - Module 5' videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6h1tsLAETdrrFlsVMeYpiHI
All 'Introduction to Qt Widgets - Module 6' videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6jIsRYriqN70V83t_mdDZHT