(self)
This slot function is called in the second Dialog process, when the
        user presses the "Load Image from Shared Memory" button.  First, it
        attaches the process to the shared memory segment created by the first
        Dialog process.  Then it locks the segment for exclusive access, copies
        the image data from the segment into a QBuffer, and streams the QBuffer
        into a QImage.  Then it unlocks the shared memory segment, detaches
        from it, and finally displays the QImage in the Dialog.
This slot function is called in the second Dialog process, when the
        user presses the "Load Image from Shared Memory" button.  First, it
        attaches the process to the shared memory segment created by the first
        Dialog process.  Then it locks the segment for exclusive access, copies
        the image data from the segment into a QBuffer, and streams the QBuffer
        into a QImage.  Then it unlocks the shared memory segment, detaches
        from it, and finally displays the QImage in the Dialog.
This slot function is called in the second Dialog process when the user presses the Load Image from Shared Memory button . First it attaches the process to the shared memory segment created by the first Dialog process . Then it locks the segment for exclusive access copies the image data from the segment into a QBuffer and streams the QBuffer into a QImage . Then it unlocks the shared memory segment detaches from it and finally displays the QImage in the Dialog .
def loadFromMemory(self):
        """ This slot function is called in the second Dialog process, when the
        user presses the "Load Image from Shared Memory" button.  First, it
        attaches the process to the shared memory segment created by the first
        Dialog process.  Then it locks the segment for exclusive access, copies
        the image data from the segment into a QBuffer, and streams the QBuffer
        into a QImage.  Then it unlocks the shared memory segment, detaches
        from it, and finally displays the QImage in the Dialog.
        """

        if not self.sharedMemory.attach():
            self.ui.label.setText(
                    "Unable to attach to shared memory segment.\nLoad an "
                    "image first.")
            return
 
        buf = QBuffer()
        ins = QDataStream(buf)
        image = QImage()

        self.sharedMemory.lock()
        buf.setData(self.sharedMemory.constData())
        buf.open(QBuffer.ReadOnly)
        ins >> image
        self.sharedMemory.unlock()
        self.sharedMemory.detach()

        self.ui.label.setPixmap(QPixmap.fromImage(image))
def loadFromMemory ( self ) : if not self . sharedMemory . attach ( ) : self . ui . label . setText ( "Unable to attach to shared memory segment.\nLoad an " "image first." ) return buf = QBuffer ( ) ins = QDataStream ( buf ) image = QImage ( ) self . sharedMemory . lock ( ) buf . setData ( self . sharedMemory . constData ( ) ) buf . open ( QBuffer . ReadOnly ) ins >> image self . sharedMemory . unlock ( ) self . sharedMemory . detach ( ) self . ui . label . setPixmap ( QPixmap . fromImage ( image ) )