1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QQUICKBORDERIMAGE_P_P_H |
5 | #define QQUICKBORDERIMAGE_P_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include "qquickimagebase_p_p.h" |
19 | #include "qquickscalegrid_p_p.h" |
20 | |
21 | #include <private/qqmlglobal_p.h> |
22 | |
23 | QT_BEGIN_NAMESPACE |
24 | |
25 | #if QT_CONFIG(qml_network) |
26 | class QNetworkReply; |
27 | #endif |
28 | class QQuickBorderImagePrivate : public QQuickImageBasePrivate |
29 | { |
30 | Q_DECLARE_PUBLIC(QQuickBorderImage) |
31 | |
32 | public: |
33 | QQuickBorderImagePrivate() |
34 | : border(0), horizontalTileMode(QQuickBorderImage::Stretch), |
35 | verticalTileMode(QQuickBorderImage::Stretch), pixmapChanged(false) |
36 | #if QT_CONFIG(qml_network) |
37 | , sciReply(0), redirectCount(0) |
38 | #endif |
39 | { |
40 | } |
41 | |
42 | ~QQuickBorderImagePrivate() |
43 | { |
44 | } |
45 | |
46 | |
47 | QQuickScaleGrid *getScaleGrid() |
48 | { |
49 | Q_Q(QQuickBorderImage); |
50 | if (!border) { |
51 | border = new QQuickScaleGrid(q); |
52 | qmlobject_connect(border, QQuickScaleGrid, SIGNAL(borderChanged()), |
53 | q, QQuickBorderImage, SLOT(doUpdate())); |
54 | } |
55 | return border; |
56 | } |
57 | |
58 | static void calculateRects(const QQuickScaleGrid *border, |
59 | const QSize &sourceSize, |
60 | const QSizeF &targetSize, |
61 | int horizontalTileMode, |
62 | int verticalTileMode, |
63 | qreal devicePixelRatio, |
64 | QRectF *targetRect, |
65 | QRectF *innerTargetRect, |
66 | QRectF *innerSourceRect, |
67 | QRectF *subSourceRect); |
68 | |
69 | QQuickScaleGrid *border; |
70 | QUrl sciurl; |
71 | QQuickBorderImage::TileMode horizontalTileMode; |
72 | QQuickBorderImage::TileMode verticalTileMode; |
73 | bool pixmapChanged : 1; |
74 | |
75 | #if QT_CONFIG(qml_network) |
76 | QNetworkReply *sciReply; |
77 | int redirectCount; |
78 | #endif |
79 | }; |
80 | |
81 | QT_END_NAMESPACE |
82 | |
83 | #endif // QQUICKBORDERIMAGE_P_P_H |
84 | |