Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickclippedtext.cpp
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
6
7#include <QtQuick/private/qquickitem_p.h>
8
10
11QQuickClippedText::QQuickClippedText(QQuickItem *parent)
12 : QQuickText(parent)
13{
14}
15
16qreal QQuickClippedText::clipX() const
17{
18 return m_clipX;
19}
20
21void QQuickClippedText::setClipX(qreal x)
22{
23 if (qFuzzyCompare(x, m_clipX))
24 return;
25
26 m_clipX = x;
27 markClipDirty();
28}
29
30qreal QQuickClippedText::clipY() const
31{
32 return m_clipY;
33}
34
35void QQuickClippedText::setClipY(qreal y)
36{
37 if (qFuzzyCompare(y, m_clipY))
38 return;
39
40 m_clipY = y;
41 markClipDirty();
42}
43
44qreal QQuickClippedText::clipWidth() const
45{
46 return m_clipWidth ? m_clipWidth : width();
47}
48
49void QQuickClippedText::setClipWidth(qreal width)
50{
51 m_hasClipWidth = true;
52 if (qFuzzyCompare(width, m_clipWidth))
53 return;
54
55 m_clipWidth = width;
56 markClipDirty();
57}
58
59qreal QQuickClippedText::clipHeight() const
60{
61 return m_clipHeight ? m_clipHeight : height();
62}
63
64void QQuickClippedText::setClipHeight(qreal height)
65{
66 m_hasClipHeight = true;
67 if (qFuzzyCompare(height, m_clipHeight))
68 return;
69
70 m_clipHeight = height;
71 markClipDirty();
72}
73
74QRectF QQuickClippedText::clipRect() const
75{
76 return QRectF(clipX(), clipY(), clipWidth(), clipHeight());
77}
78
79void QQuickClippedText::markClipDirty()
80{
81 QQuickItemPrivate::get(this)->dirty(QQuickItemPrivate::Size);
82}
83
84QT_END_NAMESPACE
85
86#include "moc_qquickclippedtext_p.cpp"