Example #1
0
    def __init__(self, map_image_location, parent=None):
        super(MapImage, self).__init__(parent)

        # Image
        self.setFixedHeight(700)
        self.setFixedWidth(1300)
        self.setObjectName("map_image")

        # Set defaults to handle mouse events, as if these are not setup and a user clicks on the image, then all future
        # mouse events are ignored.
        self.enableDefaultMouseHooks()

        map_image = QImage(map_image_location)
        self.map_image = map_image.scaled(1300, 700, Qt.KeepAspectRatio)

        # Create a pixmap for the overlay. This will be modified by functions to change what is being displayed 
        # on the screen.
        self.overlay_image = QImage(self.map_image.size(), QImage.Format_ARGB32_Premultiplied) 
        self.overlay_image.fill(Qt.transparent)

        self.update()