void Lens::setSearchQuery(const QString& search_query) { /* Checking for m_searchQuery.isNull() which returns true only when the string has never been set is necessary because when search_query is the empty string ("") and m_searchQuery is the null string, search_query != m_searchQuery is still true. */ if (m_searchQuery.isNull() || search_query != m_searchQuery) { m_searchQuery = search_query; m_unityLens->Search(search_query.toStdString()); Q_EMIT searchQueryChanged(); } }
void PeerListBox::createMultiSelect() { Expects(_select == nullptr); auto entity = object_ptr<Ui::MultiSelect>(this, st::contactsMultiSelect, langFactory(lng_participant_filter)); _select.create(this, std::move(entity)); _select->heightValue( ) | rpl::start_with_next( [this] { updateScrollSkips(); }, lifetime()); _select->entity()->setSubmittedCallback([this](bool chtrlShiftEnter) { content()->submitted(); }); _select->entity()->setQueryChangedCallback([this](const QString &query) { searchQueryChanged(query); }); _select->entity()->setItemRemovedCallback([this](uint64 itemId) { if (auto peer = App::peerLoaded(itemId)) { if (auto row = peerListFindRow(peer->id)) { content()->changeCheckState(row, false, PeerListRow::SetStyle::Animated); update(); } _controller->itemDeselectedHook(peer); } }); _select->resizeToWidth(st::boxWideWidth); _select->moveToLeft(0, 0); }