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_H
5#define QQUICKBORDERIMAGE_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.h"
19
20QT_BEGIN_NAMESPACE
21
22class QQuickScaleGrid;
23class QQuickGridScaledImage;
24class QQuickBorderImagePrivate;
25class Q_QUICK_PRIVATE_EXPORT QQuickBorderImage : public QQuickImageBase
26{
27 Q_OBJECT
28
29 Q_PROPERTY(QQuickScaleGrid *border READ border CONSTANT FINAL)
30 Q_PROPERTY(TileMode horizontalTileMode READ horizontalTileMode WRITE setHorizontalTileMode NOTIFY horizontalTileModeChanged FINAL)
31 Q_PROPERTY(TileMode verticalTileMode READ verticalTileMode WRITE setVerticalTileMode NOTIFY verticalTileModeChanged FINAL)
32 // read-only for BorderImage
33 Q_PROPERTY(QSize sourceSize READ sourceSize NOTIFY sourceSizeChanged FINAL)
34 QML_NAMED_ELEMENT(BorderImage)
35 QML_ADDED_IN_VERSION(2, 0)
36
37public:
38 QQuickBorderImage(QQuickItem *parent=nullptr);
39 ~QQuickBorderImage();
40
41 QQuickScaleGrid *border();
42
43 enum TileMode { Stretch = Qt::StretchTile, Repeat = Qt::RepeatTile, Round = Qt::RoundTile };
44 Q_ENUM(TileMode)
45
46 TileMode horizontalTileMode() const;
47 void setHorizontalTileMode(TileMode);
48
49 TileMode verticalTileMode() const;
50 void setVerticalTileMode(TileMode);
51
52 void setSource(const QUrl &url) override;
53
54Q_SIGNALS:
55 void horizontalTileModeChanged();
56 void verticalTileModeChanged();
57 void sourceSizeChanged();
58
59protected:
60 void load() override;
61 void pixmapChange() override;
62 QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
63
64private:
65 void setGridScaledImage(const QQuickGridScaledImage& sci);
66
67private Q_SLOTS:
68 void doUpdate();
69 void requestFinished() override;
70#if QT_CONFIG(qml_network)
71 void sciRequestFinished();
72#endif
73
74private:
75 Q_DISABLE_COPY(QQuickBorderImage)
76 Q_DECLARE_PRIVATE(QQuickBorderImage)
77};
78
79QT_END_NAMESPACE
80QML_DECLARE_TYPE(QQuickBorderImage)
81
82#endif // QQUICKBORDERIMAGE_P_H
83

source code of qtdeclarative/src/quick/items/qquickborderimage_p.h