Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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)
39 QML_NAMED_ELEMENT(MaterialTextContainer)
41
42public:
44
52
53 bool isFilled() const;
54 void setFilled(bool filled);
55
56 QColor fillColor() const;
57 void setFillColor(const QColor &fillColor);
58
59 QColor outlineColor() const;
61
64
66 void setFocusAnimationProgress(qreal progress);
67
70
71 bool controlHasActiveFocus() const;
73
74 bool controlHasText() const;
76
77 bool placeholderHasText() const;
79
80 int horizontalPadding() const;
82
83 void paint(QPainter *painter) override;
84
86 void setPlaceholderTextHAlign(PlaceHolderHAlignment placeHolderTextHAlign);
87
94
95private:
96 bool shouldAnimateOutline() const;
97
98 QQuickItem *textControl() const;
99 void controlGotActiveFocus();
100 void controlLostActiveFocus();
101 void startFocusAnimation();
102
103 void maybeSetFocusAnimationProgress();
104
105 void componentComplete() override;
106
107 QColor m_fillColor;
108 QColor m_outlineColor;
109 QColor m_focusedOutlineColor;
110 qreal m_focusAnimationProgress = 0;
111 qreal m_placeholderTextWidth = 0;
112 bool m_filled = false;
113 bool m_controlHasActiveFocus = false;
114 bool m_controlHasText = false;
115 bool m_placeholderHasText = false;
116 int m_horizontalPadding = 0;
117 PlaceHolderHAlignment m_placeholderTextHAlign;
118};
119
121
122#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:63
QQuickItem * parent
\qmlproperty Item QtQuick::Item::parent This property holds the visual parent of the item.
Definition qquickitem.h:67
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 setPlaceholderTextHAlign(PlaceHolderHAlignment placeHolderTextHAlign)
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.
@ AlignRight
Definition qnamespace.h:146
@ AlignJustify
Definition qnamespace.h:149
@ AlignHCenter
Definition qnamespace.h:148
@ AlignLeft
Definition qnamespace.h:144
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define signals
double qreal
Definition qtypes.h:187
#define explicit
QPainter painter(this)
[7]