[PyQt] Zoom or scale into an QImage

Markus Feldmann feldmann_markus at gmx.de
Tue Feb 10 21:45:51 GMT 2009


Hi All,

i have an QScrollArea where i inserted a QLabel.
This QLabel includes an QImage.

I want to zoom/scale into this image.
How can i do this?

Regards Markus

Here is a PART of my Code:
###########################################################
class ScrollArea(QScrollArea):
     def __init__(self, parent=None):
         QScrollArea.__init__(self, parent)

         self.imagelabel = QLabel()
         self.image = QImage("./media/images/aventurien.jpg")
         self.imagelabel.setPixmap(QPixmap.fromImage(self.image))
         self.setWidget(self.imagelabel)


class ReiseHelfer(QMainWindow):
     def __init__(self, parent=None):
         QMainWindow.__init__(self, parent)

         self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

         self.createActions()
         self.createMenus()
         self.createStatusBar()

         self.setWindowTitle(self.tr("Reisehelfer"))
         self.scrollArea = ScrollArea()
         self.scrollArea.setBackgroundRole(QPalette.Dark)
         self.setCentralWidget(self.scrollArea)

         self.readSettings()



More information about the PyQt mailing list