On Wed, 11 Feb 2009 14:12:57 +0100, Markus Feldmann
<[email protected]> wrote:
> 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>.

http://doc.trolltech.com/4.4/qtglobal.html#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);
>   }

The equivalent Python is...

    assert self.imageLabel.pixmap() is not None

Phil
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to