Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickmaterialtextcontainer_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 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 QQUICKMATERIALTEXTCONTAINER_P_H
5#define QQUICKMATERIALTEXTCONTAINER_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 <QtCore/private/qglobal_p.h>
19#include <QtGui/qcolor.h>
20#include <QtQuick/qquickpainteditem.h>
21
23
25{
27 Q_PROPERTY(bool filled READ isFilled WRITE setFilled FINAL)
38 QML_NAMED_ELEMENT(MaterialTextContainer)
40
41public:
43
44 bool isFilled() const;
45 void setFilled(bool filled);
46
47 QColor fillColor() const;
48 void setFillColor(const QColor &fillColor);
49
50 QColor outlineColor() const;
52
55
57 void setFocusAnimationProgress(qreal progress);
58
61
62 bool controlHasActiveFocus() const;
64
65 bool controlHasText() const;
67
68 bool placeholderHasText() const;
70
71 int horizontalPadding() const;
73
74 void paint(QPainter *painter) override;
75
82
83private:
84 bool shouldAnimateOutline() const;
85
86 QQuickItem *textControl() const;
87 void controlGotActiveFocus();
88 void controlLostActiveFocus();
89 void startFocusAnimation();
90
91 void maybeSetFocusAnimationProgress();
92
93 void componentComplete() override;
94
95 QColor m_fillColor;
96 QColor m_outlineColor;
97 QColor m_focusedOutlineColor;
98 qreal m_focusAnimationProgress = 0;
99 qreal m_placeholderTextWidth = 0;
100 bool m_filled = false;
101 bool m_controlHasActiveFocus = false;
102 bool m_controlHasText = false;
103 bool m_placeholderHasText = false;
104 int m_horizontalPadding = 0;
105};
106
108
109#endif // QQUICKMATERIALTEXTCONTAINER_P_H
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:64
QQuickItem * parent
\qmlproperty Item QtQuick::Item::parent This property holds the visual parent of the item.
Definition qquickitem.h:68
void setFocusedOutlineColor(const QColor &focusedOutlineColor)
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
void setOutlineColor(const QColor &outlineColor)
void setControlHasActiveFocus(bool controlHasActiveFocus)
void setControlHasText(bool controlHasText)
void setHorizontalPadding(int horizontalPadding)
void setPlaceholderTextWidth(qreal placeholderTextWidth)
void setFillColor(const QColor &fillColor)
void setPlaceholderHasText(bool placeholderHasText)
The QQuickPaintedItem class provides a way to use the QPainter API in the QML Scene Graph.
QPainter paint
Combined button and popup list for selecting options.
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define signals
double qreal
Definition qtypes.h:92
QPainter painter(this)
[7]