Home · All Classes · Main Classes · Deprecated |
MImageWidget is a simple widget to show image. More...
Inherits MWidgetController.
Public Slots | |
void | setImage (const QString &id) |
void | setImage (const QImage &image) |
void | setPixmap (const QPixmap &pixmap) |
Public Member Functions | |
MImageWidget (QGraphicsItem *parent=0) | |
MImageWidget (const QString &id, QGraphicsItem *parent=0) | |
MImageWidget (const QImage *image, QGraphicsItem *parent=0) | |
MImageWidget (const QPixmap *pixmap, QGraphicsItem *parent=0) | |
MImageWidget (const MImageWidget &) | |
MImageWidget & | operator= (const MImageWidget &) |
virtual | ~MImageWidget () |
void | setImage (const QString &id, const QSize &size) |
QString | image () const |
QString | imageId () const |
QSize | imageSize () const |
const QPixmap * | pixmap () const |
void | setZoomFactor (qreal factor) |
void | setZoomFactor (qreal fx, qreal fy) |
void | zoomFactor (qreal *fx, qreal *fy) const |
void | zoomIn () |
void | zoomOut () |
void | setAspectRatioMode (Qt::AspectRatioMode mode) |
Qt::AspectRatioMode | aspectRatioMode () const |
void | setCrop (const QRectF &rect) |
QRectF | crop () const |
Properties | |
QRectF | crop |
Qt::AspectRatioMode | aspectRatioMode |
QString | image |
MImageWidget is a simple widget to show image.
Image allows the placement of images onto the UI. Images are generally non-interactive elements. Various single and multiple touch interactions can be added to an Image component if so wanted.
Image supports scale, crop, zoom operations.
NOTE: The images passed to MImageWidget are converted internally to OpenGL textures, thus their maximum size is limited by the GPU driver. Consult the documentation of the GPU unit for the actual maximum texture size. If the image exceeds the maximum supported size, it shall not be drawn.
Images can be used by themselves to decorate the UI (background images, frames etc.) and also combined as part of other components (grids, lists, buttons etc.).
If the Image has interactive elements, the touch area size of the interactive element needs to be specified. The area can occupy the entire Image, and/or it can also fall outside the Image: for instance in the case of an Image with a label, they are combined to form one interactive area. An Image can be on top or below of other images and other components (determined by the z-order).
MImageWidget provides sizeHint(), default size will be the size which defined in CSS. If not defined in CSS, will be the size of image which added into MImage.
MImageWidget can show border around the image, you can custom border in CSS. The border will work as a decoration and hint. Any cropped side will have no border.
MImageWidget can show image from theme:
MImageWidget* image = new MImageWidget("icon");
Also can get image with request size from theme:
MImageWidget* image = new MImageWidget(); image->setImage("icon", QSize(64,64));
Or set image directly
QImage img(path); MImageWidget* image = new MImageWidget(&img);
QImage img(path); MImageWidget* image = new MImageWidget(&img); image->setAspectRatioMode(Qt::IgnoreAspectRatio);
MImageWidget::MImageWidget | ( | QGraphicsItem * | parent = 0 |
) |
Constructs a image with a parent.
parent | Parent object. |
MImageWidget::MImageWidget | ( | const QString & | id, | |
QGraphicsItem * | parent = 0 | |||
) | [explicit] |
MImageWidget::MImageWidget | ( | const QImage * | image, | |
QGraphicsItem * | parent = 0 | |||
) | [explicit] |
MImageWidget::MImageWidget | ( | const QPixmap * | pixmap, | |
QGraphicsItem * | parent = 0 | |||
) | [explicit] |
MImageWidget::MImageWidget | ( | const MImageWidget & | other | ) |
Copy constructor.
MImageWidget::~MImageWidget | ( | ) | [virtual] |
Destroys the image.
Qt::AspectRatioMode MImageWidget::aspectRatioMode | ( | ) | const |
Get image aspect ratio mode.
QRectF MImageWidget::crop | ( | ) | const |
Get the crop rectangle.
QString MImageWidget::image | ( | ) | const |
Get the image id.
QString MImageWidget::imageId | ( | ) | const |
Get the image id.
QSize MImageWidget::imageSize | ( | ) | const |
Get the origin size of the image.
MImageWidget & MImageWidget::operator= | ( | const MImageWidget & | other | ) |
Assigns other to this MImageWidget and returns a reference to this MImageWidget.
const QPixmap * MImageWidget::pixmap | ( | ) | const |
Get the pointer of pixmap.
void MImageWidget::setAspectRatioMode | ( | Qt::AspectRatioMode | mode | ) |
Set image zoom AspectRatioMode.
mode | defines what happens to the aspect ratio when zoom image. |
void MImageWidget::setCrop | ( | const QRectF & | rect | ) |
Set image cropped to this recangle.
size | crop section rectangle |
Sets the logical ID associated with this image to id.
The graphics specified by the ID will be exactly of the specified size, and will stretch to fill the image widget.
void MImageWidget::setImage | ( | const QString & | id | ) | [slot] |
Sets the logical ID associated with this image to id.
Whatever size the graphics happens to be in the theme will be used. The graphics is then scaled to fit the image widget. Unless you know that the themed graphic is exactly of the right size, you must use the setImage(const QString &id, const QSize &size) method instead.
void MImageWidget::setZoomFactor | ( | qreal | fx, | |
qreal | fy | |||
) |
Set image width and height zoom factor.
fx | image width zoom factor | |
fy | image height zoom factor If fx not equals fy, will set zoom ratio mode to Qt::IgnoreAspectRatio automatic |
void MImageWidget::setZoomFactor | ( | qreal | factor | ) |
Set image two aspect ratio factors to one value.
factor | image zoom factor |
void MImageWidget::zoomFactor | ( | qreal * | fx, | |
qreal * | fy | |||
) | const |
This function get image zoom factor The parameters point to values stored in float.
If any of the pointers is 0, that value will not be updated.
void MImageWidget::zoomIn | ( | ) |
Zoom in image.
void MImageWidget::zoomOut | ( | ) |
Zoom out image.
Qt::AspectRatioMode MImageWidget::aspectRatioMode [read, write] |
MImageWidget::crop [read, write] |
QString MImageWidget::image [read, write] |
Copyright © 2010 Nokia Corporation | MeeGo Touch |