blob: 89fcd6dda3ac9a43343f3e02a5fe8413e5e142d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKSEARCHFIELD_P_H
#define QQUICKSEARCHFIELD_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtQuickTemplates2/private/qquickcontrol_p.h>
QT_BEGIN_NAMESPACE
class QQuickSearchFieldPrivate;
class QQuickTextField;
class QQuickPopup;
class QQmlInstanceModel;
class QQuickIndicatorButton;
class Q_QUICKTEMPLATES2_EXPORT QQuickSearchField : public QQuickControl
{
Q_OBJECT
Q_PROPERTY(QVariant suggestionModel READ suggestionModel WRITE setSuggestionModel
NOTIFY suggestionModelChanged FINAL)
Q_PROPERTY(QQmlInstanceModel *delegateModel READ delegateModel NOTIFY delegateModelChanged FINAL)
Q_PROPERTY(int suggestionCount READ suggestionCount NOTIFY suggestionCountChanged FINAL)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged
FINAL)
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
Q_PROPERTY(QString textRole READ textRole WRITE setTextRole NOTIFY textRoleChanged FINAL)
Q_PROPERTY(bool live READ isLive WRITE setLive NOTIFY liveChanged)
Q_PROPERTY(QQuickIndicatorButton *searchIndicator READ searchIndicator CONSTANT FINAL)
Q_PROPERTY(QQuickIndicatorButton *clearIndicator READ clearIndicator CONSTANT FINAL)
Q_PROPERTY(QQuickPopup *popup READ popup WRITE setPopup NOTIFY popupChanged FINAL)
Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
QML_NAMED_ELEMENT(SearchField)
QML_ADDED_IN_VERSION(6, 10)
public:
explicit QQuickSearchField(QQuickItem *parent = nullptr);
~QQuickSearchField();
QVariant suggestionModel() const;
void setSuggestionModel(const QVariant &model);
QQmlInstanceModel *delegateModel() const;
int suggestionCount() const;
int currentIndex() const;
void setCurrentIndex(int index);
QString text() const;
void setText(const QString &text);
QString textRole() const;
void setTextRole(const QString &textRole);
bool isLive() const;
void setLive(const bool live);
QQuickIndicatorButton *searchIndicator() const;
QQuickIndicatorButton *clearIndicator() const;
QQuickPopup *popup() const;
void setPopup(QQuickPopup *popup);
QQmlComponent *delegate() const;
void setDelegate(QQmlComponent *delegate);
Q_SIGNALS:
void activated(int index);
void accepted();
void searchTriggered();
void textEdited();
void suggestionModelChanged();
void delegateModelChanged();
void suggestionCountChanged();
void currentIndexChanged();
void textChanged();
void textRoleChanged();
void liveChanged();
void popupChanged();
void delegateChanged();
void searchButtonPressed();
void clearButtonPressed();
protected:
bool eventFilter(QObject *object, QEvent *event) override;
void focusInEvent(QFocusEvent *event) override;
void focusOutEvent(QFocusEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
void classBegin() override;
void componentComplete() override;
void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) override;
private:
Q_DISABLE_COPY(QQuickSearchField)
Q_DECLARE_PRIVATE(QQuickSearchField)
};
QT_END_NAMESPACE
#endif // QQUICKSEARCHFIELD_P_H
|