 Hey everybody, this is Brian. Welcome to the 124th Qt tutorial with C++ and GUI programming. We're going to name this one MyMapped. And if you haven't guessed, we're going to be going over the QtConcurrentMapped function. So we're going to make a QDialog project here. And pretty much the same as before. I'm kind of trying to follow kind of the same flow here, so it's pretty easy to follow along. Once you've seen one, you kind of know what to expect with the others. We're just going to make two list boxes here. And then we are going to add in our static function here. Now the difference between mapped and mapped is very subtle, but very powerful. So map just modifies, oh I can't even spell string. Q string, all right, pay attention. Anyways, map simply changes an existing collection, or I should say an existing sequence. Whereas mapped, plural, what we're covering today makes a new one. So Q string, item, and then we're just going to refactor that. And if you've been following along, you know exactly what to expect. We're going to have some function that's going to be called in a different thread. And we're going to have the button which actually does the actual work. So let's make this happen here. We're just going to say item.append, and we'll say for giggles, bottles of beer on the wall. You ever hear that song, 99 bottles of beer on the wall? Well, basically that's what we're doing here. All right, so we're going to go UI, list widget, and we're going to say clear, and UI, list widget 2. We're going to just clear that out, so we clear out any previous garbage. Q string items before. Should be Q string, Q string list, my bad, sorry. It is Christmas Eve here, and I want to crank out a couple of these videos before I go wrap presents, because I really don't like wrapping presents. I like buying the presents, I just don't like wrapping them. We're just going to keep this simple if I can type. I had actually a pretty long day at work, that's partly why I'm scatterbrained. While I don't hate my job, I definitely don't like my job, if you know what I mean. All right, so we're going to just update the user interface and list widget. We're going to call the add items, and we're just going to add that string list in there. Now we're going to actually create a new string list. Call it, you guessed it, items after. Did we add Q concurrent in there? We'll run into problems if we don't do that. And then let's add our include here. That'll make life a little bit easier when we go to compile this thing. And we're going to do blocking mapped with the plural. Now remember this slight difference is actually quite profound. Mapped will actually generate a new sequence. So we need the input sequence, which is items before, and we need the function pointer to what we're pointing this to, which in our case is make changes. And then just to prove that we actually did do something, we're going to update the UI with the items after. There we go. Pretty simple, pretty easy to understand tutorial. We're just going to clear out the list widgets. We're going to make a string list, and then we're going to call the Q concurrent blocking mapped with our items before, our string list, and we're going to point it to the make changes function, which is just going to take each item as it maps, go to append bottles of beer on the wall to it, and then we're going to display that in the second list widget. There we go. Whew, what a mouthful. I feel like I'm kind of rushing through this. Program ended unexpectedly. What have I done wrong here? Oh, derp. We totally forgot to return from our map here. That would probably be helpful. That's actually the whole point of mapping is to actually modify the function. All right, let's give it a good rebuild. That's what's happening when you rush. Don't ever rush. All right, so there we go. Now our little function actually works. So this is the before and this is after it's been mapped. The difference, once again, is the mapped plural will create a new list instead of modify your existing list. That's all for this, albeit simple tutorial. Please visit my website, voidromes.com for the source code for this and other tutorials. It is Christmas time, so if you're feeling generous, feel free to donate, but it's definitely not necessary.