Commit Graph

55660 Commits

Author SHA1 Message Date
Mårten Nordheim
bf6d313ec8 QErrorMessage: fix deprecated warning about standardIcon
Change-Id: Idf50c1b74fddfccded2003528181f81a7a0ca8ac
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-05 00:30:58 +01:00
Mårten Nordheim
148d52e04d QMessageBox: fix deprecated warning about using old ctor
Change-Id: Ib53962e3527e2703af5ff36ce2fd4bd5ea987d85
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-05 00:30:58 +01:00
Mårten Nordheim
76016d9948 QPrintDialog/win: Fix use of deprecated QMessageBox::warning
by using the new one

Pick-to: 6.3 6.2
Change-Id: I8779107079c4e3d4b1d48c05b6fbfef1b6e98b99
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-05 00:30:58 +01:00
Mårten Nordheim
fd72c0d26c QSqlTableModel: suppress deprecation warning
It's just a proxy-setter so we cannot really avoid the call

Pick-to: 6.3 6.2
Change-Id: I4230075a906c100ddb9722160859e7a2c8e26ebc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-05 00:30:58 +01:00
Sergio Martins
006aa6c2ee Fix QWindow::mapTo|FromGlobal() for the embedded case
The code didn't make much sense:
    - QHighDpi::fromNativeLocalPosition should not take global positions
    - QPlatformWindow::mapFromGlobal() should not take local positions

Tested with a basic MFC window that has a QMainWindow as child
(parented with QWinWidget from QtWinMigrate). Menus would be off
when on a secondary screen with dpi factor > 1

Change-Id: Ib5cbf5d29ed97c786f7f7ba4e868b70cb5435239
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-03-04 22:53:44 +00:00
Assam Boudjelthia
daf7f07c1b Android: terminate argv passed to main() with nullptr
the char array of argv passed to the app's main() function
need to be null terminated [*] and argv to be **char.

[*] http://eel.is/c++draft/basic.start.main#2

Fixes: QTBUG-101028
Pick-to: 6.2 6.3 5.15
Change-Id: I6e3a685f092a92a94f60d166357b75d2538af74c
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-03-05 00:36:40 +02:00
Edward Welbourne
f0333355dd Add tests for an assertion seen on Windows
QDateTimeEdit's default constructor instantiates the start of
1752-09-14 as its default earliest time; however Friedeman has seen
this triggering an assertion. The QDTE tests should be picking that up
anyway, but let's overtly test it in QDate's startOfDay testing, too.

Change-Id: Ifae87f2695ac3a7993c173a7c21809c87d5daa71
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-04 23:26:13 +01:00
Edward Welbourne
93526430a5 Correct handling of {next,previous}Transition before FIRST_DST_YEAR
A recent change introduced a cut-off in believing MS's claims that a
zone has always had a yearly cycle of DST, to stop believing it before
1900, as no actual zone adopted DST that early. However, this was only
applied to the data() method to get the data for a specified time;
failure to do the same for {next,previous}Transition lead to
inconsistent results and tripped up an assertion. The change to data()
also failed to consider the situation of a southern hemisphere zone,
for which the rule will claim the early part of the year was in DST;
and init() should also mark an initial DST-recurrence rule as starting
no earlier than 1900.

Add corresponding FIRST_DST_YEAR checks to {next,previous}Transition()
to be consistent with the one in data(), refine data()'s checking and
amend init().

This amends commit 9a83706046

Pick-to: 6.3
Fixes: QTBUG-100873
Change-Id: Ic9822b87caa01561bc0b7d0355963e4c80ef047c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-04 23:26:12 +01:00
Edward Welbourne
be79443b68 Fix inverted condition on year starting in DST
The first transition in a year with DST is *to* DST precisely if the
year *doesn't* start in DST, not if it does.

Also fix the startsInDst() check it's using there, which neglected the
possibility that the year's DST transition might be faked.

This amends commit d98b43005e

Pick-to: 6.3
Change-Id: I17422fa9972f826b5bf7e325f5e579f41300fd97
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-04 23:26:12 +01:00
Edward Welbourne
fe4c93652c Improve handling of newYearOffset in qtimezoneprivate_win.cpp
In nextTransition() it wasn't being carried over from one rule to the
next, as intended. It needs to be defined at function level, set for
the first rule and updated for each new year tried. Also assert that
it does faithfully reflect the standard time in rules without
transitions.

In the process of fixing that, since it's computed from the
yearEndOffset() of a prior year, test whether that year is less than
the rule start rather than whether the present year is less than or
equal to it. As the prior year is immediately before the present year,
this makes no difference, but it clarifies the reasoning.  Apply this
clarification also in data() and previousTransition() for consistency.

Pick-to: 6.3
Change-Id: I29c41e67784eaae13b83f6ae1ad16509e636c187
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-04 23:26:12 +01:00
Edward Welbourne
8bf0fbca70 Consistently treat times before first rule as in its standard time
In QWinTimeZonePrivate::previousTransition(), an initial no-transition
first rule was interpreted as implying a transition to its standard
time at "the start of time". Do the same for times before the start of
the first rule even if it is a DST recurrence; and, in data(), treat
times before the first rule as being in its standard time.

In the process, restructure data() to do that early return first,
instead of in an else clause, so as to dedent the other branch of its
code and make clearer how it fits into its outer loop.

Pick-to: 6.3
Change-Id: I21482d904c33542bf04f6510b974c01817d7aa5f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-04 23:26:12 +01:00
Edward Welbourne
8a52555d3f Fix handling of out-of-range years in QTZP_win
A transition outside the range of qint64 would be mapped to
invalidMSecs(), the same as the fake-detection sets a fake transition
to. This would have lead to a year at the boundary of qint64's range
being mistaken for a fake-DST year. So replace the fakesDst() method,
that compared transition times to invalidMSecs(), with an actual
boolean member that gets set when detecting fake DST, so that the
detection is correctly done.

Pick-to: 6.3
Change-Id: Iadc80973bc033915733c4a4f4ccfdd3863025fb4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-04 23:26:12 +01:00
Edward Welbourne
0efebf168d Correct fake-DST detection and handling in QTZP_win
The end-of-year checks previously presumed they would accompany a zero
daylight-savings change there; however, this misunderstands what a
fake transition is doing. A fake at the end of the year means that the
transition during the year is out of the time the fake claims it goes
into, so the offset nominally in effect after the fake should match
the offset the year started in, the same as for a year-start fake.
However, implementing that exposed the fact that Bangladesh's brief
flirtation with DST in 2009 ended at the end of the year, and MS's
data has no other instance (aside from entirely bogusly claiming that
Bhutan did the same in 2009) of an end-of-year transition, in
particular no fake transitions. So the end-of-year case for faking
does not arise and I've eliminated it from the code here. This
greatly simplifies the code to detect fake DST rules.

At the same time, in the ruleToData() wrapper, use the transition
implied by isDst only if it isn't the fake one; the other is the only
real transition in the year anyway, however described. Also, extract
the detection of start-of-year transition times to a function and make
it more exact.

Pick-to: 6.3
Change-Id: Ide160d28e7cca37c224f40164ebe7f9a17f028e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-04 23:26:12 +01:00
Edward Welbourne
4959f8a34b Clip dataForLocalTime()'s bracketing window's start to minMSecs() + 1
The minMSecs() itself is one more than the type's min(), which is used
as invalidMSecs(). As (at least) the Windows back-end uses minMSecs()
as the time of a start-of-time transition (that we'd like to find as
our current transition), use one more than it as lower-bound for where
to search from for a previous transition, so that we do find that
first ever transition.

Pick-to: 6.3
Change-Id: Iae861e740e02bd38ffb2af77aff625d3b48182d2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-04 23:26:12 +01:00
Edward Welbourne
8024498a36 Use QDateTimePrivate's methods in preference to std::numeric_limits
The methods give them more appropriate names. This revealed one place
where the min() that's actually invalidMSecs() was being used for a
time that should have been in the supported range, so amend that to
use minMSecs(). Replaced a use of invalidMSecs() + 1 with minMSecs(),
to which it is equal, as that was the meaning it was used for.

At the same time, make those methods constexpr (because they are) and
[[nodiscard]], since their values should be used, while dropping their
fatuous inline (the bodies are inline in the declarations).

Pick-to: 6.3
Change-Id: Idcd51c55850573372b44e6fcf08d5d2665b8a60e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-04 23:26:12 +01:00
Ivan Solovev
5133ed072a Android: skip crashing tst_QPlainTextEdit::ensureCursorVisibleOnInitialShow
The test crashed for some reason, so other testcases are also not
executed. Skip the test for now to enable more tests in the CI

Task-number: QTBUG-89402
Pick-to: 6.3 6.2
Change-Id: I5ad38645d1b8f86c64da7208c0ae4f66d126c7d9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-04 22:20:18 +01:00
Ivan Solovev
79dcb2657c Android: unblacklist tst_QPlainTextEdit tests
Most of the blacklisted tests were already fixed earlier.

The tst_QPlainTextEdit::adjustScrollbars() test needed a small fix
to show the window non-fullscreen, so that the scrollbar could appear.

Task-number: QTBUG-87423
Task-number: QTBUG-89402
Pick-to: 6.3
Change-Id: I849f411a5798053742323fc4db3fe30f2b690a8b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-04 22:20:18 +01:00
Pasi Petäjäjärvi
e0023ae353 Revert "Workaround MinGW not handling error suppression macro correctly"
This reverts commit 293b7fab55.

Reason for revert: Since Qt 6.2 MinGW 8.1 is not anymore supported

Pick-to: 6.2 6.3
Change-Id: I9b2e5e08bee663d5289a69218493911544671e79
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-03-04 20:16:06 +00:00
Tor Arne Vestbø
b5144d2722 Update QFileInfo docs to mention macOS aliases
The LegacyLinkType reflected by isSymLink() includes
QFileSystemMetaData::AliasType.

Pick-to: 6.3 6.2 5.15
Change-Id: I98c84573f7f05d6d183b6ce1e22fc7424ed8e730
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-04 20:13:09 +01:00
Marc Mutz
1775029c9b Prepare for QByteArrayView number parsing modernization
Remove the unholy bool out parameter and make QtPrivate::to{Double,
Float,{Signed,Unsigned}Integer}() return a struct instead.

The struct contains what we'll most likely need for a full
QParsedNumber in the future: the value, an error code (always zero
atm), and a pointer to the first character that wasn't parsed (always
nullptr atm), so we don't need to change the ABI when QParsedNumber
eventually lands.

As an immediate positive contribution, even without the backend ported
away from bool out parameters, the functions can now be marked as PURE
and, in case of the FP versions, also noexcept (the int versions have
a narrow contract d/t the base argument, which, unlike the return
value, can be fixed later, by overloading).

Pick-to: 6.3
Change-Id: I67945af80a9b53d6f170502a6df3384895e82d3e
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-04 19:49:15 +01:00
Marc Mutz
1931689c7d tst_qstringapisymmetry: check QString/QAnyStringView overloads w/Q_WEAK_OVERLOAD flipped
This overload set may come in handy to cushion some of the concerns
regarding replacing QString functions with QAnyStringView ones.

Overloading with a Q_WEAK_OVERLOAD QAnyStringView function requires
users to jump through hoops in order to avoid the QString overload,
but with the Q_WEAK_OVERLOAD roles reversed, the QAnyStringView
overload becomes the preferred version, relegating the QString
overload to a fall-back to facilitate sharing where it makes sense
(e.g. for QObject::setObjectName()).

Pick-to: 6.3
Change-Id: Ic65ead505beee627976a306e2d430e800540a600
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-03-04 08:39:07 +01:00
Giuseppe D'Angelo
400867693b QCryptographicHash: code tidies
Rename the resize() function of its internal buffer into the possibly
better resizeForOverwrite(). The point is that unlike an ordinary resize
the data in the buffer is NOT initialized, and therefore must be
overwritten by the caller, "or else".

Change-Id: I7d82821e92f59f7eeab18c51d98003826ffe164b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
2022-03-04 04:46:47 +01:00
Sona Kurazyan
ebfe4318b8 Fix tst_qstringapisymmetry::count* to test all argument combinations
Use two template parameters for the haystack and needle types, to test
all possible combinations of all argument types.

Note that the tests for QByteArray::count() are removed: it doesn't
make sense to have them in tst_qstringapisymmetry, and we already have
the symmetry tests for QByteArray in tst_qbytearrayapisymmetry.

Change-Id: I33901fd135eb7433f0d45300a7248aef4d40324a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-03-04 04:05:12 +01:00
Sona Kurazyan
b8755e2a4d Fix an error in tst_QStringApiSymmetry::count_impl()
Don't use the haystack as needle when testing count() for QLatin1String.
This wasn't caught earlier, since QLatin1String has no count() yet, and
the codepath was never tested.

Pick-to: 6.3 6.2
Change-Id: I2764070894ddce047eceaea52456e5a521252dab
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-04 04:05:12 +01:00
Thiago Macieira
0c3ac95899 Logging: use GCC #pragma to suppress the frame pointer
We have a few lambdas now. However, GCC probably inlines everything
anyway in release mode, so this is likely moot.

Change-Id: Ic15405335d804bdea761fffd16d50573621446ab
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 19:05:12 -08:00
Thiago Macieira
bd728d1149 Logging: cache the last library file name in a backtrace
They usually come in groups, so this avoids extra work.

Change-Id: Ic15405335d804bdea761fffd16d4fb5c41e122f0
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 19:05:11 -08:00
Thiago Macieira
ff2535de5c Logging: add support for decoding backtraces using dladdr()
I'm pretty sure that's what backtrace_symbols() uses internally anyway,
so skip the middle-man.

Change-Id: Ic15405335d804bdea761fffd16d4fb2a1b0c2171
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 19:05:11 -08:00
Thiago Macieira
1cad4ed6a1 Logging: reorganize the backtrace code for simplicity and readability
Also removed the Qt::CaseInsensitive searching, which was slow.

Change-Id: Ic15405335d804bdea761fffd16d4f863847c360b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 19:05:11 -08:00
Thiago Macieira
ee7166e176 Logging: remove magic constant from backtrace code
Explain what that number 8 is by way of a comment and a constant.

Pick-to: 6.2 6.3
Change-Id: Ic15405335d804bdea761fffd16d4f7567089c575
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 19:05:11 -08:00
Thiago Macieira
6358bc9331 Logging: rejiggle the way we detect the availability of backtrace() API
We had proper CMake tests for all we needed, so we can drop the old
detection we were forced to use way back when. Said test (CMake's own
FindBacktrace.cmake) even found QNX's offering, which we reported as
"yes" in our configure output, but never actually used because it was a
different API. Now we'll report "no" for QNX.

Pick-to: 6.3
Change-Id: Ic15405335d804bdea761fffd16d4f73cfe4cf38a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 19:05:11 -08:00
Thiago Macieira
50132fb54b Logging: fix encoding of backtrace lines
File and function names are UTF-8 on Unix.

Pick-to: 6.2 6.3
Change-Id: Ic15405335d804bdea761fffd16d4fb71ec2b0d71
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 19:05:11 -08:00
Ivan Solovev
d589f3eefe Android: unblacklist tst_toolsupport::offsets
The test is no longer failing on Android in dev and 6.3, but still
failing in 6.2.
I think it's fixed by 63a35898f4
which is integrated into dev and 6.3

Task-number: QTBUG-87396
Pick-to: 6.3
Change-Id: I82e0aac1547f8e43353f0948cd3f91b4b8f9720e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-04 02:37:11 +01:00
Ivan Solovev
79fb80152f Android: make sure that orientationChange is reported after resize
On Android orientation changes are reported from the
DisplayListener.onDisplayChanged() method, while the screen size
changes are reported from QtLayout.onSizeChanged().
In practice these callbacks come in random order, so rotating the
screen multiple times might result in inconsistent order of signals
and events.

This patch makes sure that size change events always happen before
orientation changes. This is done by caching the new orientation
values and reporting them only when needed. At this point we also
need to use QMetaObject::invokeMethod() for orientation change,
like it is done for geometry change. Otherwise the orientation
update can still be processed earlier than the geometry change.

Also note that at some point we might get an orientation change
without a size change (for example Qt::LandscapeOrientation ->
Qt::InvertedLandscapeOrientation). That is the reason for
isSimilarRotation() helper function.

As a drive-by: ignore size changes with inconsistent values when window
size is reported to have old orientation, while the screen has already
been rotated. In such cases a new size change will be triggered shortly
with normal value.

Task-number: QTBUG-94459
Pick-to: 6.3 6.2 5.15
Change-Id: I5c98e526d0370d380344b2297169d5e0c0ee8ea7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-04 02:37:11 +01:00
Ivan Solovev
285ea13286 Android: set all QScreen's geometry-related parameters together
Screen has 3 parameters:
- physical size
- screen size (or screen geometry)
- available geometry

Before this patch, they were reported in 3 different methods. Screen
size update and available geometry update both were generating the
"screen geometry changed" event, that updated the user-visible
parameters. As a result, at some point we could end up in an
intermediate state, when screen size was already updated, but
available geometry was not yet updated.
This was specially visible while changing the screen orientation:
at some point screen geometry could be reported for the new
orientation, while the available geometry - still for old orientation.

This patch introduces a new method to set all geometry-related
parameters together and generate only one "screen geometry changed"
event. This allows to maintain consistency between 'geometry' and
'availableGeometry' properties of QScreen.

Task-number: QTBUG-94459
Pick-to: 6.3 6.2 5.15
Change-Id: I844f6d0db87df8d5e6e9bcce5d27126384a5a0de
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-04 02:37:10 +01:00
Alexandru Croitor
eec317a138 CMake: Generate wrapper shell scripts for all hosts when requested
This is useful for Qt for Android builds, where we want to build Qt on
a single host, but make the Qt installation usable on any host
(Windows, Linux, macOS).

There are only two flavors of shell scripts, unix ones that use sh and
Windows batch files.

If Qt is configured with
-DQT_GENERATE_WRAPPER_SCRIPTS_FOR_ALL_HOSTS=ON
then we generate both of them regardless of the current host platform.

Note that the target_qt.conf file still needs to be patched to specify
a correct HostSpec value so that qmake operates correctly.

Other target_qt.conf values might also need path adjustments depending
on use case (like HostPrefix and HostData).

Pick-to: 6.2 6.3
Task-number: QTBUG-101357
Change-Id: Ic86caaa8b318467528cc82dc7fbfecde998cdb71
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-03-04 01:58:10 +01:00
Sona Kurazyan
e440fec7fc Add literal operators for QLatin1String and QLatin1Char
The operators are declared in the Qt::Literals::StringLiterals
namespace, to avoid collisions in the global namespace.

[ChangeLog][QtCore][QLatin1String] Added literal operator""_L1 that
converts string literals and chars to QLatin1String and QLatin1Char.

Fixes: QTBUG-98434
Change-Id: Ia945a6acf4b8d4fbbb5f803264e4d79d7b17a8da
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-03-04 01:58:10 +01:00
Giuseppe D'Angelo
d45d62f09d QBitmap::fromPixmap: document \since
Change-Id: Ia8b4e20dc98e3b184b6e2ba9844907f813dbc1ab
Pick-to: 6.2 6.3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-04 01:58:10 +01:00
Magnus Groß
3c6b61a6e1 xdgdesktopportal theme: Implement appearance()
We can use the new org.freedesktop.appearance color-scheme setting in
the XDG Desktop Portal Settings to implement this in a DE-independent
way.

In the future we can also use the related "SettingChanged" signal in the
Desktop portal to support changing the theme during runtime.

Useful links:
Spec: d7a304a006/data/org.freedesktop.impl.portal.Settings.xml (L33-L45)
Blog post: https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/

Task-number: QTBUG-93955
Pick-to: 6.2 6.3
Change-Id: Ia5df22fb215ee94d68d2787da97a1c9f8f2c6b0c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-03-04 00:58:10 +00:00
Giuseppe D'Angelo
742ffd0f47 QDebug: streamline (private) formatQFlags
The implementation for extracting a QMetaEnum from an enumeration
type was duplicated from QMetaType::fromEnum, just use that one.
Also add an explicit cast for the valueToKeys call.

Change-Id: I51b1a214dbab2101ae704954727acf0219eb1604
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-03-04 01:26:53 +01:00
Marc Mutz
e93bf391fa Fix QTest::toString() over QT_TYPESAFE_FLAGS QFlags
QT_TYPESAFE_FLAGS allows explicit casts only to QFlags<T>::Int, which
is either int or unsigned int. The cast to the resp. other type fails.

To fix, first convert to QFlags<T>::Int with toInt(), and only then
cast to int or unsigned int.

Fixes: QTBUG-101399
Pick-to: 6.3
Change-Id: Ie74d53adc601cdf19708265b040092780676058f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-03-04 01:26:53 +01:00
Thiago Macieira
8e56a7bc6b qsimd.cpp: don't disable SSE FP math
Lowering the architecture all the way to the i386 baseline without SSE2
was causing warnings about disabling SSE FP math. We don't need to go
that low for 32-bit.

Task-number: QTBUG-101198
Change-Id: Ibf4acec0f166495998f7fffd16d682d0f5beec11
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-03 15:44:54 -08:00
Thiago Macieira
e8d3cf0909 qsimd.cpp: fix _FORTIFY_SOURCE=2 builds
That option makes printf() and some other functions become always_inline
functions with extent checking. Unfortunately, that also means GCC fails
to inline them when we're not compiling for the same target as
X86_BASELINE.

Fixes: QTBUG-101198
Change-Id: Ibf4acec0f166495998f7fffd16d682c7a7be94d8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-03 15:44:54 -08:00
Alexandru Croitor
7b94f87689 coin: Ensure we configure repos with CMake verbosity set to STATUS
We set the default verbosity of configure output to NOTICE in
regular Qt builds.
To preserve the STATUS verbosity in CI runs, we now pass it
explicitly when configuring all repos / tests.

Pick-to: 6.2 6.3
Change-Id: Ib63739c05855cfd5951d38ce3f8a7fc8d1218cd3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-03-04 00:21:44 +01:00
Alexandru Croitor
e2a0ddbb69 CMake: Make configure less verbose by default
Only show the more verbose configure output when configuring
with -developer-build (which matches --log-level=STATUS)

Otherwise in a non-developer build, restrict the output
to NOTICE+ message (includes WARNINGs and ERRORs).

Developers can still pass a custom log level when configuring.
For example -DCMAKE_MESSAGE_LOG_LEVEL=STATUS or
--log-level=STATUS.
The former method will be cached, while the latter is only applied
to the current configure invocation.

Also show the build instructions hint message only when configuring
for the first time.

[ChangeLog][CMake][configure] The configure output verbosity of
non developer-builds of Qt is now reduced by default. Pass
"-- --log-level=STATUS" to configure to make it verbose again.

Pick-to: 6.2 6.3
Change-Id: I7583a9c92142e0b1d7c5411b06403f40d8ebaf20
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-03-04 00:21:44 +01:00
Giuseppe D'Angelo
0deff80eab Associative containers: add a way to obtain a key/value range
Our associative containers' iterator's value_type isn't a destructurable
type (yielding key/value). This means that something like

  for (auto [k, v] : map)

doesn't even compile -- one can only "directly" iterate on the
values. For quite some time we've had QKeyValueIterator to allow
key/value iteration, but then one had to resort to a "traditional" for
loop:

  for (auto i = map.keyValueBegin(), e = keyValueEnd(); i!=e; ++i)

This can be easily packaged in an adaptor class, which is what this
commmit does, thereby offering a C++17-compatible way to obtain
key/value iteration over associative containers.

Something possibly peculiar is the fact that the range so obtained is
a range of pairs of references -- not a range of references to pairs.
But that's easily explained by the fact that we have no pairs to build
references to; hence,

 for (auto &[k, v] : map.asKeyValueRange())

doesn't compile (lvalue reference doesn't bind to prvalue pair).
Instead, both of these compile:

  for (auto [k, v] : map.asKeyValueRange())
  for (auto &&[k, v] : map.asKeyValueRange())

and in *both* cases one gets references to the keys/values in the map.
If the map is non-const, the reference to the value is mutable.

Last but not least, implement pinning for rvalue containers.

[ChangeLog][QtCore][QMap] Added asKeyValueRange().
[ChangeLog][QtCore][QMultiMap] Added asKeyValueRange().
[ChangeLog][QtCore][QHash] Added asKeyValueRange().
[ChangeLog][QtCore][QMultiHash] Added asKeyValueRange().

Task-number: QTBUG-4615
Change-Id: Ic8506bff38b2f753494b21ab76f52e05c06ffc8b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-03-04 00:21:44 +01:00
Edward Welbourne
dd5fc20e90 Minor clean-ups noticed during string-parsing improvements
Simplify a conditional to save some repetition, purge some spurious
parentheses.

Change-Id: I727d22ce81733e765c4ee951475ccdb599063399
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-03 18:50:59 +01:00
Edward Welbourne
9c58870423 Correct some typos and flat-out falsehoods in QTimeZone docs
Apparently the class docs didn't get an update when systemTimeZone()
was added (at 5.5). Also add QCalendar to the \sa.
Prompted by Jaishree pointing out a typo ...

Pick-to: 6.3
Change-Id: If6d38040fff4badc3c0bb765889c1289c560c2b0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-03 16:53:25 +01:00
Ievgenii Meshcheriakov
16b614f2e1 Network: Use system publicsuffix database copy when available
[ChangeLog][Network][QNetworkCookieJar] It is possible to use
system's copy of publicsuffix database when it is available.
This behavior is enabled by default on Linux and can be
controlled using new command line switches -system-publicsuffix,
-qt-publicsuffix, -no-publicsuffix, and -publicsuffix=all.

Fixes: QTBUG-95889
Change-Id: I911e1a13c1422cdc35851953309fff064e7c5f26
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-03 15:56:09 +01:00
Joerg Bornemann
f56c068ee0 pro2cmake: Fix indentation of INSTALL_EXAMPLESDIR assignment
Change-Id: If1f5d8b5afc76fac62fdf9836a17c4ab87ddc1b1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-03 15:56:08 +01:00
Joerg Bornemann
3d6c86ec57 pro2cmake: Fix static type errors in condition_simplifier_cache.py
Mypy reported the following:

condition_simplifier_cache.py:111: error: Argument 1 has incompatible type "*List[str]"; expected
"Optional[float]"
            file_handle = file_open_func(*file_open_args, **file_open_kwargs)
                                          ^
condition_simplifier_cache.py:111: error: Argument 2 has incompatible type "**Dict[str, object]";
expected "Union[str, Path]"
            file_handle = file_open_func(*file_open_args, **file_open_kwargs)

Fix by calling portalocker.Lock directly.

Change-Id: I538319791b1a4a1b6dffac0544d87c705e8809a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-03 15:56:08 +01:00