|
AlbumShaper
1.0a3
|
#include <scaledPreviewInterface.h>


Signals | |
| void | resized () |
Public Member Functions | |
| ScaledPreviewInterface (QString imageFilename, QWidget *parent=0, const char *name=0) | |
| Creates layout. | |
| virtual QSize | sizeHint () const |
| virtual QSize | minimumSizeHint () const |
Protected Member Functions | |
| void | resizeEvent (QResizeEvent *) |
Private Attributes | |
| QImage | fullScreenImage |
| Full screen version of image. | |
| QSize | origImageSize |
| original image dimensions | |
Definition at line 19 of file scaledPreviewInterface.h.
| ScaledPreviewInterface::ScaledPreviewInterface | ( | QString | imageFilename, |
| QWidget * | parent = 0, |
||
| const char * | name = 0 |
||
| ) |
Creates layout.
Definition at line 19 of file scaledPreviewInterface.cpp.
References fullScreenImage, getImageSize(), origImageSize, and scaleImage().
:
SplitViewInterface (parent, name )
{
//store original image dimensions
getImageSize( imageFilename, origImageSize );
//resize image to current screen size for faster
//scaling during resize events
QRect screenSize = qApp->desktop()->availableGeometry();
scaleImage( imageFilename, fullScreenImage, screenSize.width()/2, screenSize.height()/2 );
//-----
}
| QSize ScaledPreviewInterface::minimumSizeHint | ( | ) | const [virtual] |
Reimplemented from SplitViewInterface.
Definition at line 58 of file scaledPreviewInterface.cpp.
References origImageSize.
{
QSize baseMinSize = SplitViewInterface::minimumSizeHint();
int w = baseMinSize.width();
int h = QMAX( baseMinSize.height(), (w*origImageSize.height())/origImageSize.width() );
return QSize( w, h );
}
| void ScaledPreviewInterface::resized | ( | ) | [signal] |
Referenced by resizeEvent().
| void ScaledPreviewInterface::resizeEvent | ( | QResizeEvent * | ) | [protected, virtual] |
Implements SplitViewInterface.
Definition at line 33 of file scaledPreviewInterface.cpp.
References fullScreenImage, height, resized(), SplitViewInterface::setImages(), and width.
{
//if image has yet to be set return
if( fullScreenImage.isNull() ) return;
//generate orig image
//set adjusted image to null so repain won't occur until it is reset
setImages( fullScreenImage.scale( width(), height(), QImage::ScaleMin ),
QImage() );
//emit resized signal
emit resized();
}
| QSize ScaledPreviewInterface::sizeHint | ( | ) | const [virtual] |
Implements SplitViewInterface.
Definition at line 47 of file scaledPreviewInterface.cpp.
References origImageSize.
{
//a 500x375 is 4:3 aspect ratio which is fairly typical
//we'll clamp the hight to 375 in the situation where an image is mucher taller than wide
//(and hence computed height would be so big window won't fit on screen)
int w = 500;
int h = QMIN( 375, (w*origImageSize.height())/origImageSize.width() );
return QSize( w,h );
}
QImage ScaledPreviewInterface::fullScreenImage [private] |
Full screen version of image.
Definition at line 35 of file scaledPreviewInterface.h.
Referenced by resizeEvent(), and ScaledPreviewInterface().
QSize ScaledPreviewInterface::origImageSize [private] |
original image dimensions
Definition at line 38 of file scaledPreviewInterface.h.
Referenced by minimumSizeHint(), ScaledPreviewInterface(), and sizeHint().
1.7.5.1