cxx-qt-lib: standardize constructor method naming conventions#1220
Open
cxx-qt-lib: standardize constructor method naming conventions#1220
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1220 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 73 73
Lines 12593 12593
=========================================
Hits 12593 12593 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per #1203, constructor methods are now named directly after their parameters, and suffixed by
_optif they returnOption<Self>.This PR also adds the
AnyDateFormattype (an enum of either aDateFormator aQString) in order to deduplicate methods for converting between date/time types andQStrings:Alternatively, we could get rid of
AnyDateFormatand usedate.to_qstring_qstring,QDateTime::from_qstring_dateformat_opt, etc. I think theAnyDateFormatapproach is slightly cleaner, but I'll get rid of it if you prefer.These are all breaking changes. Alternatively, the old functions could be deprecated rather than removed. I didn't see any
#[deprecated]tags in the codebase, so I defaulted to removing them.Full list of changes (copied from the changelog):
QTime::from_stringandQTime::from_string_enumnow returnOption<QTime>rather thanQTime, in keeping with the identical functions forQDateandQDateTime.QDate::from_stringandQDate::from_string_enum→QDate::from_qstring_optQDate::formatandQDate::format_enum→QDate::to_qstringQDateTime::from_date_and_time_time_zone→QDateTime::from_qdate_qtime_qtimezoneQDateTime::from_date_and_time_time_spec→QDateTime::from_qdate_qtime_timespecQDateTime::from_stringandQDateTime::from_string_enum→QDateTime::from_qstring_optQDateTime::formatandQDateTime::format_enum→QDateTime::to_qstringQImage::from_data→QImage::from_data_optQTime::from_stringandQTime::from_string_enum→QTime::from_qstring_optQTime::formatandQTime::format_enum→QTime::to_qstring