1 // Commit: ac5c099cc3c5b8c7eec7a49fdeb8a21037230350
2 /****************************************************************************
4 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
5 ** All rights reserved.
6 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 ** This file is part of the QtDeclarative module of the Qt Toolkit.
10 ** $QT_BEGIN_LICENSE:LGPL$
11 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this
15 ** file. Please review the following information to ensure the GNU Lesser
16 ** General Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
23 ** GNU General Public License Usage
24 ** Alternatively, this file may be used under the terms of the GNU General
25 ** Public License version 3.0 as published by the Free Software Foundation
26 ** and appearing in the file LICENSE.GPL included in the packaging of this
27 ** file. Please review the following information to ensure the GNU General
28 ** Public License version 3.0 requirements will be met:
29 ** http://www.gnu.org/copyleft/gpl.html.
32 ** Alternatively, this file may be used in accordance with the terms and
33 ** conditions contained in a signed written agreement between you and Nokia.
41 ****************************************************************************/
43 #ifndef QQUICKIMAGE_P_H
44 #define QQUICKIMAGE_P_H
46 #include "qquickimagebase_p.h"
47 #include <private/qsgtextureprovider_p.h>
53 QT_MODULE(Declarative)
55 class QQuickImagePrivate;
56 class Q_AUTOTEST_EXPORT QQuickImage : public QQuickImageBase
63 Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
64 Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedGeometryChanged)
65 Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedGeometryChanged)
66 Q_PROPERTY(HAlignment horizontalAlignment READ horizontalAlignment WRITE setHorizontalAlignment NOTIFY horizontalAlignmentChanged)
67 Q_PROPERTY(VAlignment verticalAlignment READ verticalAlignment WRITE setVerticalAlignment NOTIFY verticalAlignmentChanged)
70 QQuickImage(QQuickItem *parent=0);
73 enum HAlignment { AlignLeft = Qt::AlignLeft,
74 AlignRight = Qt::AlignRight,
75 AlignHCenter = Qt::AlignHCenter };
76 enum VAlignment { AlignTop = Qt::AlignTop,
77 AlignBottom = Qt::AlignBottom,
78 AlignVCenter = Qt::AlignVCenter };
80 enum FillMode { Stretch, PreserveAspectFit, PreserveAspectCrop, Tile, TileVertically, TileHorizontally, Pad };
82 FillMode fillMode() const;
83 void setFillMode(FillMode);
85 qreal paintedWidth() const;
86 qreal paintedHeight() const;
88 QRectF boundingRect() const;
90 HAlignment horizontalAlignment() const;
91 void setHorizontalAlignment(HAlignment align);
93 VAlignment verticalAlignment() const;
94 void setVerticalAlignment(VAlignment align);
96 bool isTextureProvider() const { return true; }
97 QSGTextureProvider *textureProvider() const;
100 void fillModeChanged();
101 void paintedGeometryChanged();
102 void horizontalAlignmentChanged(HAlignment alignment);
103 void verticalAlignmentChanged(VAlignment alignment);
106 QQuickImage(QQuickImagePrivate &dd, QQuickItem *parent);
108 void updatePaintedGeometry();
110 virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
111 virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
114 Q_DISABLE_COPY(QQuickImage)
115 Q_DECLARE_PRIVATE(QQuickImage)
119 QML_DECLARE_TYPE(QQuickImage)
122 #endif // QQUICKIMAGE_P_H