 Hey everybody, this is Brian and welcome to the 75th cute tutorial with C++ and GUI programming. I have to apologize if I sound a little weird. I'm getting over very, very bad cold. And as a result, I'm really stuffed up. I had, you know, sore throat, the works. I mean, you name it, I had it. I'm on a very large dose of antibiotics. Needless to say, this has not been a fun recovery at all. This video is actually a do-over. The first one that I did, the sound was incredibly low for some reason. Still no idea why I think I probably just bumped something on my microphone. If you're wondering what I'm doing, including the cute GUI and cute core, we're just going to really quickly do the exact same things we've been doing where we're just going to create a simple dialogue and then we're going to override the paint event. If you have no idea what I'm doing, please watch my other videos and give me feedback. All right, now that handy tip one of my viewers gave me where you just right-click Refractor and add definition of dialogue.cpp and it generates a code for you. I love that. That's just so awesome. All right, now I'm going to create a cute painter and we're going to create a rectangle. Then we'll just say, q-rect. Now, what is q-rect? Well, it is a rectangle and we're just going to give it some coordinates here. And if you look at the IntelliSense, it says, left-top with height. So we're just going to say, 10 left, 10 top, 100 width, 100 height. And we're just going to draw this in red. So we'll say, q-pen and we'll call this frame-pen. Not pan, frame-pen. There we go. And we're going to draw this in red. Give it our rectangle object we just created. Save your work. Go ahead and compile and run this. Maybe if it builds any second now. Yeah, I just, I got hit by that flu really hard. I'm still recovering. Anyways, here's our rectangle in all its glory and you see we gave it a starting position and a width and a height, 10, 10, 100, 100. So what's the big deal with the rectangle? Well, I mean, as you can see, it's a rectangle. In this case, it's a perfect square because we gave it the perfect dimensions, but we could have given it any size. Well, look at the screen. Look at the windows. Almost everything on the screen is a rectangle of some sort. You have these buttons, they're rectangles. You have that icon that's a rectangle. This text fits in a rectangle. The window itself is a rectangle. Actually, look at Qt Creator. It's made up of rectangles. Each one of these icons, each one of these menu items, this tree view is filled with little rectangles. I mean, basically what I'm telling you is the rect is kind of the bread and butter of the drawing objects. You're going to use rect very heavily. You can actually define a bounds within a rectangle. And to do that, let's actually draw a circle. And we're just going to say painter, draw ellipse. And notice how we're giving it the rect object which we just created. Notice how we didn't do draw circle or create some circle object or anything. We're just giving it the rectangle. What do you think is going to happen here? Well, if you guess that it's going to draw a circle within a rectangle, you guess correct. And you can actually, oops, get rid of that. You can actually omit the code to draw the rectangle and just draw the circle itself. And notice how we've drawn a complete perfect circle and it stays within the bounds of our rectangle. That's what I mean by you'll use rect very heavily in most of your drawing code. Now let's just play with this a little bit. We want to get our pen here. And what we want to do is, we want to stylize this a little bit. So we're just going to say frame pen, set width. And we're just going to say six. Just because, you know, six is a really cool number. Painter, set pen. And we want to give it the frame pen. Now you've worked with pens before. So you, you know, you obviously know what's going to happen here. It's just going to draw really, really thick lines and they're going to be red. But one thing we have not discussed, which we're going to cover right now, is the concept of a brush. Think of this as you're an artist and you're drawing on a canvas. A pen draws a line, a brush draws an area. So what we're going to do is we're going to actually create a brush object here. We'll say cue brush. And we'll just call it brush. We want to call this blue. That's the color it's going to be. And we need to give it a pattern. And the patterns are all in the help files that come with cue. But I'm just going to pick the diagonal cross pattern. And then we are going to fill the rectangle. So we'll just say painter, fill rect. And notice how it takes two objects. It takes our rect and it takes our brush. It's saying what area and what do you want to fill it with? And you can see now how it is filled with this diagonal cross pattern. But we've also got to outline with our pen. That's the difference between a brush and a pen. A pen outlines a brush fills. And let's actually, let's just call solid pattern. That way it's a little more striking and it really hits home what we're doing here. We've filled the rectangle and we've outlined it. Now you can actually omit the code that draws these lines with solid blue rectangle. Let's do that real quick. Let's get rid of the draw rect and the draw ellipse. Compile and run. And there's our solid blue rectangle. So that's what a brush does. It just fills an area. And we could also add the ellipse and omit the rect. And you'll see that we have a circle. And we are drawing the circle. But we've filled in the blue area of the rectangle. Now you notice how this is layered. Meaning if you were to draw the circle first, you wouldn't see the circle. You maybe see these little corner edges. But it would be covered up by this big blue block. So you've always got to be mindful of how you want to draw and in what order. Well, that's all for this tutorial. This is Brian. Thank you for watching. I hope you found this tutorial educational and entertaining.