MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / createMultiSelect

Method createMultiSelect

Telegram/SourceFiles/boxes/peer_list_box.cpp:106–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106void PeerListBox::createMultiSelect() {
107 Expects(_select == nullptr);
108
109 auto placeholder = _controller->searchPlaceholder();
110 auto entity = object_ptr<Ui::MultiSelect>(
111 this,
112 (_controller->selectSt()
113 ? *_controller->selectSt()
114 : st::defaultMultiSelect),
115 placeholder ? std::move(placeholder) : tr::lng_participant_filter());
116 _select.create(this, std::move(entity));
117 _select->heightValue(
118 ) | rpl::on_next(
119 [this] { updateScrollSkips(); },
120 lifetime());
121 _select->entity()->setSubmittedCallback([=](Qt::KeyboardModifiers) {
122 content()->submitted();
123 });
124 _select->entity()->setQueryChangedCallback([=](const QString &query) {
125 if (_customQueryChangedCallback) {
126 _customQueryChangedCallback(query);
127 }
128 searchQueryChanged(query);
129 });
130 _select->entity()->setItemRemovedCallback([=](uint64 itemId) {
131 if (_controller->handleDeselectForeignRow(itemId)) {
132 return;
133 }
134 if (const auto peer = _controller->session().data().peerLoaded(PeerId(itemId))) {
135 if (const auto row = peerListFindRow(itemId)) {
136 content()->changeCheckState(row, false, anim::type::normal);
137 update();
138 }
139 _controller->itemDeselectedHook(peer);
140 }
141 });
142 _select->resizeToWidth(_controller->contentWidth());
143 _select->moveToLeft(0, topSelectSkip());
144}
145
146void PeerListBox::appendQueryChangedCallback(Fn<void(QString)> callback) {
147 _customQueryChangedCallback = std::move(callback);

Callers

nothing calls this directly

Calls 15

PeerIdClass · 0.85
selectStMethod · 0.80
setSubmittedCallbackMethod · 0.80
moveToLeftMethod · 0.80
updateFunction · 0.50
searchPlaceholderMethod · 0.45
createMethod · 0.45
heightValueMethod · 0.45
submittedMethod · 0.45

Tested by

no test coverage detected