 Hey everybody, this is Brian. Welcome to the 59th Qt Tutorial with C++ and GUI Programming. Today we are going to discuss the tooltip. And before you stop watching my tooltips, you should note that this actually has a lot to offer. And a lot of people think, oh tooltips, I know everything there is to know. Well, no, Qt adds a lot of functionality to tooltips. So let's just create a dialog here and finish. And add in a push button. Let's just add in a couple of these here. That way we've got a couple to play around with. So we'll call this pushButton1 and we'll call this pushButton2. Now we've got our pushButtons on our dialog here. And we'll just actually just set the names right here so you can see which one's which. And open up the source. Now comes the fun part. And we'll say setToolTip. And we'll say hello. And compile and run. And after it's done building, it'll open up. There's our beautiful application. When you mouse over the pushButton, there's our tooltip. Now I know many of you that have programmed in other frameworks and other libraries are probably rolling your eyes going, see, I told you it's just a tooltip. Well, we're not done yet. There's actually a lot more to tooltips in Qt. If you know any HTML, you can put in some HTML formatting. So we'll say hello world with bold. You see how world is bold. But that's not all. You can actually get really stylized with these. For example, let's say font color equal. Notice the single quotes. Give it a color name. We'll say red. Bile and run. And then hello world. Now you might be sitting here going, wow, that's pretty neat. But you know what? That's still not all. You can do a lot with tooltips. I was actually very surprised when I first started using tooltips in Qt. I almost skipped the chapter. I was like, I'm not going to read tooltips. I've done tooltips a million times. But you know what? I'm really glad I read it. So I'll say ally. And if you're wondering what I'm doing, I'm just creating a basic list here. So I'll say item one. Do a little copy and paste magic here. And if you're wondering about the hard returns in the string, the compiler really doesn't care. C++ doesn't really care about white space. Some older versions, like C, really would gripe and complain about white space. If you're wondering what white space is, it's these hard returns. And sometimes the tabs. That's how some languages were. And their compilers were just horrible, horrible, horrible to work with. All right, so let's save and run this. And you can see we have hello world with item one, two, three in a nice bulleted list. That is pretty impressive for a tooltip. Most frameworks and libraries don't even come close to that. Especially if you're coming from like the visual basic world. You're probably just sitting in your chair with your jaw laying in your lap going, what the heck just happened? But that's not all. And this is really cool. Let's actually go new. And we're going to create a resource file. We'll call it my res. Now, if you know what a resource file is, great, if not, then go back and watch the tutorial on resources. Now I'm going to pause the video because I'm going to go find some images that are worthy of this tutorial and I'll be right back. Okay, hunted through my images and found a few now. We have to add a prefix. So we'll just say, let's call this files. And then we are going to add files. And I've added a sub folder into my project here with some images. And we'll just say, stop. Now let's just add all of them. Why not? So we have add, stop and warning. Notice they're all different sizes. Save your resource file. And let's say UI. Push button to set tool tip. And we want to add an image in here. So I say IMG SRC equal. Notice the single quotes. Single quotes are very important because if you use a double quote, it'll actually break your string. And because it's in a resource file, we need the colon and we need the path. We'll say files, images, and say add.png. Then add some text in behind here. Compile and run. It may take a second or two extra because you're building a resource file. And when you mouse over, you see there's your add icon. Hello world. Pretty neat. And let's just see the bigger one in here, stop.png. So you see you can get very creative with these tool tips. And you can add in a lot of functionality. Let the user know, hey, stop. Before you click this button, bad things will happen. Or I should say, you know, if you click the button, bad things will happen. But you know what I mean. It's a pretty robust system. This is Brian. I thank you for watching. I hope you found this video educational and entertaining. And keep up with the feedback. I like hearing from you guys.