Fix invisible chat type filter.

This commit is contained in:
John Preston 2025-01-16 17:51:38 +04:00
parent 9db2502cd0
commit 0523ae705a
2 changed files with 9 additions and 2 deletions

View file

@ -1199,6 +1199,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
p.translate(0, (_previewResults.size() - to) * _st->height);
}
}
if (!_searchResults.empty()) {
const auto text = showUnreadInSearchResults
? u"Search results"_q
@ -1215,7 +1216,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
const auto filterFont = filterOver
? st::searchedBarFont->underline()
: st::searchedBarFont;
if (_searchState.tab == ChatSearchTab::MyMessages) {
if (hasChatTypeFilter()) {
const auto text = ChatTypeFilterLabel(_searchState.filter);
if (!_chatTypeFilterWidth) {
_chatTypeFilterWidth = filterFont->width(text);
@ -1747,7 +1748,7 @@ void InnerWidget::selectByMouse(QPoint globalPosition) {
}
auto selectedChatTypeFilter = false;
const auto from = skip - st::searchedBarHeight;
if (mouseY <= skip && mouseY >= from) {
if (hasChatTypeFilter() && mouseY <= skip && mouseY >= from) {
const auto left = width()
- _chatTypeFilterWidth
- 2 * st::searchedBarPosition.x();
@ -2998,6 +2999,11 @@ void InnerWidget::dragPinnedFromTouch() {
updateReorderPinned(now);
}
bool InnerWidget::hasChatTypeFilter() const {
return !_searchResults.empty()
&& (_searchState.tab == ChatSearchTab::MyMessages);
}
void InnerWidget::searchRequested(bool loading) {
_searchWaiting = false;
_searchLoading = loading;

View file

@ -461,6 +461,7 @@ private:
void handleChatListEntryRefreshes();
void moveSearchIn();
void dragPinnedFromTouch();
[[nodiscard]] bool hasChatTypeFilter() const;
void saveChatsFilterScrollState(FilterId filterId);
void restoreChatsFilterScrollState(FilterId filterId);