Add 'clear' button to search bar and implement search indicator via spinner
This commit is contained in:
parent
d4336b56d6
commit
a2e120a8a3
5 changed files with 51 additions and 2 deletions
|
|
@ -39,6 +39,7 @@ void
|
|||
TimelineFilter::startFiltering()
|
||||
{
|
||||
incrementalSearchIndex = 0;
|
||||
emit isFilteringChanged();
|
||||
invalidateFilter();
|
||||
|
||||
continueFiltering();
|
||||
|
|
@ -82,6 +83,7 @@ TimelineFilter::event(QEvent *ev)
|
|||
continueFiltering();
|
||||
}
|
||||
}
|
||||
emit isFilteringChanged();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -172,6 +174,7 @@ TimelineFilter::setSource(TimelineModel *s)
|
|||
incrementalSearchIndex = 0;
|
||||
|
||||
emit sourceChanged();
|
||||
emit isFilteringChanged();
|
||||
invalidateFilter();
|
||||
}
|
||||
}
|
||||
|
|
@ -200,6 +203,12 @@ TimelineFilter::currentIndex() const
|
|||
return -1;
|
||||
}
|
||||
|
||||
bool
|
||||
TimelineFilter::isFiltering() const
|
||||
{
|
||||
return incrementalSearchIndex != std::numeric_limits<int>::max() && !(threadId.isEmpty() && contentFilter.isEmpty());
|
||||
}
|
||||
|
||||
bool
|
||||
TimelineFilter::filterAcceptsRow(int source_row, const QModelIndex &) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ class TimelineFilter : public QSortFilterProxyModel
|
|||
contentFilterChanged)
|
||||
Q_PROPERTY(TimelineModel *source READ source WRITE setSource NOTIFY sourceChanged)
|
||||
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
|
||||
Q_PROPERTY(bool filteringInProgress READ isFiltering NOTIFY isFilteringChanged)
|
||||
|
||||
public:
|
||||
explicit TimelineFilter(QObject *parent = nullptr);
|
||||
|
|
@ -28,6 +29,7 @@ public:
|
|||
QString filterByContent() const { return contentFilter; }
|
||||
TimelineModel *source() const;
|
||||
int currentIndex() const;
|
||||
bool isFiltering() const;
|
||||
|
||||
void setThreadId(const QString &t);
|
||||
void setContentFilter(const QString &t);
|
||||
|
|
@ -46,6 +48,7 @@ signals:
|
|||
void contentFilterChanged();
|
||||
void sourceChanged();
|
||||
void currentIndexChanged();
|
||||
void isFilteringChanged();
|
||||
|
||||
private slots:
|
||||
void fetchAgain();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue