diff options
-rw-r--r-- | mobile-widgets/qml/DiveList.qml | 7 | ||||
-rw-r--r-- | qt-models/divelistmodel.cpp | 1 | ||||
-rw-r--r-- | qt-models/divelistmodel.h | 5 |
3 files changed, 6 insertions, 7 deletions
diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index aa58b232c..7bf79671c 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -17,7 +17,6 @@ Kirigami.ScrollablePage { property color secondaryTextColor: subsurfaceTheme.secondaryTextColor property int horizontalPadding: Kirigami.Units.gridUnit / 2 - Kirigami.Units.smallSpacing + 1 property QtObject diveListModel: diveTripModel - property string numShownText opacity: 0 Behavior on opacity { @@ -481,7 +480,7 @@ Kirigami.ScrollablePage { id: numShown z: 10 verticalAlignment: Text.AlignVCenter - text: numShownText + text: diveModel.shown } } } @@ -503,9 +502,6 @@ Kirigami.ScrollablePage { section.criteria: ViewSection.FullString section.delegate: tripHeading section.labelPositioning: ViewSection.CurrentLabelAtStart | ViewSection.InlineLabels - onModelChanged: { - numShownText = diveModel.shown() - } Connections { target: detailsWindow onCurrentIndexChanged: diveListView.currentIndex = detailsWindow.currentIndex @@ -555,7 +551,6 @@ Kirigami.ScrollablePage { onTriggered: { rootItem.filterToggle = !rootItem.filterToggle manager.setFilter("", 0) - numShownText = diveModel.shown() } } diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp index d1ae4093d..f79efe0ff 100644 --- a/qt-models/divelistmodel.cpp +++ b/qt-models/divelistmodel.cpp @@ -195,6 +195,7 @@ DiveListSortModel *DiveListSortModel::instance() void DiveListSortModel::updateFilterState() { DiveFilter::instance()->updateAll(); + emit shownChanged(); } void DiveListSortModel::setSourceModel(QAbstractItemModel *sourceModel) diff --git a/qt-models/divelistmodel.h b/qt-models/divelistmodel.h index b051605ae..110ee82ae 100644 --- a/qt-models/divelistmodel.h +++ b/qt-models/divelistmodel.h @@ -47,11 +47,14 @@ public: Q_INVOKABLE void reload(); QString filterString; void updateFilterState(); + Q_PROPERTY(int shown READ shown NOTIFY shownChanged); + int shown(); public slots: int getIdxForId(int id); void setFilter(QString f, FilterData::Mode mode); void resetFilter(); - int shown(); +signals: + void shownChanged(); protected: bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; private: |