summaryrefslogtreecommitdiffstats
path: root/src/corelib/time
Commit message (Collapse)AuthorAgeFilesLines
* Update CLDR to v37, adding Nigerian Pidgin as a new languageEdward Welbourne2020-10-293-2275/+2354
| | | | | | | | | | | | | | | | | | | Routine update by running scripts, ignoring clang-format's extensive grumbles. Added notes to util/locale_database/'s README, on the need for that, and enumdata.py, on when to add entries. As usual, several new locales are also added, for existing languages, territories and scripts. [ChangeLog][QtCore][QLocale] Updated to new version of CLDR (the Unicode Consortium's Common Locale Data Repository) v37. Various Adlam-script locales are dropped due to its use of a number system unsupported by 5.15's QLocale. Support for these locales shall be restored in Qt 6. Task-number: QTBUG-84669 Change-Id: Ib76848bf4bd1219180faf46820077e8d8049a4e3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit cb23d50f38ec9d1daed570aa2b89e6d4b3f45c3f)
* QCalendar: fixup includesGiuseppe D'Angelo2020-10-061-1/+1
| | | | | | | | | Remove an unused one, and add a used one. Change-Id: Ic8b2fc7d0fa1e703b7cbbc622b98a626dd0f6ced Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit f0162415f127c44126a33b94716a5163feb481ff) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Break out calendar backend-from-enum as a static functionEdward Welbourne2020-10-061-27/+38
| | | | | | | | | | | This lets the registry's populate() avoid recursing into constructors that are typically what (indirectly) called it. This, in turn, makes it possible to assert the constructor from enum gets what it expects. Change-Id: I190f9dcfe405e3ee1c6a3f0926fa33cf9ddf64e0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 48cc034c3fad709e7c145a3793d6521b944b36c2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't guess UTC when we can't find a system zone nameEdward Welbourne2020-09-283-16/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | If we're able to load a system zone without knowing its name, we shouldn't claim that its name is UTC. Instead, use the system zone information's name for the zone. Let the backend return an empty string if it can't determine the system zone ID, provided it has some way to get system zone info despite not knowing its name. This can happen on Windows if the system zone is one of Microsoft's idiosyncratic names that we don't recognize; or on Linux if /etc/timezone is a copy of a zoneinfo file, instead of a symlink. In support of that, handle empty ID as a request for system zone info, so that the backend constructors taking an IANA ID never get passed an empty ID; that gets routed to the default constructor instead. This incidentally restores QTzTimeZonePrivate's behavior, for empty ID, of reading the content of /etc/timezone if we are unable to determine the name of its zone any other way. Fixes: QTBUG-86306 Change-Id: Iad57c18199124f651ebc3d32c3deffca6eaab512 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit b12d6c6a8ab5f7b01bdd2cb862a66a409700faa1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QCalendarBackend: format "enum" as code where usedEdward Welbourne2020-08-201-8/+11
| | | | | | | | | Also mark some internal methods as \internal. Change-Id: I0ae8dc315e5012eea2f3c35ae7d09c3cbb318ab5 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit a84589cb69504cb1737cc479b6fd8c6c244347c3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Document QCalendarBackend::name()Edward Welbourne2020-08-201-1/+8
| | | | | | | | | Neglected previously. Change-Id: I0acd9f77d1623a1fcd8766f734c350316401b3a9 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 4c2fbe90eff567f141f2393cccd0de660bccbdbc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QCalendar: actually remember if the registry has been populatedGiuseppe D'Angelo2020-08-071-0/+2
| | | | | | | | | | The "populated" variable is otherwise never written into. Change-Id: I979411a19927dc4e7e09c6c36edfb2308f519596 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 3938d932220e70e2dccb81786135acfcf9ea187b) Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Save DST status when computed for a mutable QDateTimeDataEdward Welbourne2020-06-291-0/+1
| | | | | | | | | | | Most calls to localMSecsToEpochMSecs() happen from functions that can't save the DST status it repots (due to the data being const); but refreshDateTime() can and (given its name) clearly should. Change-Id: Ib53c88d2233925da275f0ac52f768cada92c5d2d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit a04411119ead3d4473e4f0ac4bceedc585977b2f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Cache system zone ID when fetched from the file-systemEdward Welbourne2020-05-281-64/+141
| | | | | | | | | | | | | | | Record the device and inode numbers when found and assume we can safely re-use the name if those have not changed. Tidy up some preprocessor trivia in the process and moved zone-availability check functions to before the system name lookup. Task-number: QTBUG-75585 Change-Id: I3660922ef3c94b553a20f887a676e8921693b30f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit f20f0b03d57b9517ac34043b873665bd41c098d2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Make QDateTimeParser recognize local time offsetsAndrei Golubev2020-05-281-13/+10
| | | | | | | | Fixes: QTBUG-84209 Change-Id: Iedbc7beafcaa55c72fec3ac5a5f519c6ed5f7770 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit cfbb30decda13fb630127246af5bea32c5f4da57) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Teach QDateTimeParser some common time-zone offset formatsAndrei Golubev2020-05-203-60/+141
| | | | | | | | Fixes: QTBUG-83687 Fixes: QTBUG-83844 Change-Id: Ia1c827017b93cf8277aa5a0266805d773d2d9818 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit bed25fdf6065d7137fa5610e4f214e9a8f8e172b)
* Make qtbase compile without QT_CONFIG(timezone)Andrei Golubev2020-05-202-3/+10
| | | | | | | | | Fixes: QTBUG-83795 Change-Id: I05eaaf57d87a9111d3609ebab81bc707f8af98f0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit b428e98052aa1b97a42f31ed52b1266d17e186ee) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add more QCalendar references to \sa sections of QDate docsEdward Welbourne2020-05-201-19/+28
| | | | | | | | | | | The QCalendar API is, in places, more efficient or expressive than the QDate facade that accesses it. Make sure those using QDate have a chance to find it. Change-Id: Iffdddfa1f4884e316a1c9887a8a5053eefa73499 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 7cb4c50e73cf611cf9e888013de7ae6f5ab481c7) Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Make t specifier for time-zone only apply to date-timeEdward Welbourne2020-04-232-4/+10
| | | | | | | | | It previously applied to dates and date-times, but was documented as applying to times (and date-times then included it by reference). It's only meaningful for a date-time. Change-Id: Id9e8e8cb987b03e5ddc77b05c581b9b6944065fc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Standardise language about quoted text in date/time format stringsEdward Welbourne2020-04-221-14/+14
| | | | | Change-Id: Iaaeff8cd28a23b878ca07d716e67d4bd9fbb8176 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Handle specified time-spec in date-time parsingAndrei Golubev2020-04-223-34/+51
| | | | | | | | | | | | | | | | | | | | | | When a date-time was parsed from a string, the result was equal (as a date-time) to the correct value, but had (at least in some cases) the wrong spec, where it should have had a spec reflecting the zone specifier parsed. The time-spec imposed for the benefit of QDateTimeEdit is now moved from QDateTimeParser to QDateTimeEditPrivate, which takes over responsibility for imposing it. QDateTimeParser assumes Qt::LocalTime in member functions (where applicable) and uses the time-spec parsed from the string when constructing the date-time. QDateTime::fromString() and QLocale::toDateTime() are updated to use the full QDateTime returned by QDateTimeParser. Fixes: QTBUG-83075 Done-With: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I8b79add2c7fc13a200e1252d48dbfa70b36757bf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix display-name calls in QAndroidTimeZonePrivate::init()Edward Welbourne2020-04-161-13/+29
| | | | | | | | | | | | | | | | | | | | | Following up on commits 4fa8dfee5dd31433d22fdb449c1783e256931c8f and c20c7efea96046bebcb8ff7823d3a7e227f92e73, where I apparently got the call to Java's getDisplayName() method wrong. Use the same code as our own displayName() method used for this, pulled out as a function to be shared by the two callers. This requires a locale and it's not immediately obvious which to use, so try the three most plausible candidates: C locale because IANA IDs are typically in it; default because that's most likely what language a user-supplied locale name might be in; and system because the name may have come from the system, not the user. In the process fixed some loops that didn't visit all the values they thought they did. Fixes: QTBUG-81975 Change-Id: I7867ca6f46951315a41c389107439acb439eaf08 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-04-081-25/+5
|\ | | | | | | Change-Id: I34a71ddbc6afb1f12a0a044d0d3876e1af58d60c
| * Purge two old time-zone lookup fallbacksEdward Welbourne2020-04-071-23/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used to need to consult /etc/timezone for the zone name back when Debian, up to Jessie, used a copy of the zoneinfo file as /etc/localtime, instead of a symlink. Jessie's end of life is this May, but Thiago reports that its gcc can't build Qt 5.14, so we may as well remove this fall-back. Newer versions of Debian use a symlink. We used to need to consult /etc/sysconfig/clock for this information back when ancient Red Hat distros copied zoneinfo to /etc/localtime instead of symlinking, but Thiago believes that's now ancient history. So, again, remove this old fallback. Change-Id: I73cb40b926186b311dac6f00fe8743d37a9dfce5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Ensure QTzTimeZonePrivate always tries a non-empty IANA IDEdward Welbourne2020-04-071-2/+5
| | | | | | | | | | | | | | | | | | | | | | QTzTimeZonePrivate::init() was coping with empty and then saving the system ID if the ID it looked up was empty. Better to have its caller ensure it's passed the system ID in place of empty. The system ID is always non-empty, as it falls back to "UTC" if it would otherwise have been empty. Change-Id: I5c74e23f01ef578de0dc1f6d558e9c8c7e65ff53 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-04-061-7/+9
|\| | | | | | | | | | | | | Conflicts: src/corelib/kernel/qeventdispatcher_win.cpp Change-Id: I32db3f755577aefc15f757041367d6144f5e5c66
| * Doc: Clarify equivalence of two QDate instancesTopi Reinio2020-04-031-7/+9
| | | | | | | | | | | | Fixes: QTBUG-83212 Change-Id: I627716522a962a4c90c5833446dd62f6a18d7d86 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-04-031-20/+13
|\| | | | | | | | | | | | | Conflicts: tests/benchmarks/corelib/text/qstringlist/qstringlist.pro Change-Id: Ie9b97bd83c2df00fd9b556b5f09d405f71970169
| * Clean up QTzTimeZonePrivate::systemTimeZoneId()Edward Welbourne2020-04-021-20/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The special handling of ":/etc/localtime" should only apply if that's the exact value of $TZ; the old code would have treated "/etc/localtime" the same, due to stripping a leading ':' before checking for it. We can also test whether to do that stripping using startsWith(). When reading the content of files, avoid QTextStream's trip via QString and back to QByteArray by using the QFile's readLine() directly, or by using readAll(). Task-number: QTBUG-75585 Change-Id: I1524529a2c34d83a9fbd00d41c11f2d994dfc49d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Purge a stray space from calendar locale dataEdward Welbourne2020-04-023-1779/+1779
| | | | | | | | | | | | | | | | It was causing all lines after the first, in each calendar's locale_data[], to be over-indented. This only changes spacing. Change-Id: Ibfc4986548eecbfdba2902cc18f44a2af669bc6d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Rework cldr2qtimezone.py into more maintainable formEdward Welbourne2020-04-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Broke out the updating of a source file to a ZoneIdWriter helper class, which enables tidying away the temporary file if we fail. Collected up the rest of the script into a main() that's now called from a __name__ == '__main__' block. Rationalized the imports. Eliminated an inefficient lookup function by constructing a suitable dict() before entering the loop that needed it. Separated the "data you might need to update" tables from the code that does the work, to make it easier for those adding support for new zones to see what they're doing. Removed the spurious $Revision$ from the output and reworded the premable of the generated file. (It would seem CLDR no longer uses an RCS-based version-control system.) Generated output is otherwise unchanged. Task-number: QTBUG-81344 Change-Id: I7d9de8357ebcb599d154de9f862e25f7ade00390 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2020-03-242-57/+100
|\| | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbdrag.cpp Change-Id: I0b47324b70b0b4894e54b21aa3e7a5041f9bd5e3
| * qtimezoneprivate_tz: Apply a cache over the top of timezone dataRobin Burchell2020-03-202-57/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Constantly re-reading the timezone information only to be told the exact same thing is wildly expensive, which can hurt in operations that cause a lot of QTimeZone creation, for example, V4's DateObject - which creates them a lot (in DaylightSavingTA). This performance problem was identified when I noticed that a QDateTime binding updated once per frame was causing >100% CPU usage (on a desktop!) thanks to a QtQuickControls 1 Calendar (which has a number of bindings to the date's properties like getMonth() and so on). The newly added tst_QTimeZone::systemTimeZone benchmark gets a ~90% decrease in instruction count: --- before +++ after PASS : tst_QTimeZone::systemTimeZone() RESULT : tst_QTimeZone::systemTimeZone(): - 0.024 msecs per iteration (total: 51, iterations: 2048) + 0.0036 msecs per iteration (total: 59, iterations: 16384) Also impacted (over in QDateTime) is tst_QDateTime::setMSecsSinceEpochTz(). The results here are - on the surface - less impressive (~0.17% drop), however, it isn't even creating QTimeZone on a hot path to begin with, so a large drop would have been a surprise. Added several further benchmarks to cover non-system zones and traverse transitions. Done-With: Edward Welbourne <edward.welbourne@qt.io> Task-number: QTBUG-75585 Change-Id: I044a84fc2d3a2dc965f63cd3a3299fc509750bf7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-03-181-1/+1
|\| | | | | | | Change-Id: Iaab37b633a8286c2c21425aaac34d30529a3ea82
| * Fix JNI signature for the timezone getDisplayName callVolker Krause2020-03-171-1/+1
| | | | | | | | | | | | | | | | | | Due to the changes in 5.14.1 this code now actually seems to be hit here, throwing NoSuchMethodError exceptions all over the place and breaking date/time handling quite spectacularly. Change-Id: I9bee3de39ec98f86d7944b94e89119505f62dc6c Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* | Warn about Q(Date|Time)+ switching to C locale in Qt 6Edward Welbourne2020-03-031-0/+24
| | | | | | | | | | Change-Id: I3a3afc3fb4ddca405a75097feb15aee0e72b3b19 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Core: Use Qt::SplitBehavior in preference to QString::SplitBehaviorEdward Welbourne2020-02-281-2/+2
| | | | | | | | | | | | | | | | The Qt version was added in 5.14 "for use as eventual replacement for QString::SplitBehavior." Move another step closer to that goal. Change-Id: I446f9ddc8f8de4a0b79b09edb44f7c1496fbc33f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Fix QDateTimeEdit's handling of invalid time in dst gapVolker Hilsheimer2020-02-271-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During a spring forward, a time-zone omits an hour. A QDateTime with such an hour is invalid, but QDateTimeEdit's handling of this invalid time was not done correctly. With this fix, up/down changes of any field that would result in an invalid date-time corrects the time to be valid, while leaving as much as possible of the user-entered data unchanged. To do that, we rely on QDateTime::toMSecsSinceEpoch to return a value even for such an invalid time, which then can be used to construct a valid QDateTime. Edits that would result in an invalid hour are reverted to the previous when pressing return, if correctionMode is CorrectToPreviousValue. This change also implements support for CorrectToNearestValue, which uses the same mechanism as when stepping over an invalid time. Include a test that verifies that the various interactions result in a reasonable value. Since QDateTimeEdit does not respect the timezone or timespec of the QDateTime it is initialized with, we have to find the first hour of daylight saving time for a year that we know works for most time zones. Failing that, we have to skip the tests. Verified in a wide range of time zones. Change-Id: I05b906ae3b5f6681891d23704f00f9c10cd479ae Fixes: QTBUG-79803 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Doc: Fix documentation warnings for Qt CoreTopi Reinio2020-02-251-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - QCborError: Classes cannot relate to header files; use \inheaderfile instead and link to the class from header file documentation. - QRecursiveMutex: QDoc doesn't allow shared documentation comments for duplicating \fn docs between the base and deriving classes. Remove the sharing, the function documentation is available under 'All Members' doc for QRecursiveMutex. - QMultiMap: unite() and one overload of insert() were not recognized because their definitions in the same header file interfered with QDoc - use Q_CLANG_QDOC macro to comment them out, and tag \fn comments to ensure that the function documentation is matched. Change-Id: Ic96869904a72d92453e4ffa6901000147571969b Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Back out of calendar support in Qt::DateFormat methodsEdward Welbourne2020-02-202-28/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're deprecating the locale-specific date-formats, which are the only ones that use the calendar. The QDateTime::toString() variant was new in 5.15, so we can simply remove it again. The QDate one was present in 5.14, so we need to keep it; deprecated it at 5.15 for removal at Qt 6. [ChangeLog][QtCore][QDate] QDate::toString(Qt::DateFormat, QCalendar) no longer takes calendar into account for Qt::TextDate. There was no matching support in QDateTime and the locale-independent formats are intended to be standard, rather than customized to the user. Fixes: QTBUG-82178 Change-Id: I09db8a82ec5a4eab22f197790264fa3a3724e383 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Silence deprecation warnings on implementation of deprecated formatsEdward Welbourne2020-02-181-0/+12
| | | | | | | | | | Change-Id: I3abb36e27e96033b4eb44802c28e0a6ba8250ce5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-061-12/+25
|\| | | | | | | | | | | | | Conflicts: src/network/ssl/qsslsocket_openssl_symbols.cpp Change-Id: I8c13b5c48a8ecce96540b39c6d5f8ca146eb2339
| * Coding style: put case bodies on separate lines from the case labelEdward Welbourne2020-02-051-12/+25
| | | | | | | | | | | | | | | | | | While the single-line-case format is more readable when consistently applied through the whole switch, it works less well when several of the cases are too complex to fit on a single line. Change-Id: I6a84a3d3d1493dadddab103da0336a8ef860563c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-043-25/+15
|\| | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf examples/widgets/widgets/imageviewer/imageviewer.cpp src/corelib/text/qchar.cpp src/corelib/time/qdatetime.cpp Change-Id: I9762f5c4ff650799219729d6aee79ac07ce9024a
| * Pass QDate and QTime by value in various static and local functionsEdward Welbourne2020-01-313-7/+7
| | | | | | | | | | | | | | They're value types, so pass them as such. Change-Id: I0dc46c63a3a0e6d859b821362f71390f0148b64c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Simplify textdate/datestring #if-eryEdward Welbourne2020-01-301-20/+8
| | | | | | | | | | | | | | | | Since datestring implies textdate, we don't need to check the latter inside the #if-ery of the former. Change-Id: I01e648245bc7707db024eac925092ed816173781 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Consolidate some Q(Date|Time)+ methods to call calendared versionsEdward Welbourne2020-01-311-59/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The string-returning methods were in any case delegating to either a local static or QLocale methods that delegate to their calendar variants, so do the default-calendar step early and reduce the number of distinct code-paths, along with the gross number of lines of code. In the process, short-cut past QDate::toString() when we can save its switch and go direct to the toString{Text|Iso}Date() it's calling. Tidy up somewhat in the process. Change-Id: I8ba70b29ef9e8b6553c41310ebb2b63ec5570bb9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Deprecate locale-related DateFormat enum membersEdward Welbourne2020-01-311-46/+67
| | | | | | | | | | | | | | | | Qt 6 shall remove all locale-dependence from Q(Date|Time)+. Task-number: QTBUG-80441 Change-Id: Iebaaa2bd776bccfe0d73c15f36cbdd456b71ca59 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Add missing calendar methods to QDateTime and docsEdward Welbourne2020-01-312-16/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | We missed a few, so complete the general scheme of accepting an optional calendar, where it would be relevant. [ChangeLog][QtCore][QDateTime] Added some missing QCalendar variants of QDateTime::toString(). Included docs for QCalendar variants in both QDate and QDateTime. Change-Id: Ief7b4dada73d7a4055b75d8b47ff4d2e310ce738 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Clarify handling of unspecified year in two QCalendar methodsEdward Welbourne2020-01-311-2/+9
| | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore] QCalendar::monthsInYear(QCalendar::Unspecified) now returns maximumMonthsInYear(). QCalendar::daysInYear() now makes clear that its handling of unspecified year is undefined. Change-Id: Ifef8723193868c666f6afeb7f190af4929d30dea Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Deprecate QDateTime(const QDate &) in favor of QDate::startOfDay()Edward Welbourne2020-01-302-6/+11
| | | | | | | | | | | | | | | | | | | | | | It needed re-implemented in terms of the new API (in case QTime(0, 0) was skipped, on the date in question, by a spring-forwrd), which makes it redundant (and supports choice of spec and zone or offset, which it did not). Change-Id: I1e3c3e794632c234f254be754ed6e4ebdaaaa6bc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | Replace most use of QVariant::type and occurrences of QVariant::TypeOlivier Goffart2020-01-233-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I made a clazy automated check that replaced the use of QVariant::Type by the equivalent in QMetaType. This has been deprecated since Qt 5.0, but many uses were not yet removed. In addition, there was some manual changes to fix the compilation errors. Adapted the Private API of QDateTimeParser and QMimeDataPrivate and adjust QDateTimeEdit and QSpinBox. QVariant(QVariant::Invalid) in qstylesheet made no sense. But note that in QVariant::save, we actually wanted to use the non-user type. In the SQL module, many changes were actually reverted because the API still expects QVarient::Type. Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-01-182-2/+2
|\| | | | | | | Change-Id: I12148e7b20bcdb72d9b328035d528c99633b1e92
| * Doc: Fix qdoc compilation errors qtbaseNico Vertriest2020-01-172-2/+2
| | | | | | | | | | | | Task-number: QTBUG-79824 Change-Id: I5a39525e3e735415ba96e2d585c5de754deb15de Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-01-151-15/+14
|\| | | | | | | Change-Id: I8dbcf23835d52d3aa7d018ed250814d60c68aa83