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
25 December 2024
In this episode, I'm discussing some non-trivial painting code. It includes coordinate transformations, discussions of cosmetic pens and more.
Links mentioned in this video:
Episode 43 - coordinate transformations https://youtu.be/VLpoDs15o-Y?list=PL6CJYn40gN6jIsRYriqN70V83t_mdDZHT
Introduction to Qt Widgets - Module 6 https://www.youtube.com/playlist?list=PL6CJYn40gN6jIsRYriqN70V83t_mdDZHT
Chapters:
0:00 Welcome
01:13 Starting in the UI file - layout and painting in the same widget
03:20 starting in the paintEvent method
04:50 translating to the top of the grid
06:49 scaling the painter
07:34 The rest of the paintEvent method
10:04 drawGrid method - cosmetic pen
13:43 Its OK to paint outside the screen
15:04 The draw method - drawing a scaled pen
17:38 The drawPoint method - save/restore
20:24 drawing scaled text at a specific point
22:18 Thanks for this time
The example code showcased in this video is available here: https://github.com/KDABLabs/kdabtv/tree/master/Qt-Widgets-and-more/font-metrics