Introduction - If you have any usage issues, please Google them yourself
The user is then asked to select an image file using QFileDialog::getOpenFileName(). The selected file is loaded into a QImage. Using a QImage lets us ensure that the selected file is a valid image, and it also allows us to immediately display the image in the dialog using setPixmap().
Next the image is streamed into a QBuffer using a QDataStream. This gives us the size, which we then use to create() our shared memory segment. Creating a shared memory segment automatically attaches the segment to the process. Using a QBuffer here lets us get a pointer to the image data, which we then use to do a memcopy() from the QBuffer into the shared memory segment.