std::nullopt for open date range instead of TransactionFilterProxy::MIN_DATE and TransactionFilterProxy::MAX_DATE.
std::nullopt for open date range instead of TransactionFilterProxy::MIN_DATE and TransactionFilterProxy::MAX_DATE.
<optional> to the src/qt/transactionview.cpp as std::nullopt are used there.
38@@ -46,8 +39,8 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &
39 return false;
40
41 QDateTime datetime = index.data(TransactionTableModel::DateRole).toDateTime();
42- if (datetime < dateFrom || datetime > dateTo)
43- return false;
44+ if (dateFrom && datetime < *dateFrom) return false;
std::optional does support comparison without dereferencing (see (26) in https://en.cppreference.com/w/cpp/utility/optional/operator_cmp) but your variant is better as operator< would repeat if (opt) check you already (rightly) did.
Labels
Refactoring