[PyQt] Re: Zoom or scale into an QImage

Markus Feldmann feldmann_markus at gmx.de
Wed Feb 11 13:12:57 GMT 2009


At this moment i am trying the example:
http://doc.trolltech.com/4.4/widgets-imageviewer.html

But i have trouble to convert the class-method <scaleImage()>.

There is a Qt Method which is not listed in the Qt API
Library. It is named <Q_ASSERT>.

How should my PyQt4 Code looks like for this Class-Method?
I doesn't know what i have to do with <Q_ASSERT>.

Here i post the part of the example:
################################################################
  void ImageViewer::scaleImage(double factor)
  {
      Q_ASSERT(imageLabel->pixmap());
      scaleFactor *= factor;
      imageLabel->resize(scaleFactor * imageLabel->pixmap()->size());

      adjustScrollBar(scrollArea->horizontalScrollBar(), factor);
      adjustScrollBar(scrollArea->verticalScrollBar(), factor);

      zoomInAct->setEnabled(scaleFactor < 3.0);
      zoomOutAct->setEnabled(scaleFactor > 0.333);
  }



More information about the PyQt mailing list