LogViewer
A modern log viewer with AI-assisted analysis (Qt 6)
Loading...
Searching...
No Matches
ui::qt::UnifiedSearchBar Class Reference

Unified search bar for global event search and filtering. More...

#include <UnifiedSearchBar.hpp>

Inheritance diagram for ui::qt::UnifiedSearchBar:
Inheritance graph
Collaboration diagram for ui::qt::UnifiedSearchBar:
Collaboration graph

Signals

void SearchChanged (const QString &query)
 Emitted when search query changes.
 
void FilterRequested (const QString &field, const QString &value)
 Emitted when user wants to apply as filter.
 
void MatchCountChanged (int current, int total)
 Emitted when search matches change.
 

Public Member Functions

 UnifiedSearchBar (QWidget *parent=nullptr)
 
 ~UnifiedSearchBar ()=default
 
void SetEventsSource (db::EventsContainer *events)
 Set the events source for searching.
 
void SetEventsView (EventsTableView *view)
 Set the events view for navigation.
 
void FocusSearchInput ()
 Focus the search input (called by Ctrl+F shortcut)
 
QString GetSearchQuery () const
 Get the current search query.
 
void ClearSearch ()
 Clear search and results.
 
QSize sizeHint () const override
 
QSize minimumSizeHint () const override
 

Private Slots

void OnSearchTextChanged (const QString &text)
 
void OnSearchReturn ()
 
void OnClearClicked ()
 
void OnSearchHistoryItemClicked (const QString &text)
 
void OnQuickFilterClicked ()
 
void OnSearchSuggestionClicked (const QString &suggestion)
 
void OnDetailsClicked ()
 

Private Member Functions

void CreateLayout ()
 
void UpdateMatchCount ()
 
void LoadSearchHistory ()
 
void SaveSearchHistory ()
 
void AddToSearchHistory (const QString &query)
 
void CreateFilterPresets ()
 
int CountMatches (const QString &query)
 Count events matching the search query.
 

Private Attributes

db::EventsContainer * m_events = nullptr
 
EventsTableView * m_eventsView = nullptr
 
QLineEdit * m_searchInput = nullptr
 
QLabel * m_matchCountLabel = nullptr
 
QPushButton * m_clearButton = nullptr
 
QPushButton * m_filterButton = nullptr
 
QCompleter * m_completer = nullptr
 
std::unique_ptr< QSettings > m_settings
 
QStringList m_searchHistory
 
int m_lastMatchCount = 0
 
QString m_lastQuery
 
QTimer * m_matchCountDebounceTimer = nullptr
 

Static Private Attributes

static constexpr int MAX_HISTORY = 10
 
static constexpr int MATCH_COUNT_DEBOUNCE_MS = 300
 

Detailed Description

Unified search bar for global event search and filtering.

Provides:

  • Type-ahead search across all event fields
  • Live match counter
  • Recent searches history
  • Filter presets for quick access
  • Keyboard shortcuts (Ctrl+F)

The search bar integrates with EventsTableView to navigate and filter matching events, and can save searches for quick re-use.

Constructor & Destructor Documentation

◆ UnifiedSearchBar()

ui::qt::UnifiedSearchBar::UnifiedSearchBar ( QWidget *  parent = nullptr)
explicit
Here is the call graph for this function:

◆ ~UnifiedSearchBar()

ui::qt::UnifiedSearchBar::~UnifiedSearchBar ( )
default

Member Function Documentation

◆ AddToSearchHistory()

void ui::qt::UnifiedSearchBar::AddToSearchHistory ( const QString &  query)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ClearSearch()

void ui::qt::UnifiedSearchBar::ClearSearch ( )

Clear search and results.

Here is the caller graph for this function:

◆ CountMatches()

int ui::qt::UnifiedSearchBar::CountMatches ( const QString &  query)
private

Count events matching the search query.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateFilterPresets()

void ui::qt::UnifiedSearchBar::CreateFilterPresets ( )
private

◆ CreateLayout()

void ui::qt::UnifiedSearchBar::CreateLayout ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FilterRequested

void ui::qt::UnifiedSearchBar::FilterRequested ( const QString &  field,
const QString &  value 
)
signal

Emitted when user wants to apply as filter.

Here is the caller graph for this function:

◆ FocusSearchInput()

void ui::qt::UnifiedSearchBar::FocusSearchInput ( )

Focus the search input (called by Ctrl+F shortcut)

Here is the caller graph for this function:

◆ GetSearchQuery()

QString ui::qt::UnifiedSearchBar::GetSearchQuery ( ) const

Get the current search query.

◆ LoadSearchHistory()

void ui::qt::UnifiedSearchBar::LoadSearchHistory ( )
private
Here is the caller graph for this function:

◆ MatchCountChanged

void ui::qt::UnifiedSearchBar::MatchCountChanged ( int  current,
int  total 
)
signal

Emitted when search matches change.

Here is the caller graph for this function:

◆ minimumSizeHint()

QSize ui::qt::UnifiedSearchBar::minimumSizeHint ( ) const
override

◆ OnClearClicked

void ui::qt::UnifiedSearchBar::OnClearClicked ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnDetailsClicked

void ui::qt::UnifiedSearchBar::OnDetailsClicked ( )
privateslot
Here is the caller graph for this function:

◆ OnQuickFilterClicked

void ui::qt::UnifiedSearchBar::OnQuickFilterClicked ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSearchHistoryItemClicked

void ui::qt::UnifiedSearchBar::OnSearchHistoryItemClicked ( const QString &  text)
privateslot
Here is the call graph for this function:

◆ OnSearchReturn

void ui::qt::UnifiedSearchBar::OnSearchReturn ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSearchSuggestionClicked

void ui::qt::UnifiedSearchBar::OnSearchSuggestionClicked ( const QString &  suggestion)
privateslot
Here is the call graph for this function:

◆ OnSearchTextChanged

void ui::qt::UnifiedSearchBar::OnSearchTextChanged ( const QString &  text)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SaveSearchHistory()

void ui::qt::UnifiedSearchBar::SaveSearchHistory ( )
private
Here is the caller graph for this function:

◆ SearchChanged

void ui::qt::UnifiedSearchBar::SearchChanged ( const QString &  query)
signal

Emitted when search query changes.

Here is the caller graph for this function:

◆ SetEventsSource()

void ui::qt::UnifiedSearchBar::SetEventsSource ( db::EventsContainer *  events)

Set the events source for searching.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetEventsView()

void ui::qt::UnifiedSearchBar::SetEventsView ( EventsTableView *  view)

Set the events view for navigation.

Here is the caller graph for this function:

◆ sizeHint()

QSize ui::qt::UnifiedSearchBar::sizeHint ( ) const
override

◆ UpdateMatchCount()

void ui::qt::UnifiedSearchBar::UpdateMatchCount ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_clearButton

QPushButton* ui::qt::UnifiedSearchBar::m_clearButton = nullptr
private

◆ m_completer

QCompleter* ui::qt::UnifiedSearchBar::m_completer = nullptr
private

◆ m_events

db::EventsContainer* ui::qt::UnifiedSearchBar::m_events = nullptr
private

◆ m_eventsView

EventsTableView* ui::qt::UnifiedSearchBar::m_eventsView = nullptr
private

◆ m_filterButton

QPushButton* ui::qt::UnifiedSearchBar::m_filterButton = nullptr
private

◆ m_lastMatchCount

int ui::qt::UnifiedSearchBar::m_lastMatchCount = 0
private

◆ m_lastQuery

QString ui::qt::UnifiedSearchBar::m_lastQuery
private

◆ m_matchCountDebounceTimer

QTimer* ui::qt::UnifiedSearchBar::m_matchCountDebounceTimer = nullptr
private

◆ m_matchCountLabel

QLabel* ui::qt::UnifiedSearchBar::m_matchCountLabel = nullptr
private

◆ m_searchHistory

QStringList ui::qt::UnifiedSearchBar::m_searchHistory
private

◆ m_searchInput

QLineEdit* ui::qt::UnifiedSearchBar::m_searchInput = nullptr
private

◆ m_settings

std::unique_ptr<QSettings> ui::qt::UnifiedSearchBar::m_settings
private

◆ MATCH_COUNT_DEBOUNCE_MS

constexpr int ui::qt::UnifiedSearchBar::MATCH_COUNT_DEBOUNCE_MS = 300
staticconstexprprivate

◆ MAX_HISTORY

constexpr int ui::qt::UnifiedSearchBar::MAX_HISTORY = 10
staticconstexprprivate

The documentation for this class was generated from the following files: