mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:13:25 +00:00
Filter: call update title directly in filter model
Instead of sending a signal when counts change, catching them in the filter widget and update the window title there, directly update the window title in the model. This removes a signal/slot pair. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
858d3e2eed
commit
5aacd73a00
4 changed files with 9 additions and 14 deletions
|
@ -119,10 +119,6 @@ FilterWidget2::FilterWidget2(QWidget* parent) :
|
||||||
connect(qPrefUnits::instance(), &qPrefUnits::unit_systemChanged,
|
connect(qPrefUnits::instance(), &qPrefUnits::unit_systemChanged,
|
||||||
this, &FilterWidget2::temperatureChanged);
|
this, &FilterWidget2::temperatureChanged);
|
||||||
|
|
||||||
// Update counts if dives were added / removed
|
|
||||||
connect(MultiFilterSortModel::instance(), &MultiFilterSortModel::countsChanged,
|
|
||||||
this, &FilterWidget2::countsChanged);
|
|
||||||
|
|
||||||
// Reset all fields.
|
// Reset all fields.
|
||||||
clearFilter();
|
clearFilter();
|
||||||
}
|
}
|
||||||
|
@ -241,12 +237,6 @@ void FilterWidget2::hideEvent(QHideEvent *event)
|
||||||
void FilterWidget2::filterDataChanged(const FilterData &data)
|
void FilterWidget2::filterDataChanged(const FilterData &data)
|
||||||
{
|
{
|
||||||
MultiFilterSortModel::instance()->filterDataChanged(data);
|
MultiFilterSortModel::instance()->filterDataChanged(data);
|
||||||
countsChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FilterWidget2::countsChanged()
|
|
||||||
{
|
|
||||||
updateWindowTitle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FilterWidget2::shownText()
|
QString FilterWidget2::shownText()
|
||||||
|
|
|
@ -33,7 +33,6 @@ private slots:
|
||||||
void clearFilter();
|
void clearFilter();
|
||||||
void closeFilter();
|
void closeFilter();
|
||||||
void temperatureChanged();
|
void temperatureChanged();
|
||||||
void countsChanged();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool ignoreSignal;
|
bool ignoreSignal;
|
||||||
|
|
|
@ -241,6 +241,7 @@ void MultiFilterSortModel::myInvalidate()
|
||||||
|
|
||||||
// Tell the dive trip model to update the displayed-counts
|
// Tell the dive trip model to update the displayed-counts
|
||||||
DiveTripModelBase::instance()->filterFinished();
|
DiveTripModelBase::instance()->filterFinished();
|
||||||
|
countsChanged();
|
||||||
emit filterFinished();
|
emit filterFinished();
|
||||||
|
|
||||||
#if !defined(SUBSURFACE_MOBILE)
|
#if !defined(SUBSURFACE_MOBILE)
|
||||||
|
@ -296,7 +297,7 @@ void MultiFilterSortModel::divesAdded(dive_trip *, bool, const QVector<dive *> &
|
||||||
if (!d->hidden_by_filter)
|
if (!d->hidden_by_filter)
|
||||||
++divesDisplayed;
|
++divesDisplayed;
|
||||||
}
|
}
|
||||||
emit countsChanged();
|
countsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiFilterSortModel::divesDeleted(dive_trip *, bool, const QVector<dive *> &dives)
|
void MultiFilterSortModel::divesDeleted(dive_trip *, bool, const QVector<dive *> &dives)
|
||||||
|
@ -305,5 +306,10 @@ void MultiFilterSortModel::divesDeleted(dive_trip *, bool, const QVector<dive *>
|
||||||
if (!d->hidden_by_filter)
|
if (!d->hidden_by_filter)
|
||||||
--divesDisplayed;
|
--divesDisplayed;
|
||||||
}
|
}
|
||||||
emit countsChanged();
|
countsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MultiFilterSortModel::countsChanged()
|
||||||
|
{
|
||||||
|
updateWindowTitle();
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,11 +77,11 @@ slots:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void filterFinished();
|
void filterFinished();
|
||||||
void countsChanged();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MultiFilterSortModel(QObject *parent = 0);
|
MultiFilterSortModel(QObject *parent = 0);
|
||||||
struct dive_site *curr_dive_site;
|
struct dive_site *curr_dive_site;
|
||||||
|
void countsChanged();
|
||||||
FilterData filterData;
|
FilterData filterData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue