42 #include "private/qdeclarativeimage_p.h" 43 #include "private/qdeclarativeimage_p_p.h" 126 return d->pix.pixmap();
132 if (!
d->url.isEmpty())
140 pix.setPixmap(pixmap);
255 if (
d->fillMode == mode)
280 return d->paintedWidth;
286 return d->paintedHeight;
412 if (!
d->pix.width() || !
d->pix.height()) {
421 if (widthScale <= heightScale) {
423 d->paintedHeight = widthScale *
qreal(
d->pix.height());
424 }
else if(heightScale < widthScale) {
425 d->paintedWidth = heightScale *
qreal(
d->pix.width());
426 d->paintedHeight = h;
439 if (!
d->pix.width() || !
d->pix.height())
443 if (widthScale < heightScale) {
444 widthScale = heightScale;
445 }
else if(heightScale < widthScale) {
446 heightScale = widthScale;
449 d->paintedHeight = heightScale *
qreal(
d->pix.height());
450 d->paintedWidth = widthScale *
qreal(
d->pix.width());
452 d->paintedWidth =
width();
467 return QRectF(0, 0,
qMax(
d->mWidth,
d->paintedWidth),
qMax(
d->mHeight,
d->paintedHeight));
530 if (
d->pix.pixmap().isNull() )
533 int drawWidth =
width();
534 int drawHeight =
height();
540 if (
width() !=
d->pix.width() ||
height() !=
d->pix.height()) {
541 if (
d->fillMode >=
Tile) {
543 transform.
scale(widthScale, 1.0);
544 drawWidth =
d->pix.width();
546 transform.
scale(1.0, heightScale);
547 drawHeight =
d->pix.height();
551 if (widthScale <= heightScale) {
552 heightScale = widthScale;
554 }
else if(heightScale < widthScale) {
555 widthScale = heightScale;
559 if (widthScale < heightScale) {
560 widthScale = heightScale;
562 }
else if(heightScale < widthScale) {
563 heightScale = widthScale;
567 transform.
scale(widthScale, heightScale);
568 drawWidth =
d->pix.width();
569 drawHeight =
d->pix.height();
590 if (
d->fillMode >=
Tile)
The QPainter class performs low-level painting on widgets and other paint devices.
const QTransform & transform() const
Returns the world transformation matrix.
#define QT_END_NAMESPACE
This macro expands to.
QDeclarativeParserStatus ** d
bool widthValid() const
Returns whether the width property has been set explicitly.
QRectF boundingRect() const
This pure virtual function defines the outer bounds of the item as a rectangle; all painting must be ...
void setClipRect(const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip region to the given rectangle using the given clip operation...
void restore()
Restores the current painter state (pops a saved state off the stack).
bool heightValid() const
Returns whether the height property has been set explicitly.
bool testRenderHint(RenderHint hint) const
Returns true if hint is set; otherwise returns false.
void update(const QRectF &rect=QRectF())
Schedules a redraw of the area covered by rect in this item.
void save()
Saves the current painter state (pushes the state onto a stack).
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
QDeclarativeImage(QDeclarativeItem *parent=0)
void setRenderHint(RenderHint hint, bool on=true)
Sets the given render hint on the painter if on is true; otherwise clears the render hint...
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
The QDeclarativeItem class provides the most basic of all visual items in QML.
void paintedGeometryChanged()
void updatePaintedGeometry()
void setImplicitWidth(qreal)
Sets the implied width of the item to w.
void setPixmap(const QPixmap &pix)
virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
This function is called to handle this item's changes in geometry from oldGeometry to newGeometry...
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
This function is called to handle this item's changes in geometry from oldGeometry to newGeometry...
void setPixmap(const QPixmap &)
void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset=QPointF())
Draws a tiled pixmap, inside the given rectangle with its origin at the given position.
void setRenderHints(RenderHints hints, bool on=true)
Sets the given render hints on the painter if on is true; otherwise clears the render hints...
QObject * parent() const
Returns a pointer to the parent object.
qreal paintedHeight() const
qreal paintedWidth() const
void setWorldTransform(const QTransform &matrix, bool combine=false)
Sets the world transformation matrix.
The QPixmap class is an off-screen image representation that can be used as a paint device...
QDeclarativeListProperty< QGraphicsTransform > transform()
FillMode fillMode() const
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
void setImplicitHeight(qreal)
Sets the implied height of the item to h.
virtual void pixmapChange()
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem...
void setFillMode(FillMode)