1// Copyright (C) 2017 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 QQUICKCLIPPEDTEXT_P_H
5#define QQUICKCLIPPEDTEXT_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 <QtQuick/private/qquicktext_p.h>
19#include <QtQuickControls2Impl/private/qtquickcontrols2implglobal_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class Q_QUICKCONTROLS2IMPL_PRIVATE_EXPORT QQuickClippedText : public QQuickText
24{
25 Q_OBJECT
26 Q_PROPERTY(qreal clipX READ clipX WRITE setClipX FINAL)
27 Q_PROPERTY(qreal clipY READ clipY WRITE setClipY FINAL)
28 Q_PROPERTY(qreal clipWidth READ clipWidth WRITE setClipWidth FINAL)
29 Q_PROPERTY(qreal clipHeight READ clipHeight WRITE setClipHeight FINAL)
30 QML_NAMED_ELEMENT(ClippedText)
31 QML_ADDED_IN_VERSION(2, 2)
32
33public:
34 explicit QQuickClippedText(QQuickItem *parent = nullptr);
35
36 qreal clipX() const;
37 void setClipX(qreal x);
38
39 qreal clipY() const;
40 void setClipY(qreal y);
41
42 qreal clipWidth() const;
43 void setClipWidth(qreal width);
44
45 qreal clipHeight() const;
46 void setClipHeight(qreal height);
47
48 QRectF clipRect() const override;
49
50private:
51 void markClipDirty();
52
53 bool m_hasClipWidth = false;
54 bool m_hasClipHeight = false;
55 qreal m_clipX = 0;
56 qreal m_clipY = 0;
57 qreal m_clipWidth = 0;
58 qreal m_clipHeight = 0;
59};
60
61QT_END_NAMESPACE
62
63QML_DECLARE_TYPE(QQuickClippedText)
64
65#endif // QQUICKCLIPPEDTEXT_P_H
66

source code of qtdeclarative/src/quickcontrolsimpl/qquickclippedtext_p.h