KD Reports |
| Home | | | Namespaces | | | Classes | | | Files | | | Directories | |
#include <KDReportsImageElement.h>
Public Member Functions | |
ImageElement (const QPixmap &pixmap) | |
virtual | ~ImageElement () |
void | setPixmap (const QPixmap &pixmap) |
ImageElement (const ImageElement &other) | |
ImageElement & | operator= (const ImageElement &other) |
void | setWidth (qreal width, Unit unit=Millimeters) |
void | setHeight (qreal height, Unit unit=Millimeters) |
void | setFitToPage () |
The KDReports::ImageElement class represents an image in the report.
KDReports::ImageElement::ImageElement | ( | const QPixmap & | pixmap | ) | [explicit] |
Creates a image element from the given pixmap.
virtual KDReports::ImageElement::~ImageElement | ( | ) | [virtual] |
Destroys this image element.
KDReports::ImageElement::ImageElement | ( | const ImageElement & | other | ) |
Copies a image element.
ImageElement& KDReports::ImageElement::operator= | ( | const ImageElement & | other | ) |
Copies the data from another image element.
void KDReports::ImageElement::setFitToPage | ( | ) |
Requests that the image be scaled so that it fills the page as much as possible, while still preserving aspect ratio. This is mutually exclusive with setHeight/setWidth.
void KDReports::ImageElement::setHeight | ( | qreal | height, | |
Unit | unit = Millimeters | |||
) |
Sets the height of the image. The width of the image is calculated so that the aspect ratio is preserved. This is mutually exclusive with setWidth().
void KDReports::ImageElement::setPixmap | ( | const QPixmap & | pixmap | ) |
Sets the pixmap for this image element. This replaces the pixmap set previously.
void KDReports::ImageElement::setWidth | ( | qreal | width, | |
Unit | unit = Millimeters | |||
) |
Sets the width of the image. The height of the image is calculated so that the aspect ratio is preserved.
The default size, if setWidth is not called, is the pixmap's size in pixels, which might lead to a different size depending on the resolution of the output device but avoids any resizing. On the other hand, setWidth makes sure that the layout of the document is always the same by resizing the pixmap if necessary.
For an image that should take half of the width of the page, call setWidth(50, KDReports::Percent).
Note that images inside table cells still have their width relative to the page, not to the cell. For instance setWidth(10, KDReports::Percent) means that the image width will be 10% of the page width, not 10% of the containing cell's width.
Copyright © 2008, Klarälvdalens Datakonsult AB | KD Reports |