3#include "qml_material/control/popup.hpp"
5Q_MOC_INCLUDE(
"qml_material/control/search_bar.hpp")
6Q_MOC_INCLUDE("qml_material/input/search_state.hpp")
14class QML_MATERIAL_API SearchView :
public Popup {
16 QML_NAMED_ELEMENT(SearchViewBase)
17 Q_PROPERTY(SearchBar* searchBar READ searchBar WRITE setSearchBar NOTIFY searchBarChanged FINAL)
18 Q_PROPERTY(SearchState* searchState READ searchState NOTIFY searchStateChanged FINAL)
20 QString searchText READ searchText WRITE setSearchText NOTIFY searchTextChanged FINAL)
21 Q_PROPERTY(Presentation presentation READ presentation WRITE setPresentation NOTIFY
22 presentationChanged FINAL)
23 Q_PROPERTY(QQuickItem* header READ header WRITE setHeader NOTIFY headerChanged FINAL)
25 QQuickItem* inputField READ inputField WRITE setInputField NOTIFY inputFieldChanged FINAL)
26 Q_PROPERTY(qreal expansion READ expansion WRITE setExpansion NOTIFY expansionChanged FINAL)
27 Q_PROPERTY(
bool autoShowKeyboard READ autoShowKeyboard WRITE setAutoShowKeyboard NOTIFY
28 autoShowKeyboardChanged FINAL)
36 explicit SearchView(QObject* parent =
nullptr);
37 ~SearchView()
override;
38 SearchBar* searchBar()
const;
39 void setSearchBar(SearchBar*);
40 SearchState* searchState()
const;
41 QString searchText()
const;
42 void setSearchText(
const QString&);
43 Presentation presentation()
const {
return m_presentation; }
44 void setPresentation(Presentation);
45 QQuickItem* header()
const;
46 void setHeader(QQuickItem*);
47 QQuickItem* inputField()
const {
return m_inputField; }
48 void setInputField(QQuickItem*);
49 qreal expansion()
const {
return m_expansion; }
50 void setExpansion(qreal);
51 bool autoShowKeyboard()
const {
return m_autoShowKeyboard; }
52 void setAutoShowKeyboard(
bool);
53 Q_INVOKABLE
void clear();
54 Q_INVOKABLE
void submit();
56 void close()
override;
57 Q_SIGNAL
void searchBarChanged();
58 Q_SIGNAL
void searchStateChanged();
59 Q_SIGNAL
void searchTextChanged();
60 Q_SIGNAL
void presentationChanged();
61 Q_SIGNAL
void headerChanged();
62 Q_SIGNAL
void inputFieldChanged();
63 Q_SIGNAL
void expansionChanged();
64 Q_SIGNAL
void autoShowKeyboardChanged();
65 Q_SIGNAL
void accepted();
68 void componentComplete()
override;
69 QPointF surfacePosition()
const override;
70 QSizeF surfaceSize()
const override;
71 QList<TransitionTarget> transitionTargets(
bool)
const override;
72 void finalizeTransition(
bool)
override;
76 QRectF originRect()
const;
79 QPointer<SearchBar> m_bar;
80 SearchState* m_defaultState;
81 QPointer<QQuickItem> m_inputField;
82 QList<QMetaObject::Connection> m_barConnections;
83 QMetaObject::Connection m_queryConnection, m_inputConnection;
84 Presentation m_presentation = Docked;
85 qreal m_expansion = 0;
86 bool m_autoShowKeyboard =
true, m_componentComplete =
false, m_initialRequest =
false;
87 quint64 m_revision = 0;