Commit Graph

51952 Commits

Author SHA1 Message Date
Mårten Nordheim
9470529175 QNativeSocketEngine: Delete old win7 compat code
It's no longer used today.

And while we're at it: delete or fix typos in some nearby comments

Change-Id: Ib52268eeb936e71d6c09aece2e0833b99309ef2d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-14 19:56:16 +02:00
Timur Pocheptsov
46940ca737 H2: remove a rather useless limit on the number of streams
SETTINGS for max concurrect number of streams is 'one direction' - this
is how our peer conveys the possible number of streams _we_ can open,
not _them_. If they choose to have it unlimited - let it be so.

It's possible to send 0 as maximum number, also, it's possible to
reduce the maximum compared to initial at some point - then I have
to avoid integer overflows.

Pick-to: 6.2
Pick-to: 6.1
Pick-to: 5.15
Fixes: QTBUG-94470
Change-Id: Ia02247acbaedd70998a4cab02082ba10f45cf78c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-14 19:19:50 +02:00
Mårten Nordheim
76b0713d6e Schannel: Fix version functions
Previously they all returned the runtime versions and one string
function did not include the backend's name.
The NTDDI_VERSION macro is what we use to base certain
feature-availability on during compilation so it makes the most sense to
use for the build-string.

Pick-to: 6.2
Change-Id: I96b025a5a05c0bbb4db3d5ee68656e0df5f4eb07
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-06-14 15:55:41 +00:00
Mårten Nordheim
d325f63d99 QTimeZonePrivate: Reduce copying by not using QByteArray
QByteArray creates copies of data, but we usually don't need the copy
and a view, for comparison or fetching substrings, is enough. So instead
we use QBAView and QLatin1String (when we need to go through
QStringTokenizer).

Change-Id: I12e0bd8777fc63f676b9371abfd345fab1046c44
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-14 17:55:41 +02:00
Mårten Nordheim
b5da494b3f Update public suffix list
Task-number: QTBUG-94410
Pick-to: 6.2 6.1 5.15
Change-Id: I2ccf717dc7e0e70c4abd66956238ac3cca1d7a5d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-14 15:55:41 +00:00
Volker Hilsheimer
22571c21c9 Make dockwidget title bar buttons show again
Amends f61304fc77, which renamed the files
but didn't adjust the code.

Task-number: QTBUG-38776
Pick-to: 6.1 6.2
Change-Id: If54dd986975dd28f147a98628317b1369d0c690f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-06-14 17:55:41 +02:00
Mitch Curtis
9f918e1356 Add "We mean it" warning to qidentityproxymodel_p.h
This was missed in b42e2d70fb.

Pick-to: 6.2
Change-Id: Id06bd880456534293cf6c0d215f794b6ad0552ca
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-14 15:55:41 +00:00
Laszlo Agocs
cf7df972c3 Document that WA_TranslucentBackground will not have an effect
...if changed after the widget is shown.

Just documents the current state of things.

Task-number: QTBUG-60822
Task-number: QTBUG-59126
Pick-to: 6.2 6.1
Change-Id: If8281dce4457707a1673aca7a50744d8b231b030
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-06-14 16:53:01 +02:00
Edward Welbourne
a248dd6917 Clean up types in Unicode decomposition code
Use integral consts instead of enums for algorithm constants;
handle QChar::Decomposition as such, rather than as an int;
pass QChar pointers to cut down on reinterpret_cast<>s;
use char32_t instead of uint for UCS4.

Change-Id: Ia535128602065392a1b46fbb0a81572026be5d00
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-14 15:57:16 +02:00
Edward Welbourne
accdfbb396 Prefer QFAIL("Informative message") over QVERIFY(false)
Change-Id: I706b0aedfa870452331a8c2c488d55b279ee452a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-14 15:57:16 +02:00
Edward Welbourne
d2a4a5e601 Suppress gcc warning -Wmemset-elt-size on test code
The test uses a 64-unit array and deliberately clears various portions
of it, provoking a gcc warning:

 warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]

The calls to memset() do, in fact, have a sizeof(T) factor in their
size. Suppress this warning for the duration of that test.

Change-Id: I7d144d655a75f5ef4449fa3b956f80bcc509a83b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-14 15:57:16 +02:00
Volker Hilsheimer
2f9543c2ef QAIV: Don't open editor on release when press closed editor
A mouse press that transfers focus from an open editor back to the view
will close the editor. To prevent that the corresponding release then
opens the same editor again we need to know that the closeEditor call
was caused by the mouse press. Since Qt first generates the focusOut
event, and then delivers the mouse press, we have to start a zero-timer
to check whether we are in the same event delivery process. If so, ignore
the corresponding release.

Add test case that simulates that chain of events.

Fixes: QTBUG-20456
Pick-to: 6.2 6.1
Change-Id: I28fa32bfbc776db207c594c329961f575ae58ea9
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2021-06-14 13:01:52 +00:00
Paul Wicking
b43ec7e9f9 Doc: Fix snippet for QRandomGenerator64 docs
Pick-to: 6.2 6.1 5.15
Fixes: QTBUG-94347
Change-Id: Iaf007534214cffc83858833e80dad447df9b297a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-14 15:01:52 +02:00
Heikki Halmet
507499d4b6 Change Android emulator command path
Pick-to: 6.2
Pick-to: 6.1
Change-Id: I6e7df6cdf7f0a0a7efea8fb7672be0b3df096d12
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-06-14 16:01:52 +03:00
Edward Welbourne
76c8a988d2 Rework massageAdjusted and make the most of its DST knowledge
Since massageAdjustedDateTime() has to split LocalTime from TimeZone
and call {local,zone}MSecsToEpochMSecs() in any case, its call to
refreshZonedDateTime(), via checkValidDateTime(), was duplicating that
work uselessly. So handle UTC and offset-from-UTC separately with a
call to refreshSimple and handle local/zone time by inlining what
remains of refreshZonedDateTime() aside from the duplication.

At the same time, recent reworking of qt_mktime() make
localMSecsToEpochMSecs() handle its DST-hint the same way
zoneMSecsToEpochMSecs() has long done so, to take care of the intended
handling of DST gaps and repeats.

Change-Id: Id6bef7dd0f8983c3e923f4580a62a76aa6fcb810
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-06-14 15:01:52 +02:00
Sona Kurazyan
1bf75f2a66 Remove the dead code for blocking methods from QtConcurrent
After 79fd1cb2c6 the methods for running
QtConcurrent algorithms in the blocking mode aren't used anymore. Since
ThreadEngineBase and ThreadEngineStarter classes aren't meant to be used
externally, it should be fine to remove startBlocking() methods now.

Removed the unused code and adjusted the tests accordingly.

Change-Id: Ifb13820ce207869d6f720bcb5be8d35bb355fe33
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-06-14 11:52:36 +02:00
Nodir Temirkhodjaev
7dd4c93748 QException: Fix no-exception build
qtbase\src\corelib\thread\qfutureinterface_p.h(180): error C2039: 'setException': is not a member of 'QtPrivate::ExceptionStore'

qtbase\src\corelib\thread\qexception.h(109): note: see declaration of 'QtPrivate::ExceptionStore'

Change-Id: Id746b87af3f88d91c473f6a3d986dc0f022dfa2f
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-06-14 12:43:02 +03:00
Mårten Nordheim
20a31b1a39 Update CLDR qt_attribution.json
We updated to v39 in 6235893d54

Task-number: QTBUG-94410
Pick-to: 6.2 6.1 5.15
Change-Id: I73d539d677c9066dc5ceb6b4fc65fb544f39ac7f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-14 11:28:38 +02:00
Marc Mutz
734429f4a3 QDebug: add support for QVarLengthArray
Remove a conflicting definition of the same operator from
qrhi.cpp. Who knows how many ODR violations this hidden gem may have
caused...

[ChangeLog][QtCore][QDebug] Can now stream QVarLengthArray objects.

[ChangeLog][QtCore][QVarLengthArray] Can now be output via QDebug
streaming.

Change-Id: I12f7670e32029fa8c96b446e9a98ebf3b9732d0d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-06-13 21:01:24 +02:00
Giuseppe D'Angelo
cffc667ad9 QThread: avoid mixed enum arithmetic
It's deprecated.

Task-number: QTBUG-94059
Change-Id: If4fb81b650edb7cdb96980986dc4710a1a5040af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-13 15:05:33 +02:00
Giuseppe D'Angelo
b548c321d7 Port some fallthrough comments to Q_FALLTHROUGH
Change-Id: I70dd492d5c8d198589bfd642db63182cf17b133f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-13 15:05:32 +02:00
Giuseppe D'Angelo
4059af81d3 Stop using mixed enum arithmetic
It's deprecated. Port some unnamed enumerations (used only to
declare constants) to constexpr integers instead. Apply qToUnderlying
as needed.

Task-number: QTBUG-94059
Change-Id: Ifaa64ece966ce08df40dc71ffcfa7ac038110e0b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-13 15:05:32 +02:00
Alex Trotsenko
e650ea323f QWindowsPipeWriter: centralize write result handling
Both code paths (write() for the main thread and waitCallback() for
the worker thread) use the same logic when processing write results.
To avoid code duplication, consolidate the common part for both threads
in the startAsyncWriteLocked() function.

Change-Id: Ie2663b2ed221e2797a1ecbdb3fcee0ee8f030cc0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-06-12 22:44:53 +03:00
Kai Köhne
329683795d Remove outdated INSTALL file
One link was wrong. Also, the %VERSION%/%SHORTVERSION%
syntax seem to be some leftover from pre-git times?

All in all, I doubt the need for this file.

Pick-to: 6.1 6.2
Change-Id: I52e93b056d17e05831f97d6c34232b3265accba7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-12 09:06:17 +00:00
Kai Köhne
646d698ffe Allow building Qt examples with qmake in-source
This reverts commit c686e885c0
and commit d64abf8166.

We don't feature .qmake.cache/.qmake.super files anymore in the
source directory, so there's no problem anymore.

Change-Id: Ib820a109fbfbad70d85b0f14ef72915882217ca3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-12 11:06:10 +02:00
Kai Köhne
1f242e0ab0 Doc: Mention that you cannot order QVariants anymore
Pick-to: 6.1 6.2
Task-number: QTBUG-87263
Change-Id: I3d1332c43e4c06d47b249e4b9adb32685070f56a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-12 11:06:02 +02:00
Sona Kurazyan
02f521a59c Allocate progress related data on demand
Some of the data members related to progress reporting (min, max and
text) aren't used when user doesn't want manual progress reporting, so
the data for them can be allocated on demand, when the user explicitly
sets them. Note, that we still need to always create other related data
(current value and progress timer), since in the non-manual mode
progress is still reported by incrementing the current value each time
a new result is reported.

Task-number: QTBUG-92045
Change-Id: I1e5bd17de2613a6ea72ccff0029812f67686708b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-06-12 03:08:59 +02:00
Sona Kurazyan
6460c3c33d QFuture: put the result store and the exception store in a union
QFuture doesn't need both at the same time, calling QFuture::result(s)
either returns a result or throws an exception. Store result and
exception stores in a union, to reduce the memory.

Also added a note for making the ResultStoreBase destructor non-virtual
in Qt 7.

Task-number: QTBUG-92045
Change-Id: I7f0ac03804d19cc67c1a1466c7a1365219768a14
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-12 03:08:59 +02:00
Mårten Nordheim
e0ae1af278 QLatin1String: Add a constructor taking QByteArrayView
Change-Id: Ie90645486431d7af3fe8128417b0fb6bd02a88b5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-12 03:08:59 +02:00
Mårten Nordheim
77d62727d0 QTimeZonePrivate::territory: use QStringTokenizer
A follow-up to 6ec3321875 where the
function was optimized using a hand-rolled lazy-split on a QBAView.
Now that QLatin1String::indexOf(QLatin1String) has been optimized we can
use QStringTokenizer instead.

Change-Id: I30b15d309e7c364c0a4dafe31651b39ea14db7e5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-12 02:19:46 +02:00
Alexey Edelev
523ee5577a Replace flags with spaces when removing them
Removing flags based on REGEX may include spaces, so flags might be
glued. Replace flags with spaces to keep at least one space for
the described case.

Pick-to: 6.2 6.1
Fixes: QTBUG-94400
Change-Id: Ice268da36174ef5cf4398d2aee8fcd4731336316
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-12 00:30:23 +02:00
Mårten Nordheim
6f25051536 QNetworkReply: Decompress when reading
Rather than when the data is received. Source compatibility is
achieved through double-decompressing the data. This lets us know
how many bytes are available just as before but without having the
uncompressed data left in memory.

Fixes: QTBUG-83269
Change-Id: I352bd09581614c582e4628243e2a0e895ba4946b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-12 00:04:04 +02:00
Mårten Nordheim
f9b867216b String API Symmetry: test for indexOf with large negative offset
Small change needed to make QString_char16 and QString_QChar return -1
in this case, but other combinations already returns -1.

[ChangeLog][QtCore][Behavior Change] QString::indexOf(QChar) and
QString::indexOf(char16_t) now treat a negative start-position, from,
bigger than the string's size as invalid. It previously
clipped such start-positions to the start of the string, inconsistently
with other QString indexOf overloads.

Change-Id: Ic56c8a558bf40a94845c649647db569892d4df02
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-11 22:04:04 +00:00
Edward Welbourne
e6457d9b60 Ensure test using setlocale() doesn't leave it permanently changed
tst_QStringList::sort() wants to use the C locale; but, if it failed,
it left that in force, since it only restored the prior locale on
success. It should also use C.UTF-8, since Qt now wants UTF-8.

Change-Id: If62e3d8da682081bf969075a719d03caebf09233
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-06-12 00:03:53 +02:00
Volker Hilsheimer
b65159a5ea Deliver WindowActivate/Deactivate events to QWindow
We need those events to trigger palette color group changes in QQuickItem
without having to connect every item to yet another QWindow signal.

Task-number: QTBUG-93752
Pick-to: 6.2
Change-Id: I8534808cdaab828e5876f8fda31567aeb1b4272a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-11 23:30:09 +02:00
Edward Welbourne
421c69fde5 Add .UTF-8 suffixes to locale-names passed to setlocale()
We use UTF-8 locales by default since Qt 6; and relatively few systems
have the encoding-unspecified locales we were trying to use, with the
result that the setlocale() calls all failed.

Task-number: COIN-689
Change-Id: Id791ba269bf4abac29da3daa4fd01684ca9caa7a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-06-11 23:30:09 +02:00
Edward Welbourne
81fbcc4dc6 Remove two QEXPECT_FAIL()s that no longer appear to be valid
Because they were followed by a QVERIFY(false), no-one noticed until
now. Dates from 2011, when ICU support was first added. I guess
someone fixed the problem in the intervening decade.

Change-Id: I847816c297156e65397c652767f286bc4de193a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-11 23:30:08 +02:00
Edward Welbourne
f9469990d0 Fix date parsing when local time lacks the start of the day
The case where a parsed date-time fell in a transition, but only
because the default value for some field lead it there, only dealt
with the case of parsing a date-time, which is the only time it should
be relevant. However, since the date and time do get combined as a
date-time (even when only one of them is relevant) the same problem
could arise when parsing a date (on which the current time-zone
happened to make a transition at the start of the day) or a time (if
the default date happens to be one on which the current zone had a
transition).

So handle both of those cases, as well as the date-time case.

Fixes: QTBUG-91120
Pick-to: 5.15 6.1 6.2
Change-Id: I565d115eb85cd2ee69fa500fcd40b05bcf8f6fff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-11 23:30:08 +02:00
Edward Welbourne
df01accf97 Record useful URL in qlocale_unix.cpp
The Open Group's documentation of the meanings of the
locale-determining environment variables.

Change-Id: I5e3ae7de033b569b1c691b85ed65e441832359c4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-11 23:30:08 +02:00
Mårten Nordheim
b24e689cb5 QLatin1String: optimize indexOf
Some time ago I wanted to use QStringTokenizer with a QL1S haystack and
needle to optimize a particular bottleneck. Only to realize the new
bottleneck was more expensive (continuously converting both the strings
to QString).

Change-Id: Ica86db0043c839c2336a3c3886ffbe3875659b5b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-11 23:30:08 +02:00
Allan Sandfeld Jensen
de2c3ccd49 Fix reading gamma from PNGs without ICC profile
The decoding of PNG_INFO_gAMA to QColorSpace was incorrect, the PNG
gamma is the inverse of the gamma value we use. We revert it
everywhere else, just not here.

Pick-to: 6.2 5.15
Change-Id: Ic0ae1963b2dde3004cac8a6430ddaf99e7096915
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-06-11 21:30:08 +00:00
Nodir Temirkhodjaev
a0524a8443 QSemaphore: Fix warning in 32-bit build
qtbase\src\corelib\thread\qsemaphore.cpp(157): warning C4293: '>>': shift count negative or too big, undefined behavior

Change-Id: Iddf76e52770576bd57a4630884c0e0d6310cd4ff
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-06-12 00:26:23 +03:00
Mårten Nordheim
1c164ec7f2 QLatin1String: Add overloads taking QLatin1Char
Without the overloads using QLatin1Char in QL1S member functions results
in the QL1Char being converted to QChar and QL1String being converted to
QString.

Change-Id: Ic19545539a207f025a6293f0b2d929de475dc166
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-11 20:25:05 +02:00
Mårten Nordheim
aabdf87657 QLatin1String: Remove a non-null assert in comparison
It's a latin-1 string so embedded nulls are weird, but it makes it
easier for the follow-up patch adding overloads for QLatin1Char.
A test case in tst_qstringapisymmetry.cpp, which checks handling of
"empty" values, end up with a '\0' latin-1 char. Which makes the code
assert.

Change-Id: I0ff6628087cfac4d875b19f572c59ef7b5406293
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-11 20:25:05 +02:00
Marc Mutz
16f695f8a8 tst_qsettings: reliably remove the empty.ini file
... using QScopeGuard.

Change-Id: I3693ca5e5ef32aa7ccabaa7e05a94bee69e0910b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-11 20:25:05 +02:00
Fabian Kosmale
44fa80cbd4 QObject: Fix memory leak in queued_activate
queued_activate adds a reference to the slot object. It also attempts to
deref it again, but that did not work correctly so far. We could end up
with
T1                              |             T2
queued_activate                 |
  checks isSlotObject           |
    adds ref                    |
  locker.unlock()               |
                                | QObject::~QObject
                                |  //In disconnect all senders loop
                                |  sets isSlotObject to false
                                |  derefs slotObj, but not deleted
  checks isSlotObject           |
  (no deref because it's null)  |

To solve this issue and others caused by early returns, we now use a
RAII helper, which always takes care of calling destroyIfLastRef if the
ref count has been incremented.

Change-Id: I9c011cdb8faa5f344d7e70f024fc13f407e39ccf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-11 19:45:27 +02:00
Alexandru Croitor
1d05dcb3ec CMake: Fix Qt tool apks not to be built as part of default all target
The code already checked for QT_BUILDING_QT to decide whether the
'apk' target should be part of the default 'all' target, but it only
worked properly for qtbase.

The 'apk' target was created before the value of QT_BUILDING_QT is set
when building other repos like qttools.

Postpone the decision on whether 'apk' should be part of 'all' to the
first call of qt_add_executable -> qt_android_add_apk_target.
At this point QT_BUILDING_QT will be defined.

Achieve that by relying on an additional 'apk_all' target as an
implementation detail.

Amends 8b8679f73d

Pick-to: 6.2 6.1
Fixes: QTBUG-94442
Task-number: QTBUG-94264
Change-Id: I92ff0a7eef2caad244340ab7835e77c9fb3377c0
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-11 19:23:03 +02:00
Mårten Nordheim
d245e3a788 QNetworkInformation: Rename the plugins and type
To better match other plugins in Qt

Pick-to: 6.2
Change-Id: I6ab19603f13c80a8afe4fe69f64669559a0eea15
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
2021-06-11 19:23:03 +02:00
Edward Welbourne
f6f6d06028 Remove pure-virtual-signals.h include from tst_moc.cpp
The relevant test is conducted by tst_Moc::warnOnVirtualSignal(),
added in 2009, <quote>

    Fix Warning saying that signal cannot be made virtual

    The test for virtual signal did not work.
    But we cannot make an error right now or it might break existing code
    (exemple in task 210879)

</quote> but without removing the #include, so we do still get a
warning about that when building tst_moc.

Pick-to: 6.2 6.1 5.15
Change-Id: I5ea18058f22bbd483d1ff18b0ca7b360f6674ed9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-11 17:12:12 +02:00
Edward Welbourne
063b421251 Correct handling of last second of 1969 (again)
In my prior attempt to handle the last second of 1969, I forgot that
the QTime we're describing is a local time, so whether *it* thinks
we're at the last second of the day is beside the point. Fortunately,
preceding second should get -2 as return if mktime()'s initial -1
actually meant the last second of 1969, so we can test via that, after
a cheap pre-test to save doing this too often (albeit we only even
attempt the check if mktime() returned -1 in any case).

Restructured qt_mktime() in the process to deal with the error case's
early return promptly instead of doing it in an else clause. Also
repackage the calls to mktime to isolate various quirks and simplify
the logic in qt_mktime(). This also prepares for setting tm_isdst as a
hint when we know when we came from, in massageAdjustedDateTime().

Refined one test, added two more test cases. These didn't fail before
this fix, but a judiciously-placed qDebug() in testing revealed that
localMSecsToEpochMSecs() resorted to its fall-back handling - as if
the date-time were outside the time_t range - due to qt_mktime()
failing, for these test-cases (and several others). This fix evades
that fall-back behavior; a judiciously-placed qDebug() shows none of
our test-cases now fail callMkTime().

Change-Id: I11aa5015191dc4a565c28482307f7bc341c207e7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-11 17:12:12 +02:00