#194: new filters default to false if any existing filters are false
This commit is contained in:
@@ -503,6 +503,18 @@ QVariant CANFrameModel::headerData(int section, Qt::Orientation orientation,
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CANFrameModel::any_filters_are_configured(void)
|
||||||
|
{
|
||||||
|
for (auto const &val : filters)
|
||||||
|
{
|
||||||
|
if (val == true)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CANFrameModel::addFrame(const CANFrame& frame, bool autoRefresh = false)
|
void CANFrameModel::addFrame(const CANFrame& frame, bool autoRefresh = false)
|
||||||
{
|
{
|
||||||
@@ -517,6 +529,10 @@ void CANFrameModel::addFrame(const CANFrame& frame, bool autoRefresh = false)
|
|||||||
//if this ID isn't found in the filters list then add it and show it by default
|
//if this ID isn't found in the filters list then add it and show it by default
|
||||||
if (!filters.contains(tempFrame.ID))
|
if (!filters.contains(tempFrame.ID))
|
||||||
{
|
{
|
||||||
|
// if there are any filters already configured, leave the new filter disabled
|
||||||
|
if (any_filters_are_configured())
|
||||||
|
filters.insert(tempFrame.ID, false);
|
||||||
|
else
|
||||||
filters.insert(tempFrame.ID, true);
|
filters.insert(tempFrame.ID, true);
|
||||||
needFilterRefresh = true;
|
needFilterRefresh = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ private:
|
|||||||
void qSortCANFrameAsc(QVector<CANFrame>* frames, Column column, int lowerBound, int upperBound);
|
void qSortCANFrameAsc(QVector<CANFrame>* frames, Column column, int lowerBound, int upperBound);
|
||||||
void qSortCANFrameDesc(QVector<CANFrame>* frames, Column column, int lowerBound, int upperBound);
|
void qSortCANFrameDesc(QVector<CANFrame>* frames, Column column, int lowerBound, int upperBound);
|
||||||
uint64_t getCANFrameVal(int row, Column col);
|
uint64_t getCANFrameVal(int row, Column col);
|
||||||
|
bool any_filters_are_configured(void);
|
||||||
|
|
||||||
QVector<CANFrame> frames;
|
QVector<CANFrame> frames;
|
||||||
QVector<CANFrame> filteredFrames;
|
QVector<CANFrame> filteredFrames;
|
||||||
|
|||||||
Reference in New Issue
Block a user