 Hey everybody, welcome to the 24th Qt tutorial with C++ and GUI programming. Today we're going to be covering the slider. So let's just drag one of those on our dialogue and the progress bar. And let's just set the layout here. Now, these may look familiar. Slider, you just grabbed a little knob here and move it back and forth and the progress bar shows a progress. Let's actually just make a signal and slot here. So we can see the horizontal slider or Q slider. We can say action triggered, range change, slider mode, etc. Let's just do a value changed and on the progress bar we'll do set value. And you've seen this before, this is nothing new, but I wanted to compile it and show you real quickly what we can expect from these. That's the basic functionality here and you notice this text. On Windows, that's kind of annoying because it's off to the side and on Linux it's in the center. You can actually turn that off to show text. Display text. We'll find it eventually. I'm not going to waste 10 minutes at your time trying to find it, but it's in here somewhere, I can guarantee you that. Text visible, there we go, sorry about that. That's how you hide the text on that. Now these controls, although they serve different functions, are actually very, very similar in design. Let's actually go in here to our dialog, CPP. You can see when you go UI, horizontal slider, there is a value and that gets the value and the same thing is true with the progress bar. Now to set the value you simply say set value and it's the same on both of those controls. Like I said, they're very similar. They have a range. One allows you to manipulate the range. One allows you to display the range. We're going to actually just get rid of this signal slot here and delete that and we're going to set that up manually just so you can see how this works. We'll say connect. Remember the first argument is the sender. We say UI, horizontal slider and we want to send the signal and the signal is going to be value changed and then the third parameter is going to be the receiving widget which is the UI progress bar and we're going to set the slot which is going to be set value. You can see how that works. The horizontal slider is emitting the value changed and the progress bar is receiving it in the slot set value. Notice the parameter and these have to match or this will not function at all. You won't get a compiler error. It just won't work. That's one of the annoying things about Qt that I really don't like. If it's mixed matched or if something weird happens it just won't work. Let's go ahead and run this and make sure it works as expected and there it is. There's our signals and slots hard at work. Now you notice when we started this the values were off. What we're going to do here is we're going to say UI progress bar set value and we're going to say UI was a horizontal slider value. Let's just run that again. That way when it starts they'll be the same value. Voila. Two very simple yet powerful controls. I'm sure you can think of a million and one uses of each of these controls. Progress bars I'm sure you've seen them all over the place here. Not as heavily used but they're pretty useful. This is Brian. I hope you found this tutorial educational and entertaining and thank you for watching.