-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor open date range to use std::optional #354
Conversation
c4095ce
to
a7837ba
Compare
Concept ACK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK a7837ba, I have reviewed the code and it looks OK, I agree it can be merged.
nit: include |
a7837ba
to
4830f49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK 4830f49, tested on Debian Sid, filtering seems to work as expected.
@@ -46,8 +39,8 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex & | |||
return false; | |||
|
|||
QDateTime datetime = index.data(TransactionTableModel::DateRole).toDateTime(); | |||
if (datetime < dateFrom || datetime > dateTo) | |||
return false; | |||
if (dateFrom && datetime < *dateFrom) return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
…onal 4830f49 qt: Refactor open date range to use std::optional (João Barbosa) Pull request description: Use `std::nullopt` for open date range instead of `TransactionFilterProxy::MIN_DATE` and `TransactionFilterProxy::MAX_DATE`. ACKs for top commit: hebasto: re-ACK 4830f49, only missed header included since my [previous](bitcoin-core/gui#354 (review)) review. Talkless: tACK 4830f49, tested on Debian Sid, filtering seems to work as expected. Tree-SHA512: dcecbcc129cb401d6ac13a20f015b8cb2a7434fae6bd3e5b19fca5531e8bd915e2a0835f9c601371381750cdc8cd6fcf4f8c6669177d679773046cbe13bed68b
Use
std::nullopt
for open date range instead ofTransactionFilterProxy::MIN_DATE
andTransactionFilterProxy::MAX_DATE
.