def prepare(self):
        pixmap = self.property('pixmap')
        if pixmap is not None:
            return super(XWalkthroughSnapshot, self).prepare()
        widget = self.property('widget')
        if type(widget) in (unicode, str):
            widget = self.findReference(widget)
            if not widget:
                return super(XWalkthroughSnapshot, self).prepare()
        if self.property('overlay') and widget.parent():
            ref = self.referenceWidget()
            if ref == widget:
                pos = QtCore.QPoint(0, 0)
            else:
                glbl_pos = widget.mapToGlobal(QtCore.QPoint(0, 0))
                pos = ref.mapFromGlobal(glbl_pos)
            self.setProperty('pos', pos)
        crop = self.property('crop', QtCore.QRect(0, 0, 0, 0))
        if crop:
            rect = widget.rect()
            if crop.width():
                rect.setWidth(crop.width())
            if crop.height():
                rect.setHeight(crop.height())
            if crop.x():
                rect.setX(rect.width() - crop.x())
            if crop.y():
                rect.setY(rect.height() - crop.y())
            pixmap = QtGui.QPixmap.grabWidget(widget, rect)
        else:
            pixmap = QtGui.QPixmap.grabWidget(widget)
        scaled = self.property('scaled')
        if scaled:
            pixmap = pixmap.scaled(pixmap.width() * scaled,
                                   pixmap.height() * scaled,
                                   QtCore.Qt.KeepAspectRatio,
                                   QtCore.Qt.SmoothTransformation)
        kwds = {}
        kwds['whatsThis'] = widget.whatsThis()
        kwds['toolTip'] = widget.toolTip()
        kwds['windowTitle'] = widget.windowTitle()
        kwds['objectName'] = widget.objectName()
        self.setProperty('caption', self.property('caption', '').format(**kwds))
        self.setProperty('pixmap', pixmap)
        self.addPixmap(pixmap)
        return super(XWalkthroughSnapshot, self).prepare()