 Hey everybody, it's Brian. This is our 9th Qt tutorial with C++ and we are going to cover the QGrid layout. First things first, you're going to need your minimal application, and I've changed it around a little bit. I've got some includes here. The include QtGui, I'm sorry QtGui and QtCore. And what these do is these give you references to the QtGui classes and the Core classes. Core would be like Q string, things of that nature, where QtGui would be push buttons, labels, things of that nature. Alright, now to start off with, we're going to go QGridLayout equals new QGridLayout. And first thing we really want to do is window set layout. That way we remember to put the layout in the window widget. And let's make a Q label called this label 1. New Q label. And we'll say the text of that should be name, and let's make a Q line edit. We're going to call this Text1, or we'll call it TextName, sorry. Can't type today. My keyboard is being kind of funky. Alright. So, so far we have our Q main application, our Q widget, which we're using as a window. We're setting the title. We're making a grid layout. We're setting the layout to the window. And we've got some controls or some widgets that we've made in memory, but we haven't done anything. So let's go layout, add widget. And you see how it says the parameters are widget, row, column, row span, column span. We're going to go over those real quick. The kind of self-explanatory, but the first one is the widget you're adding. And sorry, not the layout. It's the label. And then the row. Now think of a grid layout as literally a grid or a table. Like if you're looking at Excel or a spreadsheet program, 0, 0 is the first position. So we're going to put the label in 0, 0. Now we're going to add the text box to 0, 1. Think of this in terms of a grid. 0, 0 is upper left. 0, 1 is right next to it. Notice how we have not defined how big this table is. The QGridLayout is pretty intelligent. It's going to automatically figure out how big it needs to be. Let's compile and run this. And there's our application. Now notice how it's nice and neat and lined up, and we didn't really have to do anything. And we can resize it as well. All right. Let's actually copy and paste a few more of these. We'll call this label 2 and text name 2. And we're going to copy that. Paste it here. Now we can't add them to the same position. So what we're going to do here is we're going to go down a row. So we're going to say row 1. And then row 1 column 1. All right. Compile and run this. Now something is amiss here. What is going on? Let's look at our code, see if we can figure this out here. We've got label 1 used twice. That's why. Sorry. Ladies and gentlemen, you've just been the victim of copy and paste. Let's compile and run it again. Now it should work. There we go. So you can see how the grid layout allows you to very quickly build up a form and have it resize and do whatever you need to do. Now let's add a push button in here. Just for sake of clarity, we'll put it down here. Cue push button and we'll say, oops, and we'll say, okay for the text, and we're going to add this in. Let me grab that. I've been playing Call of Duty Black Ops. So my gaming mouse and gaming keyboard are really tweaked for the game and not for typing. And we're going to add the button in there. And we're going to add this to 2-0. And this time we're going to say, how many rows do we want this to span? 1. How many columns do we want this to span? 2. Now what that's going to do is say it can take up one row and two columns. It'll be pretty clear when we run this. Let's compile and run. And there it is. So you see, here's label, textbox, label, textbox, and then here's our button. It's in position 3-0. See 1, 2, 3, position 0. But it can take up two rows. And it'll automatically resize as needed. So this is Brian. Today we've covered the grid layout. We found this video educational and entertaining and I apologize for my gaming keyboard being a miss. I will try to get that fixed before the next video.