diff --git a/include/alarmEventDataView.h b/include/alarmEventDataView.h index c6d943c..ba5ff88 100644 --- a/include/alarmEventDataView.h +++ b/include/alarmEventDataView.h @@ -100,15 +100,17 @@ public: void setMaxRealTimeEvents(int value) {m_maxRealTimeEvents = value;} const int getMaxRealTimeEvents() const {return m_maxRealTimeEvents;} void setFilter(const AlarmEventDataFilter& filter); - void applyFilter(); void refresh(); -private: + //void setPageSize(int); + +private slots: void onTimeoutSimulateData(); void onRealTimeEventReceived(const EventData& event); private: void iniHeaderData(); + void applyFilter(); void updatePaginationInfo(); int findEventDataIndexById(const QString& eventId); void updateEventData(int index, const EventData& updatedEvent); diff --git a/source/alarmEventDataView.cpp b/source/alarmEventDataView.cpp index d4784fc..740cd82 100644 --- a/source/alarmEventDataView.cpp +++ b/source/alarmEventDataView.cpp @@ -241,21 +241,24 @@ void AlarmEventDataModel::iniHeaderData() void AlarmEventDataModel::setFilter(const AlarmEventDataFilter& filter) { m_currentFilter = filter; + refresh(); } void AlarmEventDataModel::applyFilter() -{} +{ + m_filteredEvents.clear(); + + if(m_allEvents.size() > 0) + m_filteredEvents = m_currentFilter.apply(m_allEvents); +} void AlarmEventDataModel::refresh() { m_allEvents.clear(); - m_filteredEvents.clear(); - //1.通过服务获取当前时间段的所有事件-m_allEvents //2.过滤事件(时间区间作为服务请求参数,其它过滤在本地完成)-m_filteredEvents - if(m_allEvents.size() > 0) - {} + applyFilter(); //3.更新页码数据 updatePaginationInfo(); //4.根据页码刷新当前页面数据()-m_displayEvents