7#include <private/qquickindicatorbutton_p.h>
8#include <QtQuickTemplates2/private/qquicktextfield_p.h>
11#include <private/qqmldelegatemodel_p.h>
15#include <QtQml/qqmlcomponent.h>
16#include <QtGui/qtextdocument.h>
17#include <QtQuick/private/qquickaccessibleattached_p.h>
18#if QT_CONFIG(quick_itemview)
19# include <QtQuick/private/qquickitemview_p.h>
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
133
134
135
136
137
138
139
140
141
142
146
147
148
149
150
151
152
153
154
157
158
159
160
161
162
163
164
165
166
167
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
187
188
189
190
191
192
193
196
197
198
199
200
201
204
205
206
207
208
209
219 Q_DECLARE_PUBLIC(QQuickSearchField)
264 static inline QString
popupName() {
return QStringLiteral(
"popup"); }
296 return popup && popup->isVisible();
304 if (popup && !popup->isVisible())
310 Q_Q(QQuickSearchField);
315 emit q->activated(highlightedIndex);
317 if (popup && popup->isVisible())
326 qCDebug(lcItemManagement) <<
"hiding old popup" << popup;
328 popup->setVisible(
false);
329 popup->setParentItem(
nullptr);
330#if QT_CONFIG(accessibility)
332 QQuickAccessibleAttached *accessible = accessibleAttached(popup);
334 accessible->setIgnored(
true);
340 if (isPopupVisible())
341 QGuiApplication::inputMethod()->reset();
343#if QT_CONFIG(quick_itemview)
344 QQuickItemView *itemView = popup->findChild<QQuickItemView *>();
346 itemView->setHighlightRangeMode(QQuickItemView::NoHighlightRange);
351#if QT_CONFIG(quick_itemview)
353 itemView->positionViewAtIndex(highlightedIndex, QQuickItemView::Beginning);
359 Q_Q(QQuickSearchField);
361 emit q->popupChanged();
366 Q_Q(QQuickSearchField);
376 Q_Q(QQuickSearchField);
378 QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(q->sender());
379 if (!button || !button->isHovered() || !button->isEnabled()
380 || QQuickAbstractButtonPrivate::get(button)->touchId != -1)
387#if QT_CONFIG(quick_itemview)
388 if (QQuickItemView *itemView = popup->findChild<QQuickItemView *>())
389 itemView->positionViewAtIndex(index, QQuickItemView::Contain);
396 Q_Q(QQuickSearchField);
397 QQuickItem *item = qobject_cast<QQuickItem *>(object);
398 if (item && !item->parentItem()) {
400 item->setParentItem(popup->contentItem());
402 item->setParentItem(q);
403 QQuickItemPrivate::get(item)->setCulled(
true);
406 QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(object);
408 button->setFocusPolicy(Qt::NoFocus);
409 connect(button, &QQuickAbstractButton::clicked,
this,
411 connect(button, &QQuickAbstractButton::hoveredChanged,
this,
415 if (!textFormat && !textFormatWarningDisplayed && Qt::mightBeRichText(textAt(index))) {
423 Q_Q(QQuickSearchField);
425 if (q->suggestionCount() == 0) {
428 emit q->suggestionCountChanged();
434 if (!text.isEmpty()) {
435 for (
int idx = 0; idx < q->suggestionCount(); ++idx) {
436 if (textAt(idx) == text) {
444 emit q->suggestionCountChanged();
449 Q_Q(QQuickSearchField);
451 if (highlightedIndex < q->suggestionCount() - 1)
466 Q_Q(QQuickSearchField);
471 emit q->currentIndexChanged();
476 Q_Q(QQuickSearchField);
481 emit q->currentIndexChanged();
486 emit q->activated(index);
491 Q_Q(QQuickSearchField);
497 else if (q->suggestionCount() > 0)
506 Q_Q(QQuickSearchField);
511 emit q->highlightedIndexChanged();
514 emit q->highlighted(index);
519 Q_Q(QQuickSearchField);
524 const QQuickTextInput *input = qobject_cast<QQuickTextInput *>(contentItem);
528 const int pos = input->cursorPosition();
533 emit q->cursorPositionChanged();
538 Q_Q(QQuickSearchField);
543 disconnect(
delegateModel, &QQmlInstanceModel::countChanged,
this,
545 disconnect(
delegateModel, &QQmlInstanceModel::createdItem,
this,
550 delegateModel = suggestionModel.value<QQmlInstanceModel *>();
552 if (!delegateModel && suggestionModel.isValid()) {
553 QQmlDelegateModel *dataModel =
new QQmlDelegateModel(qmlContext(q), q);
554 dataModel->setModel(suggestionModel);
556 if (q->isComponentComplete())
557 dataModel->componentComplete();
564 connect(
delegateModel, &QQmlInstanceModel::countChanged,
this,
566 connect(
delegateModel, &QQmlInstanceModel::createdItem,
this,
570 emit q->delegateModelChanged();
578 return textRole.isEmpty() ? QStringLiteral(
"modelData") : textRole;
583 Q_Q(QQuickSearchField);
584 QQuickTextInput *input = qobject_cast<QQuickTextInput *>(contentItem);
588 const QString textInput = input->text();
590 if (text != textInput) {
591 q->setText(textInput);
592 emit q->textEdited();
598 emit q->searchTriggered();
601 if (text.isEmpty()) {
617 Q_Q(QQuickSearchField);
621 const QString currentText = textAt(currentIndex);
622 if (text != currentText)
623 q->setText(currentText);
641 Q_Q(QQuickSearchField);
642 quickCancelDeferred(q, popupName());
647 Q_Q(QQuickSearchField);
648 if (popup.wasExecuted())
651 if (!popup || complete)
652 quickBeginDeferred(q, popupName(), popup);
654 quickCompleteDeferred(q, popupName(), popup);
659 Q_Q(QQuickSearchField);
660 QQuickControlPrivate::handlePress(point, timestamp);
664 const bool isSearch = si && si->isEnabled() && si->contains(q->mapToItem(si, point));
665 const bool isClear = ci && ci->isEnabled() && ci->contains(q->mapToItem(ci, point));
670 }
else if (isClear) {
680 QQuickControlPrivate::handleRelease(point, timestamp);
690 Q_Q(QQuickSearchField);
692 QQuickTextInput *input = qobject_cast<QQuickTextInput *>(contentItem);
696 input->forceActiveFocus();
697 emit q->searchButtonPressed();
702 Q_Q(QQuickSearchField);
708 if (!text.isEmpty()) {
711 q->setText(QString());
716 emit q->clearButtonPressed();
722 QQuickControlPrivate::itemImplicitWidthChanged(item);
724 emit searchIndicator->implicitIndicatorWidthChanged();
726 emit clearIndicator->implicitIndicatorWidthChanged();
731 QQuickControlPrivate::itemImplicitHeightChanged(item);
733 emit searchIndicator->implicitIndicatorHeightChanged();
735 emit clearIndicator->implicitIndicatorHeightChanged();
740 QQuickControlPrivate::itemDestroyed(item);
747QQuickSearchField::QQuickSearchField(QQuickItem *parent)
748 : QQuickControl(*(
new QQuickSearchFieldPrivate), parent)
750 Q_D(QQuickSearchField);
751 d->searchIndicator =
new QQuickIndicatorButton(
this);
752 d->clearIndicator =
new QQuickIndicatorButton(
this);
754 setFocusPolicy(Qt::StrongFocus);
755 setFlag(QQuickItem::ItemIsFocusScope);
756 setAcceptedMouseButtons(Qt::LeftButton);
758 setCursor(Qt::ArrowCursor);
764QQuickSearchField::~QQuickSearchField()
766 Q_D(QQuickSearchField);
767 d->removeImplicitSizeListener(d->searchIndicator->indicator());
768 d->removeImplicitSizeListener(d->clearIndicator->indicator());
771 QObjectPrivate::disconnect(d->popup.data(), &QQuickPopup::visibleChanged, d,
772 &QQuickSearchFieldPrivate::popupVisibleChanged);
773 d->hideOldPopup(d->popup);
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
797QVariant QQuickSearchField::suggestionModel()
const
799 Q_D(
const QQuickSearchField);
800 return d->suggestionModel;
803void QQuickSearchField::setSuggestionModel(
const QVariant &model)
805 Q_D(QQuickSearchField);
807 QVariant suggestionModel;
808 if (QJSValue *value = get_if<QJSValue>(&suggestionModel))
809 suggestionModel = value->toVariant();
811 suggestionModel = model;
813 if (d->suggestionModel == suggestionModel)
816 d->suggestionModel = suggestionModel;
817 d->createDelegateModel();
818 emit suggestionCountChanged();
819 emit suggestionModelChanged();
823
824
825
826
827
828
829
830
831
832QQmlInstanceModel *QQuickSearchField::delegateModel()
const
834 Q_D(
const QQuickSearchField);
835 return d->delegateModel;
839
840
841
842
843
844int QQuickSearchField::suggestionCount()
const
846 Q_D(
const QQuickSearchField);
847 return d->delegateModel ? d->delegateModel->count() : 0;
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868int QQuickSearchField::currentIndex()
const
870 Q_D(
const QQuickSearchField);
871 return d->currentIndex;
874void QQuickSearchField::setCurrentIndex(
int index)
876 Q_D(QQuickSearchField);
877 d->hasCurrentIndex =
true;
878 d->setCurrentIndex(index);
882
883
884
885
886
887
888
889
890
891
892
893
894int QQuickSearchField::highlightedIndex()
const
896 Q_D(
const QQuickSearchField);
897 return d->highlightedIndex;
901
902
903
904
905
906
907
908
909QString QQuickSearchField::text()
const
911 Q_D(
const QQuickSearchField);
915void QQuickSearchField::setText(
const QString &text)
917 Q_D(QQuickSearchField);
926
927
928
929
930
931
932
933
934QString QQuickSearchField::textRole()
const
936 Q_D(
const QQuickSearchField);
940void QQuickSearchField::setTextRole(
const QString &textRole)
942 Q_D(QQuickSearchField);
943 if (d->textRole == textRole)
946 d->textRole = textRole;
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964QQuickText::TextFormat QQuickSearchField::textFormat()
const
966 Q_D(
const QQuickSearchField);
967 return d->textFormat.value_or(QQuickText::AutoText);
970void QQuickSearchField::setTextFormat(QQuickText::TextFormat textFormat)
972 Q_D(QQuickSearchField);
973 const bool changed = textFormat !=
this->textFormat();
974 d->textFormat = textFormat;
976 emit textFormatChanged();
979void QQuickSearchField::resetTextFormat()
981 Q_D(QQuickSearchField);
982 const bool changed = textFormat() != QQuickText::AutoText;
983 d->textFormat.reset();
985 emit textFormatChanged();
989
990
991
992
993
994
995
996
997
998
999
1000
1002bool QQuickSearchField::isLive()
const
1004 Q_D(
const QQuickSearchField);
1008void QQuickSearchField::setLive(
const bool live)
1010 Q_D(QQuickSearchField);
1012 if (d->live == live)
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031QQuickIndicatorButton *QQuickSearchField::searchIndicator()
const
1033 Q_D(
const QQuickSearchField);
1034 return d->searchIndicator;
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050QQuickIndicatorButton *QQuickSearchField::clearIndicator()
const
1052 Q_D(
const QQuickSearchField);
1053 return d->clearIndicator;
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068QQuickPopup *QQuickSearchField::popup()
const
1070 QQuickSearchFieldPrivate *d =
const_cast<QQuickSearchFieldPrivate *>(d_func());
1072 d->executePopup(isComponentComplete());
1076void QQuickSearchField::setPopup(QQuickPopup *popup)
1078 Q_D(QQuickSearchField);
1079 if (d->popup == popup)
1082 if (!d->popup.isExecuting())
1086 QObjectPrivate::disconnect(d->popup.data(), &QQuickPopup::destroyed, d,
1087 &QQuickSearchFieldPrivate::popupDestroyed);
1088 QObjectPrivate::disconnect(d->popup.data(), &QQuickPopup::visibleChanged, d,
1089 &QQuickSearchFieldPrivate::popupVisibleChanged);
1090 QQuickSearchFieldPrivate::hideOldPopup(d->popup);
1094#if QT_CONFIG(wayland)
1095 QQuickPopupPrivate::get(popup)->extendedWindowType = QNativeInterface::Private::QWaylandWindow::ComboBox;
1098 QQuickPopupPrivate::get(popup)->wmWindowType = QNativeInterface::Private::QXcbWindow::Combo;
1100 QQuickPopupPrivate::get(popup)->allowVerticalFlip =
true;
1101 popup->setClosePolicy(QQuickPopup::CloseOnEscape | QQuickPopup::CloseOnPressOutsideParent);
1102 QObjectPrivate::connect(popup, &QQuickPopup::visibleChanged, d,
1103 &QQuickSearchFieldPrivate::popupVisibleChanged);
1106 QObjectPrivate::connect(popup, &QQuickPopup::destroyed, d,
1107 &QQuickSearchFieldPrivate::popupDestroyed);
1109#if QT_CONFIG(quick_itemview)
1110 if (QQuickItemView *itemView = popup->findChild<QQuickItemView *>())
1111 itemView->setHighlightRangeMode(QQuickItemView::NoHighlightRange);
1116 if (!d->popup.isExecuting())
1117 emit popupChanged();
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143QQmlComponent *QQuickSearchField::delegate()
const
1145 Q_D(
const QQuickSearchField);
1149void QQuickSearchField::setDelegate(QQmlComponent *delegate)
1151 Q_D(QQuickSearchField);
1152 if (d->delegate == delegate)
1155 d->delegate = delegate;
1156 QQmlDelegateModel *delegateModel = qobject_cast<QQmlDelegateModel *>(d->delegateModel);
1158 delegateModel->setDelegate(d->delegate);
1159 emit delegateChanged();
1163
1164
1165
1166
1167
1168
1169QString QQuickSearchField::placeholderText()
const
1171 Q_D(
const QQuickSearchField);
1172 return d->placeholderText;
1175void QQuickSearchField::setPlaceholderText(
const QString &text)
1177 Q_D(QQuickSearchField);
1178 if (d->placeholderText == text)
1181 d->placeholderText = text;
1182 emit placeholderTextChanged();
1186
1187
1188
1189
1190
1191
1192
1193bool QQuickSearchField::selectTextByMouse()
const
1195 Q_D(
const QQuickSearchField);
1196 return d->selectTextByMouse;
1199void QQuickSearchField::setSelectTextByMouse(
const bool selectable)
1201 Q_D(QQuickSearchField);
1202 if (d->selectTextByMouse == selectable)
1205 d->selectTextByMouse = selectable;
1206 emit selectTextByMouseChanged();
1210
1211
1212
1213
1214
1215
1216QString QQuickSearchField::selectedText()
const
1218 Q_D(
const QQuickSearchField);
1219 QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem);
1222 return input->selectedText();
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237int QQuickSearchField::selectionStart()
const
1239 Q_D(
const QQuickSearchField);
1240 QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem);
1243 return input->selectionStart();
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258int QQuickSearchField::selectionEnd()
const
1260 Q_D(
const QQuickSearchField);
1261 QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem);
1264 return input->selectionEnd();
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281int QQuickSearchField::cursorPosition()
const
1283 Q_D(
const QQuickSearchField);
1284 return d->cursorPosition;
1287void QQuickSearchField::setCursorPosition(
int position)
1289 Q_D(QQuickSearchField);
1290 if (d->cursorPosition == position)
1293 d->cursorPosition = position;
1295 if (QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem)) {
1296 if (input->cursorPosition() != position)
1297 input->setCursorPosition(position);
1300 emit cursorPositionChanged();
1304
1305
1306
1307
1308
1309void QQuickSearchField::selectAll()
1311 Q_D(QQuickSearchField);
1312 QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem);
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332void QQuickSearchField::select(
int start,
int end)
1334 Q_D(QQuickSearchField);
1335 QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem);
1338 input->select(start, end);
1342
1343
1344
1345
1346
1347
1348
1349void QQuickSearchField::selectWord()
1351 Q_D(QQuickSearchField);
1352 QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem);
1355 input->selectWord();
1359
1360
1361
1362
1363
1364
1365
1366void QQuickSearchField::deselect()
1368 Q_D(QQuickSearchField);
1369 QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem);
1375bool QQuickSearchField::eventFilter(QObject *object, QEvent *event)
1377 Q_D(QQuickSearchField);
1379 switch (event->type()) {
1380 case QEvent::MouseButtonRelease: {
1381 QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem);
1382 if (input->hasFocus() && !d->text.isEmpty() && !d->isPopupVisible()
1383 && (d->delegateModel && d->delegateModel->count() > 0)
1384 &&
static_cast<QMouseEvent*>(event)->button() == Qt::LeftButton) {
1389 case QEvent::FocusOut: {
1390 const bool hasActiveFocus = d->popup && d->popup->hasActiveFocus();
1391 const bool usingPopupWindows =
1392 d->popup ? QQuickPopupPrivate::get(d->popup)->usePopupWindow() :
false;
1393 if (qGuiApp->focusObject() !=
this && !(hasActiveFocus && !usingPopupWindows))
1394 d->hidePopup(
false);
1401 return QQuickControl::eventFilter(object, event);
1404void QQuickSearchField::focusInEvent(QFocusEvent *event)
1406 Q_D(QQuickSearchField);
1407 QQuickControl::focusInEvent(event);
1409 if (!d->contentItem)
1412 const auto reason = event->reason();
1414 case Qt::TabFocusReason:
1415 case Qt::BacktabFocusReason:
1416 case Qt::ShortcutFocusReason:
1417 case Qt::OtherFocusReason:
1418 if (reason != Qt::OtherFocusReason || !d->isPopupVisible())
1419 d->contentItem->forceActiveFocus(reason);
1426void QQuickSearchField::focusOutEvent(QFocusEvent *event)
1428 Q_D(QQuickSearchField);
1429 QQuickControl::focusOutEvent(event);
1431 const bool hasActiveFocus = d->popup && d->popup->hasActiveFocus();
1432 const bool usingPopupWindows = d->popup && QQuickPopupPrivate::get(d->popup)->usePopupWindow();
1434 if (qGuiApp->focusObject() != d->contentItem && !(hasActiveFocus && !usingPopupWindows))
1435 d->hidePopup(
false);
1438void QQuickSearchField::hoverEnterEvent(QHoverEvent *event)
1440 Q_D(QQuickSearchField);
1441 QQuickControl::hoverEnterEvent(event);
1442 QQuickItem *si = d->searchIndicator->indicator();
1443 QQuickItem *ci = d->clearIndicator->indicator();
1444 d->searchIndicator->setHovered(si && si->isEnabled() && si->contains(mapToItem(si, event->position())));
1445 d->clearIndicator->setHovered(ci && ci->isEnabled() && ci->contains(mapToItem(ci, event->position())));
1449void QQuickSearchField::hoverMoveEvent(QHoverEvent *event)
1451 Q_D(QQuickSearchField);
1452 QQuickControl::hoverMoveEvent(event);
1453 QQuickItem *si = d->searchIndicator->indicator();
1454 QQuickItem *ci = d->clearIndicator->indicator();
1455 d->searchIndicator->setHovered(si && si->isEnabled() && si->contains(mapToItem(si, event->position())));
1456 d->clearIndicator->setHovered(ci && ci->isEnabled() && ci->contains(mapToItem(ci, event->position())));
1460void QQuickSearchField::hoverLeaveEvent(QHoverEvent *event)
1462 Q_D(QQuickSearchField);
1463 QQuickControl::hoverLeaveEvent(event);
1464 d->searchIndicator->setHovered(
false);
1465 d->clearIndicator->setHovered(
false);
1469void QQuickSearchField::keyPressEvent(QKeyEvent *event)
1471 Q_D(QQuickSearchField);
1473 const auto key = event->key();
1474 const bool hasModel = !d->suggestionModel.isNull();
1475 const bool hasText = !d->text.isEmpty();
1478 case Qt::Key_Escape:
1480 if (d->isPopupVisible()) {
1481 d->hidePopup(
false);
1483 }
else if (hasText) {
1488 case Qt::Key_Return:
1490 if (d->isPopupVisible())
1493 emit searchTriggered();
1498 d->decreaseCurrentIndex();
1504 d->increaseCurrentIndex();
1509 if (d->isPopupVisible()) {
1510 d->setHighlightedIndex(0, Highlight);
1515 if (d->isPopupVisible()) {
1516 d->setHighlightedIndex(suggestionCount() - 1, Highlight);
1521 QQuickControl::keyPressEvent(event);
1526void QQuickSearchField::classBegin()
1528 Q_D(QQuickSearchField);
1529 QQuickControl::classBegin();
1531 QQmlContext *context = qmlContext(
this);
1533 QQmlEngine::setContextForObject(d->searchIndicator, context);
1534 QQmlEngine::setContextForObject(d->clearIndicator, context);
1538void QQuickSearchField::componentComplete()
1540 Q_D(QQuickSearchField);
1541 QQuickIndicatorButtonPrivate::get(d->searchIndicator)->executeIndicator(
true);
1542 QQuickIndicatorButtonPrivate::get(d->clearIndicator)->executeIndicator(
true);
1543 QQuickControl::componentComplete();
1546 d->executePopup(
true);
1548 if (d->delegateModel && d->ownModel)
1549 static_cast<QQmlDelegateModel *>(d->delegateModel)->componentComplete();
1552void QQuickSearchField::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
1554 Q_D(QQuickSearchField);
1556 oldItem->removeEventFilter(
this);
1557 if (QQuickTextInput *oldInput = qobject_cast<QQuickTextInput *>(oldItem)) {
1558 QObjectPrivate::disconnect(oldInput, &QQuickTextInput::textChanged, d,
1559 &QQuickSearchFieldPrivate::updateText);
1560 QObjectPrivate::disconnect(oldInput, &QQuickTextInput::cursorPositionChanged,
1561 d, &QQuickSearchFieldPrivate::updateCursorPosition);
1566 newItem->installEventFilter(
this);
1567 if (QQuickTextInput *newInput = qobject_cast<QQuickTextInput *>(newItem)) {
1568 QObjectPrivate::connect(newInput, &QQuickTextInput::textChanged, d,
1569 &QQuickSearchFieldPrivate::updateText);
1570 QObjectPrivate::connect(newInput, &QQuickTextInput::cursorPositionChanged,
1571 d, &QQuickSearchFieldPrivate::updateCursorPosition);
1573 #if QT_CONFIG(cursor)
1574 newItem->setCursor(Qt::IBeamCursor);
1579void QQuickSearchField::itemChange(ItemChange change,
const ItemChangeData &data)
1581 Q_D(QQuickSearchField);
1582 QQuickControl::itemChange(change, data);
1583 if (change == ItemVisibleHasChanged && !data.boolValue) {
1584 d->hidePopup(
false);
1585 d->setCurrentItemAtIndex(-1, NoActivate);
1591#include "moc_qquicksearchfield_p.cpp"
void createdItem(int index, QObject *object)
QQuickIndicatorButton * clearIndicator
bool handleRelease(const QPointF &point, ulong timestamp) override
void suggestionCountChanged()
std::optional< QQuickText::TextFormat > textFormat
void decreaseCurrentIndex()
void setCurrentIndex(int index)
void itemDestroyed(QQuickItem *item) override
void hidePopup(bool accept)
bool isValidIndex(int index) const
static void hideOldPopup(QQuickPopup *popup)
QQuickDeferredPointer< QQuickPopup > popup
void itemImplicitWidthChanged(QQuickItem *item) override
bool isPopupVisible() const
void itemImplicitHeightChanged(QQuickItem *item) override
void popupVisibleChanged()
static QString popupName()
void setCurrentItemAtIndex(int index, Activation activate)
bool handlePress(const QPointF &point, ulong timestamp) override
void increaseCurrentIndex()
void createDelegateModel()
void setHighlightedIndex(int index, Highlighting highlight)
QString currentTextRole() const
bool textFormatWarningDisplayed
QString textAt(int index) const
void executePopup(bool complete=false)
void updateCursorPosition()
QQmlInstanceModel * delegateModel
QQuickIndicatorButton * searchIndicator
void updateHighlightedIndex()
Combined button and popup list for selecting options.