Commit Graph

50516 Commits

Author SHA1 Message Date
Volker Hilsheimer
4daf83a0dc Don't access data in moved-from object
It's undefined behavior, esp since we leave it to the compiler to
implement a move constructor for the ButtonInfo struct. So read the data
that we need first.

Fixes static analyzer warning
de76eedae524c86f89d6369c0f5af8c7.

Pick-to: 6.1
Change-Id: I8fc458b7e9ba8904ec7a3b1c26aac0628e336ea2
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-03-03 14:12:08 +01:00
Zou Ya
b487a7929d The condition 'if(oldChild)' is redundant
Either the condition 'if(oldChild)' is redundant or there is possible
 null pointer dereference: oldChild.

Pick-to: 6.1
Change-Id: I28971cfa33294679ddd325158669b422b3a1c2eb
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-03-03 20:52:45 +08:00
Kai Köhne
4a037e86d4 Merge "Improve support for QT_ADDITIONAL_PACKAGES_PREFIX_PATH" 2021-03-03 12:19:52 +00:00
JiDe Zhang
b18a845bef Merge "fix: Print a warning message if the Xcb EGL initialize failed" 2021-03-03 11:40:28 +00:00
Kai Köhne
5bbd700124 Improve support for QT_ADDITIONAL_PACKAGES_PREFIX_PATH
Allow to set QT_ADDITIONAL_PACKAGES_PREFIX_PATH as both an env
variable and CMake cache variable. Also normalize path and list
separators, so that they can be used similar to CMAKE_PREFIX_PATH.

The environment variable is intended to be set by the conan virtualenv
generator, so that e.g.

  find_package(Qt6 COMPONENTS NetworkAuth REQUIRED)

also works if NetworkAuth is not installed into the Qt prefix.

Pick-to: 6.1
Fixes: QTBUG-91142
Change-Id: Ia9f9b9fa2b1b051d33073629139640d0f4c7a843
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
2021-03-03 10:21:28 +01:00
Friedemann Kleint
65c6fbea24 Stabilize test QMenu::QTBUG_89082_actionTipsHide() on Windows, take 2
Use the QWindow-based overloads of QTest::mouseMove(), which do
not move the cursor position.

Amends ba13960392,
3f3d5e6716.

Task-number: QTBUG-89082
Pick-to: 6.0 6.1 5.15
Change-Id: I2cc62e4d1f24e4baebafd0d76fbf0fbdb6f588c7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-03-03 10:16:30 +01:00
Friedemann Kleint
4b15a8ea8f Prospective fix for flaky test tst_QDoubleSpinBox::setReadOnly()
The test has been observed to fail with:

 FAIL!  : tst_QDoubleSpinBox::setReadOnly() 'QTest::qWaitForWindowActive(&spin)' returned FALSE. ()
 /Users/qt/work/qt/qtbase/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp(863) : failure location

Remove the widget member and use a widget instantiated on the stack instead.
Add a check for top level widget leaks in cleanup() and fix leaking task224497_fltMax()
by instantiating the widget  on the stack.

Pick-to: 6.1
Change-Id: Idbbb5d859c0df2d9b9f49fb9f69ef6bb7d1ee150
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-03-03 10:16:22 +01:00
JiDe Zhang
cc7911beb1 fix: Print a warning message if the Xcb EGL initialize failed
Before, No matter what the value of "success" is, Will print
the "Xcb EGL gl-integration successfully initialized".
If egl initialization fails, this line of printing will be very
confusing.

Change-Id: I6a06e2c14372913823c56ffe2fd8b831e084c719
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-03-03 17:10:06 +08:00
Volker Hilsheimer
d984fd13ad QGraphicsWidget: don't dereference nullptr
Unlikely that one item is nullptr and the other item doesn't have a
scene, but we do already test for the scene pointer, so don't continue
if it's nullptr.

Fixes static analyzer warning f59576ecf6618447c4f9c7be93fc737f

Pick-to: 6.1
Change-Id: I6d436bb1211ddd412821d6978bab25192033f5e5
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-03-03 10:00:30 +01:00
Volker Hilsheimer
95e34f7fbc QGraphicsWidget: Check for nullptrs in focus chain handling
The while loops terminate if focusAfter becomes nullptr (unless we break
earlier), so don't dereference those pointers without checking first.

Fixes static analzyer warnings 979f2d508db4d5838f6c9b296120ce60 and
481f2ec7b5851bf19414478428f944b7

Pick-to: 6.1
Change-Id: I60fc5999907fe3b3146d7047ee1eff197719ab31
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-03-03 10:00:27 +01:00
Volker Hilsheimer
98db996576 Add nullptr checks to QGraphicsView classes
The styleInfo parameter defaults to nullptr, and the scene can evidently
be nullptr since we test for it before ungrabbing the mouse.

Fixes static analyzer warnings
fbd03604cc701651595a2ea33c5562b4 and
30fcb05194f3a2d121fc57b05e0ccf10

Pick-to: 6.1
Change-Id: I8e9d4fe4055115c366ada1cbb22a8f0839ba41da
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-03-03 10:00:22 +01:00
Ville Voutilainen
6e0ce4ee80 Android: make calling exit() conditional on an environment variable
Task-number: QTBUG-82617
Task-number: QTBUG-85449
Task-number: QTBUG-83043
Change-Id: I5ac67b5d57550e5a1f816e5db01f4aab31127283
Pick-to: 5.15
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-03-03 08:18:41 +00:00
Joerg Bornemann
b1ad7f938e Generate information about user-facing applications in build dir
When packaging different Qt versions for Linux distributions (or any
distribution with a common bin dir), Qt tools cannot be installed to
/usr/bin, because the executable names of the different Qt versions
clash.

To solve this conflict, our recommendation is to install Qt's tools to
/usr/lib/qt6/bin and to create versioned symlinks to user-facing tools
in /usr/bin.

User-facing tools are tools that are supposed to be started manually by
the user. They are marked in Qt's build system. Distro package
maintainers can now configure with
  -DCMAKE_INSTALL_PREFIX=/usr
  -DINSTALL_BINDIR=/usr/lib/qt6/bin
  -DINSTALL_PUBLICBINDIR=/usr/bin
and will find a file called user_facing_tool_links.txt in the build
directory after the cmake run. Nothing will be installed to
INSTALL_PUBLICBINDIR.

Each line of user_facing_tool_links.txt consists of the installation
path of a user-facing application followed by a space and the versioned
link name in INSTALL_PUBLICBINDIR.

Example content:
/usr/lib/qt6/bin/qmake /usr/bin/qmake6

To actually create the versioned symlinks, the content of this file can
be fed to ln like this:
  xargs ln -s < build-dir/user_facing_tool_links.txt

Or the package maintainer may decide to do something completely
different as suits their needs.

This patch adds the USER_FACING argument to qt_internal_add_tool to mark
tools as user-facing. In addition, every Qt created by
qt_internal_add_app is treated as user-facing.

The only tool this patch marks as user-facing in qtbase is qmake.

Pick-to: 6.1
Fixes: QTBUG-89170
Change-Id: I52673b1c8d40f40f56a74203065553115e2c4de5
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-03-02 22:00:51 +01:00
Alex Trotsenko
f265c87e01 Allow QWindowsPipe{Reader|Writer} to work with foreign event loops, take 2
When a foreign event loop that does not enter an alertable wait state
is running (which is also the case when a native dialog window is
modal), pipe handlers would freeze temporarily due to their APC
callbacks not being invoked.

We address this problem by moving the I/O callbacks to the Windows
thread pool, and only posting completion events to the main loop
from there. That makes the actual I/O completely independent from
any main loop, while the signal delivery works also with foreign
loops (because Qt event delivery uses Windows messages, which foreign
loops typically handle correctly).

As a nice side effect, performance (and in particular scalability)
is improved.

Several other approaches have been tried:
1) Using QWinEventNotifier was about a quarter slower and scaled much
   worse. Additionally, it also required a rather egregious hack to
   handle the (pathological) case of a single thread talking to both
   ends of a QLocalSocket synchronously.
2) Queuing APCs from the thread pool to the main thread and also
   posting wake-up events to its event loop, and handling I/O on the
   main thread; this performed roughly like this solution, but scaled
   half as well, and the separate wake-up path was still deemed hacky.
3) Only posting wake-up events to the main thread from the thread pool,
   and still handling I/O on the main thread; this still performed
   comparably to 2), and the pathological case was not handled at all.
4) Using this approach for reads and that of 3) for writes was slightly
   faster with big amounts of data, but scaled slightly worse, and the
   diverging implementations were deemed not desirable.

Fixes: QTBUG-64443
Change-Id: I66443c3021d6ba98639a214c3e768be97d2cf14b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-03-02 22:53:06 +02:00
Timur Pocheptsov
d316ae8e83 QSsl: fix UB pointer use
Weird macro had inverted notion of type safety: instead of casting
parameters and return values (they are pointers) to work with generic
OPENSSL_sk_xxx functions, it was ... casting a function pointer to an invalid
type to get ... nothing, but UB. Home-brewed (un)'safestack'!!!

Change-Id: Ib91a7ba4cd472f370836797e422456f91a4385b0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 9fc2f1f076b953ff0979fb73ed6e70ac9bde278c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-02 18:03:54 +00:00
Timur Pocheptsov
79138e41d6 Move QSslCertificate's details and cert-related code to the plugins
Also since we have to properly support 'no-ssl' configure option
(alas, we support QSslCertificate on such builds) - introduce
a minimal crippled QTlsBackendCertOnly, which depends on
X509CertificateGeneric.

Fixes: QTBUG-90954
Task-number: QTBUG-65922
Change-Id: Ib9d62903f16b7c0eaaa23e319a822c24a7631dc6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 41fc143635c25f937a557f09890601f6c7d38736)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-02 18:03:00 +00:00
Giuseppe D'Angelo
49bed939b6 Merge "Add the 6.2 deprecation macros" 2021-03-02 16:55:19 +00:00
Morten Johan Sørvig
2a5262c0dd Merge "High-DPI: Set the minimum scale factor to 1" 2021-03-02 16:00:51 +00:00
Giuseppe D'Angelo
29c2a6059f Add the 6.2 deprecation macros
... which makes me wonder, why isn't this stuff bumped automatically
when a minor version branch is created?

Change-Id: Ia43f898163a4baa0896a09bd13d65cf534fe1df5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-03-02 15:20:11 +01:00
Volker Hilsheimer
f28088873e Merge "QLabel: simplify createStandardContextMenu" 2021-03-02 13:58:43 +00:00
Morten Johan Sørvig
ee409e6f0c High-DPI: Set the minimum scale factor to 1
Avoid painting errors with dpr < 1, also for the PassThrough
mode.

This limits the minimum high-dpi scale factor to 1,
for the code path which determines the scale factor
based on screen DPI.

Pick-to: 6.1
Task-number: QTBUG-89948
Change-Id: I14b3f130f0ae141d5f05c87437f926a9f76d1dec
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-03-02 13:36:38 +00:00
Volker Hilsheimer
e718818745 QLabel: simplify createStandardContextMenu
If control is nullptr in the beginning, then it will be nullptr later as
well, and the function won't do anything. And if the effectiveTextFormat
is Qt::PlainText, then the linkToCopy will be empty, and the function
won't do anything, either.

So we can just handle these cases right away, making the code simplier.

Fixes static analyzer warning 43de3f3125108b4353afd94e94f59926.

Pick-to: 6.1
Change-Id: I5b8eb94a1e40c2725de6a168298d8f3bcde748eb
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-03-02 12:45:53 +01:00
Volker Hilsheimer
49113c905d Don't access moved-from object
Clang's static analyzer tooling warns about this access-after-move [1].
While the comment above the function indicated that this was deliberate
and relying on a moved-from QString being valid, it is still bad
practice.

Since 'str' is empty in moved-from state if - and only if - it was a
non-const reference, make a compile-time check of the constness of type
T instead.

[1] https://testresults.qt.io/codechecker/daily_analyses/qtbase/dev/qtbase-dev-20210301-e14ccf0553/qstring.cpp_clang-tidy_b0545db57a2cc5dac67a56f76322ffd0.plist.html#reportHash=209ee3db0b17d21919326a1ad6635318

Pick-to: 6.1
Change-Id: Iac1813b61b6a3c2ef4053b911a4043c5382f85e4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-03-02 11:45:41 +00:00
Richard Moe Gustavsen
9d80deb92f cmake: disable snippets/graphicsview if "printdialog" is not available
The graphicsview doc snippet has an explicit
QT_REQUIRE_CONFIG(printdialog) check that will fail the
build if Qt is not configured with "printdialog".
This check should be mirrored in the cmake file, so that
we skip building the snippet in the first place if the
feature is not available.

As it stood, we would build the snippet if "printsupport"
was enabled. But this is too granular, as you can configure
Qt to have general print support, but at the same time, skip
the print dialog. This caused the build to fail on iOS.

This patch will check the correct feature in the cmake file.

Change-Id: I31acc1f7c257e08374ea7b84a7fc38c66f214271
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-02 11:08:07 +01:00
Friedemann Kleint
ba13960392 Stabilize test QMenu::QTBUG_89082_actionTipsHide() on Windows
Move the cursor out of the way to prevent it from interfering.
Amends 3f3d5e6716.

Task-number: QTBUG-89082
Pick-to: 5.15
Pick-to: 6.0
Change-Id: I0efbe2b5618a04e92839083a1bd3383e05d6ff93
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-03-02 11:02:20 +01:00
Allan Sandfeld Jensen
417895b458 Merge "Handle para tags the same way for OOB checks as the other tags" 2021-03-02 09:29:08 +00:00
Allan Sandfeld Jensen
b984689ec8 Handle para tags the same way for OOB checks as the other tags
Do not include the first parameter in the main tag anymore. That is
a left over from before unaligned access was added.

Pick-to: 6.1
Change-Id: I2caf027c6b9930d3e23fe5ec8bdcd45db34835a9
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-03-02 08:09:03 +01:00
Craig Scott
c6bbca7486 Make qt_get_module_for_plugin() internal and do what its name says
Contrary to its name, this command was also setting a target property.
Since it was only called in one place and that caller can just as
easily set the property instead, rename the command to make clear its
internal nature and refactor it so that the caller is responsible for
setting that property instead.

Also make it an error rather than just a warning if the command is used
for a target that doesn't belong to any module. Since this is now
unambiguously an internal command, we should always expect the target
to belong to a module.

Pick-to: 6.1
Change-Id: I929a652ddd482653868fc9df887f38f4bc7f35d9
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-02 16:44:45 +11:00
Hou Lei
b46b33c817 Merge "Canonical type conversion" 2021-03-02 05:12:15 +00:00
Hou Lei
2b83e78f6e Canonical type conversion
Avoid C-style casts when possible.

Change-Id: I623d7bc62bd0e48a5e0493c892d6ad9b11b0ca0c
Reviewed-by: David Faure <david.faure@kdab.com>
2021-03-02 03:04:44 +00:00
Oliver Eftevaag
426b363761 Font style name 'Normal' and 'Regular' have the same meaning
Some popular fonts on linux systems follow a naming convention,
where font styles are named 'Regular', 'Italic', 'Bold' and
'Bold Italic'. Qt so far only accepts the words Italic and Oblique
interchangably, but not with Regular and Normal. This change will
make sure that Regular is interpreted the same as the Normal font
style.

Fixes: QTBUG-90396
Pick-to: 6.0 6.1 5.15
Change-Id: Ibbaf086de742c91f4d380c937ca80e846aa32a2e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-03-02 03:54:36 +01:00
David Faure
101581484b QCommandLineParser: fix crash if there's no QCoreApplication
It'll display <executable_name> instead in the help output.

Fixes: QTBUG-91430
Change-Id: Ib6211b24cdaa4683a4f62c90b5a1a20ba69f1cff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-03-01 23:03:00 +01:00
Friedemann Kleint
b579d8a05b Merge "Brush up the imageviewer example" 2021-03-01 21:27:22 +00:00
Friedemann Kleint
fe1ef3ebcb Brush up the imageviewer example
- Fix the save as file dialog being in "Open" mode by setting
acceptMode
- Fix clazy warnings about detaching QList by using constFirst()
- Fix clazy warning about passing a context to slot connection

Pick-to: 6.0 6.1 5.15
Change-Id: I0c800e9829e118fcec477322aa2a13660e3b51d2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-03-01 16:37:58 +00:00
Alexey Edelev
5dab1e931d Improve QMakeLibraryInfo encapsulation
QMakeLibraryInfo uses external data to produce paths. This causes
issues when trying to use it out of the existing qmake environment.
Add data fields that contain the path to the binary that uses
QMakeLibraryInfo and manually specified qtconf.

Task-number: QTBUG-75870
Change-Id: Ic6fa274ede3a9287826ff66c79f155b10d0d455c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-01 17:37:03 +01:00
Alexey Edelev
d1101c460e Simplify prefix-related functionality of qmake
Since the QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH and
QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH definitions keep the same
value in modern CMake build, no need to have special handling in cases
where these values are used in qmake. Also it will be useful to
specify the relative path to the prefix directory from the directories
different of 'bin' when use QMakeLibraryInfo.

Task-number: QTBUG-75870
Change-Id: I5a777001eb334dcf05e22853a514d4257352d59b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-01 17:36:56 +01:00
Alexey Edelev
93f55570c4 Remove unused definitions
QT_CONFIGURE_CROSSBUILD is always '0', so it's not necessary to keep
conditional compilation in QMakeLibraryInfo.

Also the QT_CONFIGURE_SYSROOTIFY_PREFIX definition is never used
in the project.

Task-number: QTBUG-75870
Change-Id: I1fe42dce40fddc6a72254736883f93aa4727f6b3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-01 17:36:48 +01:00
Allan Sandfeld Jensen
90e9974f15 Handle desc tags the same way for OOB checks as the other tags
Including one entry of the value in the header is pointless after
the unaligned access rewrite, and a potentially dangerous pattern,
though safe here due to overchecking.

Pick-to: 6.1
Change-Id: I4c0380040f89920467c309503408f1df6f88423f
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-03-01 15:51:24 +00:00
Edward Welbourne
b4ee126a75 Simplify QDateTimeParser::fromString() to always record the date-time
Previously, *datetime was only written to if the parse was a success.
When parsing a date-time that's invalid by virtue of falling in a
spring-forward gap, the parser returns a date-time that is invalid but
has a toMSecsSinceEpoch() suitable for use in creating a sensible
interpretation of the parsed string (in offset by the width of the gap
from the specified position in the gap). It is more useful to return
this value than a default-created QDateTime.

Change-Id: I89f39e729b1f9fede1532d8b82f6f676477ddadb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-03-01 16:45:17 +01:00
Edward Welbourne
83421e320b Try again if mktime() fails when we thought we knew DST-ness
When refreshing a QDateTime(,, Qt::LocalTime) we call mktime on data
obtained from it, passing in the DST status (when known; this keeps
two otherwise identical times in a fall-back distinct). One of the
tests relies on changing zone under the feet of such a date-time,
created in Hawaiian standard time; it serializes it, the reads it back
in Western Australian Daylight-saving time and expects the results to
be equal. However, the two differ in DST-ness, which leads to mktime()
failing for the Hawaiian original, with unwelcome results.

Notice this case, failure with DST-ness claimed known, and retry
without the claim, so as to correct the DST-ness.

Change-Id: Id0278df53130f76fc587769efe946ca9af1adc26
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-03-01 16:45:07 +01:00
Edward Welbourne
4a07947375 QTimeZonePrivate::dataForLocalTime: avoid {ov,und}erflow
When computing a recent and imminent time, to bracket the time for
which we want data, take care not to cycle round to the other end of
the range of representable times.

Rephrased comments on this function, in the process, to more
accurately reflect what we're doing.

Change-Id: Iacd36186abc6b19d0ca03981aec80b2c5af077b3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-03-01 16:45:00 +01:00
Edward Welbourne
63fbabde23 Only store offsetFromUtc when sane (and assert sanity)
The addition of a sanity-assertion revealed that, for an invalid
time-zone, refreshZonedDateTime() left epochMSecs unset but computed
offsetFromUtc from it none the less. Leave it as zero in that case, or
any other where the conversion to UTC didn't give valid date and time.

Change-Id: I0ebd955798532e91e7e211bf065667e313ee5c2d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-03-01 16:44:51 +01:00
Edward Welbourne
5af6b59b6e Rework an assertion to eliminate a common sub-expression using a lambda
This take more lines but makes the condition clearer and the lines
shorter, even after converting to use the names for constants in the
condition.

Change-Id: I9e5b7b79ff62095ed11b8723be238444fd32d9c1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-03-01 16:44:43 +01:00
Edward Welbourne
902505a058 Use qint64 as base-type for an enum mostly cast to that type
Various constants used in qdatetime.cpp were cast to qint64() where
used. There ware also some Q_INT64_C()s, two of which should have used
members of this enum; the third suggested a new addition to the enum.
Adding that and basing the enum on qint64 eliminates the need for
casting, although one asprintf() does now require a cast back to int.
There were also some redundant casts to qint64(), so I removed those.

Change-Id: Ia51ad8020f037badb1506ca379da19098a8655f8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-03-01 16:44:37 +01:00
Robert Löhning
976fede67c Limit value in setFontSizeFromValue()
Avoids overflows in QFreetypeFace::computeSize and
QFontEngineBox::boundingBox

Fixes oss-fuzz issue 30290

Pick-to: 5.15 6.0 6.1
Change-Id: If8e9ff74bf706a701e26832ad21b3439a3b437f7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-03-01 15:42:23 +00:00
Giuseppe D'Angelo
e14ccf0553 Kill qHash(QPointF)
QPointF operator== is fuzzy, hence it can't be hashed efficiently.
Prevent the erroneous addition of the overload by client code
by providing it as deleted.

Change-Id: I2cfaaf5c2c8896ec9a7929f7c7bf52a912d0450f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-02-28 20:31:31 +01:00
Qiang Li
269fdef53d Fix z-value of QGraphicsItems being ignored during draw
In QGraphicsScene's function draw, don't copy the children into a
const copy (to prevent detaching in the loops), as they might get
sorted. Instead, use a const reference.

Amends e349f787d5, which introduced
the bug by making a copy of the unsorted list.

Fixes: QTBUG-81316
Pick-to: 6.0 6.1
Change-Id: Iab9b87e75178a883806088a9db234c7a2aaa9301
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-28 19:05:32 +00:00
Giuseppe D'Angelo
cd13ec38a7 QBrush: get rid of an unused private function
No idea why it's there, it's unused.

Change-Id: Icf7b48e1e4ab37158a81e15ffa5a7125bfd10822
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-02-28 18:54:16 +01:00
Allan Sandfeld Jensen
840c8b4de2 Fix out-of-buffer in ICC curv parsing
After the unaligned ICC profile fix, we could read 2 bytes past the end
of the buffer for curv elements with 0 parameters, though we wouldn't
use or return the data.

Pick-to: 6.1 6.0 5.15
Change-Id: Ibea9fa2840c01d690716d8f48e301fbfa67aa163
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-02-28 17:45:05 +00:00
Fabian Kosmale
9d6ba110e8 QMetaType: Store QMetaObject for pointer to const QObject, too
Before this change, the QMetaType for T const* where T is derived from
QObject would not store the static QMetaObject of T. This commit changes
this. As a consequence, the metatype system can now convert between
const and non-const pointers to QObject. Note that this allows casting
const away; but so does C++ with const_cast.
In addition, a new flag, QMetaType::IsImmutable is introduced, and used
to tag the metatypes of pointer to const types. This allows code to
discern between pointers to mutable and const QObjects, which is
relevant for the QML engine.

Task-number: QTBUG-82354
Change-Id: I3e4e4f39f565bd99a65e161528ce5304df73d6d6
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-02-26 09:10:31 +01:00