Commit Graph

51691 Commits

Author SHA1 Message Date
Mårten Nordheim
2ced64d240 QStringTokenizer: Add a benchmark
Mostly for testing QLatin1String::indexOf optimizations in the next
patch but useful in general

Change-Id: I85bf76f3e1d5abb994fd12907db2f2a723a8d330
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-19 16:27:52 +02:00
Andy Shaw
96982bab0c Android: Reset m_usePrimaryClip when clearing the clip data
The variable needs to be set to false when we clear the clip data as
there is no primary clip anymore so we should not try to access it when
setting new data.

Fixes: QTBUG-93831
Pick-to: 6.1 5.15
Change-Id: I309270dc075fcb0457607561ee23e12f7eb6397f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-05-19 16:27:52 +02:00
Joerg Bornemann
7bc91dbe93 Doc: Extend qt_add_resource documentation
Pick-to: 6.1
Change-Id: Ia76b1e681eb15cc8ad9de04bb80654e35442c82b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-19 10:31:26 +02:00
Tasuku Suzuki
7d93c6ef9c Fix build without features.library
Change-Id: I53eaaea149324d2495e794ba8bd58544e648e48e
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-05-19 16:55:50 +09:00
Kimmo Ollila
5762bd236c Add EGLFS OpenWFD plugin for INTEGRITY
This enables OpenWFD EGLFS integration plugin and makes EGLFS the
default platform for INTEGRITY builds.

Change-Id: I65332ca0ae244f40013df435828e2e359200b325
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-05-19 10:55:48 +03:00
Thiago Macieira
80cf3053f4 tst_QFile: confirm behavior is the same on pipes and socketpairs
Whether we're using stdio or not.

Task-number: QTBUG-92905
Change-Id: Ia8e48103a54446509e3bfffd167682828c6bd190
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-05-18 21:15:49 -07:00
Tor Arne Vestbø
d0b0db0d6d tst_QSharedPointer: Fix Clang warnings about self assignment
Change-Id: I32feb86eee5f15e6ec0f0e6fb6811648b172fe7e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-05-19 02:48:47 +02:00
Alex Trotsenko
9c7cabb880 QLocalSocket/Win: fix closed state detection in waitFor...() functions
A delayed close should only be completed in the _q_bytesWritten() slot
as a confirmation of a successful write operation on the socket.
Otherwise, a failed write operation may cause the socket to be closed
unexpectedly within the waitFor...() function, which may result in a
malfunction.

Change-Id: I14cff26734f64a89090b6b5c13037466a6400597
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-05-18 20:03:47 +00:00
Alexandru Croitor
91c65dd80c CMake: Build plugin initializers as object libs
Instead of compiling the plugin initializers as part of a user
project, pre-compile them as object libraries while building Qt.

The installed object libraries can then be used with

    target_sources(qt_module INTERFACE $<TARGET_OBJECTS:plugin_init>)

so that they are linked into the final executable or shared library
via qt module usage requirement propagation.

This reduces the build times of user projects.

The link line placement of the object files should be correct for all
linux-y linkers because the only dependency for the object files is
Core and the Gui -> plugin -> Gui -> Core cycle does not hamper that
from empirical observations.

As a consequence of the recent change not to link plugin initialization
object files into static libraries, as well not having to compile the
files in user projects, we can get rid of the
_qt_internal_disable_static_default_plugins calls in various places.

A side note.

Consider a user static library (L) that links to a Qt static library
(Gui) which provides plugins (platform plugins).

If there is an executable (E) that links to (L), with no direct
dependency to any other Qt module and the intention is that the
executable will automatically get the platform plugin linked,
then (L) needs to link PUBLIC-ly to (Gui) so that the plugin usage
requirements are propagated successfully.

This is a limitation of using

  target_sources(qt_module INTERFACE $<TARGET_OBJECTS:plugin_init>)

which will propagate object files across static libraries only if
qt_module is linked publicly.

One could try to use

  target_link_libraries(qt_module
                        INTERFACE $<TARGET_OBJECTS:plugin_init>)

which preserves the linker arguments across static libs even if
qt_module is linked privately, but unfortunately CMake will lose
dependency information on Core, which means the object files might be
placed in the wrong place on the link line.
As far as I know this is a limitation of CMake that can't be worked
around at the moment.

Note this behavior was present before this change as well.

Task-number: QTBUG-80863
Task-number: QTBUG-92933
Change-Id: Ia99e8aa3d32d6197cacd6162515ac808f2c6c53f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-05-18 22:03:46 +02:00
Li Xinwei
208dbb4c18 qmake: fix MSVC build error when QT_FEATURE_static_runtime is ON
error LNK2038: mismatch detected for 'RuntimeLibrary': value
'MT_StaticRelease' doesn't match value 'MD_DynamicRelease'.

Change-Id: I1422bdc680a066f0736c3e28cc6beafd2461db88
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-19 04:03:46 +08:00
Tor Arne Vestbø
0855f62791 Fix single argument QT_OVERLOADED_MACRO with pedantic warnings enabled
The use of QT_OVERLOADED_MACRO combined with pedantic warnings would
result in

  warning: must specify at least one argument for '...' parameter of
  variadic macro [-Wgnu-zero-variadic-macro-arguments]

when used with a single argument, as the QT_VA_ARGS_COUNT macro would
end up not passing anything to the last ... argument of the helper macro
QT_VA_ARGS_CHOOSE.

To work around this we extend the arguments passed to QT_VA_ARGS_CHOOSE
by one, adding a zero-count, so that the variadic parameter always has
at least one argument.

Unfortunately this doesn't give us a count of 0 if a overloaded Qt macro
is used without arguments, due to __VA_ARGS__ always being treated as an
argument to QT_VA_ARGS_CHOOSE, even when empty, due to the comma after it.
The result is that we end up calling the 1-argument macro for this case
as well.

Getting a correct zero-count, for both MSVC and GCC/Clang, without using
GCC extensions, is quite involved, so we're opting to live with this
limitation. See https://stackoverflow.com/a/62183700 for details.

Fixes: QTBUG-93750
Pick-to: 6.1
Change-Id: Ib7b26216f36a639642a70387e0d73223633ba6b6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-18 19:07:51 +00:00
Tor Arne Vestbø
f2d26f95fe cmake: Add repository name to test labels for qt5 builds
Change-Id: Icb23f2ea885f6d21bef80c587a431f7e9349f21b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-18 21:07:51 +02:00
Allan Sandfeld Jensen
1fe8ddc7fe Cherry-pick upstream patch for non-gcc/clang/msvc compilers
Fix build w/ non-GCC-compatible Un*x/Arm compilers

Fixes: QTBUG-93779
Change-Id: Ib52e9ded6e2814c7998d6cd798e945da0f87f7a1
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 4341f6763b8a737ebc07bb78ead22bc05a1a515b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-18 18:57:25 +00:00
Friedemann Kleint
902a4d63a1 Small fix to the notepad example
- Remove misleading note about setCentralWidget()
- Connect copy/paste and undo/redo directly to the QTextEdit instead
  of routing them via window
- Add the missing "About" menu
- Check for reject of QFileDialog

Change-Id: Ia7457fbedd762028bf2bcde99dfcfb50bbc97f1d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-05-18 20:57:25 +02:00
Alexey Edelev
43ba45151a Follow the generic logic of QLibraryInfo when computing QT_HOST_PREFIX
After the discussion we concluded that QT_HOST_PREFIX should not
completely replicate the QT_INSTALL_PREFIX behavior.

So this patch implements the following logic if qt.conf is provided:
  1. Prefix is not set
    a. If HostPrefix is not specified, then QT_HOST_PREFIX will be set
       to the folder containing qt.conf.
    b. If HostPrefix is specified and is relative, then QT_HOST_PREFIX
       will be relative to the folder containing qt.conf.
  2. Prefix is set
    a. If HostPrefix is not specified, then QT_HOST_PREFIX will have
       the Prefix value.
    b. If HostPrefix is specified and is relative, then QT_HOST_PREFIX
       will be relative to the folder containing the qt.conf.

The logic might change in a future commit to use the current application
directory instead of qt.conf path, since the use of qt.conf is dictated
by the bootstrap library and this is no longer the case.

Fixes: QTBUG-93707
Change-Id: I5460c97c45924bb8e0c95493afdb9585994c5f28
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-18 20:57:25 +02:00
Edward Welbourne
07ed2b054a Remove unused functions from enumdata.py
It's now a data-only module. The callers of its code-to-ID functions
have, for some time now, been rearranging its mappings to get at data
efficiently.

Change-Id: Ia16dcaa767203cdf3b81a96bd51793491ad41563
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2021-05-18 20:57:25 +02:00
Joerg Bornemann
92185d417d Fix BASE argument of qt_add_resources
The BASE argument of qt_add_resources now denotes the root point of the
alias of the file.  Before, BASE was merely prepended to every file that
got passed to qt_add_resources.

Old behavior:
    qt_add_resources(app "images"
        PREFIX "/"
        BASE "../shared"
        FILES "images/button.png")

Alias is "../shared/images/button.png", and pro2cmake generated
QT_RESOURCE_ALIAS assignments to fix this.

New behavior:
    qt_add_resources(app "images"
        PREFIX "/"
        BASE "../shared"
        FILES "../shared/images/button.png")

The alias is "images/button.png".  No extra QT_RESOURCE_ALIAS assignment
is needed.

The new behavior is in effect for user projects and for Qt repositories
that define QT_USE_FIXED_QT_ADD_RESOURCE_BASE.  Qt repositories will be
ported one by one to this new behavior.  Then the old code path can be
removed.

Pick-to: 6.1
Task-number: QTBUG-86726
Change-Id: Ib895edd4df8e97b54badadd9a1c34408beff131f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-18 16:02:52 +02:00
Friedemann Kleint
18aad6da87 Brush up the text edit example
- Use initializer lists
- Use u instead of QLatin1String()
- Fix some clang warnings about else after return, constFirst()
- Streamline code
- Remove slot TextEdit::printPreview() which is not needed
- Rename variable fileName to pdfFileName in filePrintPdf()
  to disambiguate from this->fileName

Pick-to: 6.1
Change-Id: I377ebfd13487470b6f8eaf568dd5d99354f761f2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-05-18 16:01:51 +02:00
Craig Scott
21607d5db5 CMake: Provide supported qt_internal_add_module() args via a function
This is to allow other repos like qtdeclarative to more easily pass
through supported arguments to qt_internal_add_module() from their own
functions.

Task-number: QTBUG-88763
Change-Id: I965d593de4c6f9d5295a0d427c32dc3d5b1bb639
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-18 23:59:24 +10:00
Andreas Hartmetz
27d9c0542c Be more helpful about the symlinked build directory problem
- Explain why a symlinked build dir won't work
- Add another workaround suggestion that works well in my case

Change-Id: I3f7eaeac2974e037587941f6f761fbcb262c4631
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-18 13:51:06 +00:00
Giuseppe D'Angelo
861647e8a5 Item models: code tidies
Use QFlags::testAnyFlag instead of relying on implicit conversions.

Change-Id: I7ac8149535ad28e47fbf3e250042892bdf8c3a72
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2021-05-18 15:33:25 +02:00
Giuseppe D'Angelo
3b0c6bf486 QEventDispatcherCF: avoid QFlags->int implicit casts
Use toInt(), or an explicit cast. (I don't quite know why an atomic int
is involved here, but anyways, it makes these casts necessary.)

Change-Id: I8816ef96bd69a6f3e3f8e025e567e3451069462c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-05-18 15:31:10 +02:00
Allan Sandfeld Jensen
86bf3a4ddb Blacklist tst_QWidget::multipleToplevelFocusCheck() on SLES 15
Pick-to: 6.1 5.15
Task-number: QTBUG-64446
Change-Id: Ic1f7a1e7b89a9802e4d3103a6755d7df85b1fd81
Reviewed-by: Tarja Sundqvist <tarja.sundqvist@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-05-18 11:56:06 +02:00
Andreas Buhr
8278879c19 Fix QItemSelectionModel::selectionChanged emission
QItemSelectionModel has the property selectedIndexes with
the notification signal selectionChanged. When a row is deleted
or inserted above the current selection, the row number of the
current selection changes and thus the return value of
selectedIndexes changes. This should trigger its notification
signal.
This signal was not emitted. This patch fixes this and
adds a unit test to verify this.

[ChangeLog][Important Behavior Changes][QtCore]
QItemSelectionModel now emits the selectionChanged signal
if only the indexes of the selected items change.

Fixes: QTBUG-93305
Change-Id: Ia5fb5ca32d658c9c0e1d7093c57cc08a966b9402
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2021-05-18 08:49:56 +02:00
Toni Saario
0ed6fd77a0 Allow overriding CMake build timeout values
This allows modules to set custom timeouts for the builds.
Works by modules setting the CMAKE_BUILD_TIMEOUT and
CMAKE_BUILD_OUTPUT_TIMEOUT in the module's module_config.

Change-Id: I6f0170d77e9a962fb37e171d1c0d8c7b2277bb96
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-18 07:02:52 +03:00
Giuseppe D'Angelo
9a94c4a415 Long live qToUnderlying
"Cherry-pick" of C++2b's std::to_underlying.

[ChangeLog][QtCore][QtGlobal] The qToUnderlying function has been
added, to convert an value of enumeration type to its underlying
value.

Change-Id: Ia46bd8e4496e55174171ac2f0799eacbcca02cf9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-18 02:09:11 +02:00
Giuseppe D'Angelo
8b8ff64be2 PRIx macros: add some actual testing
Not just a compile-time one (that the macros compile and don't
raise warnings).

Change-Id: I5642bf242a6c26a33730708f3c1710237fc107a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-18 02:09:06 +02:00
Giuseppe D'Angelo
8f7873272a qglobal.cpp: build under QT_NO_EXCEPTIONS
The boostrap library is built with exceptions disabled, and its
sources include qglobal.cpp. Therefore, the file must work when built
w/o exceptions.

Amend/partially revert 282b724808 with
the necessary fixes.

Driveby, cleanup an unnecessary QT_THROW (just throw, if we do have
exceptions).

Change-Id: I370c295c21edd3d81a9fa670e60909b29d1c68aa
Pick-to: 6.1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2021-05-18 02:09:02 +02:00
Li Xinwei
42b8bbbef0 CMake: remove unnecessary add_dependencies()
The dependencies to moc, uic and rcc have already been handled by
qt_manual_moc(), qt_enable_autogen_tool() and
_qt_internal_process_resource().

This allows not building some of the debug executables in a
multi-config scenario.

Task-number: QTBUG-88414
Change-Id: I6c162721f3ddf6b4b410345ad012073abbdfd9df
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-17 21:57:22 +00:00
Joerg Bornemann
76eefab088 Add proper dependencies to apk targets
Before, building ${target}_make_apk always re-built the apk, instead of
rebuilding the apk only when inputs changed. This patch fixes that by
moving the creation code from a custom target to a custom command with
proper dependencies.

The androidtestrunner tool now does not check for the existence of an
apk anymore and always runs the make command that is supposed to build
the apk.

The ${target}_prepare_apk_dir target is not needed anymore by the Qt
build but is still used by Qt Creator's Android support. Add a
clarifying comment.

Fixes: QTBUG-93431
Change-Id: I00d65d616fef9511b03b65f879c4bc6cb92dfc30
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-17 19:14:44 +02:00
Thiago Macieira
50c838d4b5 Make the exit() methods in QEventLoop and QThread be slots
The documentation for QCoreApplication::exit() even refers to it as
such. Instead of refactoring the documentation to explain that it isn't,
just make it a slot and do the same for the other classes.

Complements 2e6c37fe51.

[ChangeLog][QtCore][QEventLoop] exit() is now a slot, like quit().

[ChangeLog][QtCore][QThread] exit() is now a slot, like quit().

Change-Id: Ic42004c9bf71440eb433fffd167f4a1b89bcac80
Reviewed-by: David Faure <david.faure@kdab.com>
2021-05-17 10:13:52 -07:00
Alexandru Croitor
5268edf581 CMake: Don't do plugin initialization for static libraries
Q_IMPORT_PLUGIN generates a global static symbol that initializes a
plugin. If this symbol is added to a static library and the library
is then linked to an executable, the linker decides that the symbol is
unused (because nothing references it) and discards it.

This means there's no point to compile the Q_IMPORT_PLUGIN containing
files into static libraries.

Change the generator expression we use for plugin propagation via
associated modules to not compile and link the plugin initialization
object file into a static library.

Pick-to: 6.1
Task-number: QTBUG-80863
Change-Id: Ide32c0124c1e313c352a72280ce32ce9fbe8fff1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-05-17 19:11:10 +02:00
Andre de la Rocha
92198efbd2 Windows QPA: Fix dock widget drag&drop failure
A previous change to fix QTBUG-85431 has caused this issue by emulating
the behavior of the non-enhanced mouse event handler in a particular
case, where mouse move events that did not change position were ignored.
However, some of these events seem to be involved in the dock drag&drop
implementation. This issue is also reproduced in pre-5.15 releases,
predating the QTBUG-85431 fix, by disabling the enhanced mouse event
handler by setting the QT_QPA_DISABLE_ENHANCED_MOUSE env var. However,
the ignored events in the current issue seem to be non-client events
only, while the QTBUG-85431 issue was related to client mouse events.
So we can restrict the test added in the QTBUG-85431 fix and have both
issues fixed.

Fixes: QTBUG-92182
Pick-to: 5.15 6.0 6.1
Change-Id: I98c0c8597912c7f4fe58af375a5a560695a82746
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-05-17 19:11:09 +02:00
Assam Boudjelthia
2e373e44ac Add isValid() call to QJniEnvironment
Task-number: QTBUG-92952
Change-Id: I3bce2881c10a8bfcc8771002a3349644c6f05cb3
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-05-17 16:30:14 +00:00
Joerg Bornemann
db25a067b0 Fix build of standalone painting examples
Since commit f5c69a5195 the examples/widgets/painting examples could
not be built standalone anymore.
Move the find_package calls out of the examples/widgets/painting/shared
subdirectory and add a .cmake file that can be included to use the
library conveniently.

Change-Id: I35cb5bd8419a67c782d109104c4a88d64477a8be
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-17 17:14:10 +02:00
Giuseppe D'Angelo
536a4ab079 QFile: code tidies
There's no need of converting a QFlags to int in openExternalFile's
signature; just use the flag.

Also, avoid an implicit QFlags->bool conversion by using testAnyFlag.

Change-Id: Ia2d560bce235c842745d8a6a5fb5d8ac0851fc47
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-17 11:07:35 +02:00
Giuseppe D'Angelo
af38f72e13 Windows QFSFileEngine: avoid some QFlags implicit conversions
Go through fromInt/toInt instead.

Change-Id: I73097e21f59f9e8eb2c9714e22084af0787a53d5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-17 11:07:13 +02:00
Giuseppe D'Angelo
dc5576895d QMetaContainer: code tidies
Turn some implicit conversions into calls to QFlags::testAnyFlag.

Change-Id: I755f8a1afb1ff02e823e747e021e9744d68b4f62
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-17 00:11:32 +02:00
Giuseppe D'Angelo
fca6021f5b QFileSystemMetaData: code tidies
Turn some implicit conversions into calls to QFlags::testAnyFlag.

In one case, move some code using QFlags operators *after* such
operators have been declared by the right macro.

Change-Id: Ib5713f028ce74d1c9054b87cc12eea5715f2bc94
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-17 00:11:28 +02:00
Giuseppe D'Angelo
18e6debca7 QFSFileEngine: code tidies
Turn a couple of implicit conversions into calls to QFlags::testAnyFlag.

Change-Id: I21a0b4c1644986a98a2d0d54ae4b95f9fdc92841
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-17 00:11:26 +02:00
Giuseppe D'Angelo
5ea50054a1 QArrayData: store the right flag type, not an int
There's no reason to be storing `int` in the array data header and
then using it as a QFlags. Just store the QFlags.

Change-Id: I78f489550d74d15a560dacf338110d80a7ddfdd2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-17 00:11:12 +02:00
Giuseppe D'Angelo
8e82c30680 QIODevice: code tidies
Turn an implicit conversion into a call to QFlags::testAnyFlag.

Change-Id: Idbd80bb6a9b5d84952b76d8d7544f617fe693b91
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-16 17:22:38 +02:00
Giuseppe D'Angelo
c568257a52 Event dispatchers: code tidies
Turn an implicit conversion to bool in

* a call to testAnyFlag in one case;
* a comparison against 0 in another case, for consistency with the
surrounding code.

Change-Id: I1eee42ba82c59a72430bf507ea80408c553be889
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-16 17:22:34 +02:00
Giuseppe D'Angelo
5a1c3c29ac QSaveFile: code tidies
Turn a cast into a call to QFlags::toInt(), plus a cast.

This is in preparation for a future patch that will remove the
implicit conversion. So why not casting directly? Because we don't
know if the QFlags is backed by int or uint, so using the wrong
cast won't compile; and we MUST pass unsigned because of the %x
specifier. Granted, one could've used a static_assert, but I prefer
a more flexible and idiomatic solution.

Change-Id: I32a3e0ed69b925e8d56268ec84d9e668ca540188
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-16 17:22:30 +02:00
Joerg Bornemann
97228214bd Doc: Add CMake to the "Resource System" documentation
Pick-to: 6.1
Change-Id: I4c6a7cfb2f6351e9587d47ab6708d92a1a4e42a4
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-05-16 17:05:32 +02:00
Alexey Edelev
282b724808 Make qTerminate available when QT_NO_EXCEPTIONS flag is set
It seems that QtCore could only be compiled with exceptions enabled.
Therefore it doesn't make sense to keep conditonal code under
QT_NO_EXCEPTIONS in qglobal.cpp. qTerminate may be called whether
exceptions are enabled or not.

Pick-to: 6.1
Fixes: QTBUG-93739
Change-Id: Ie49c10f27cfa75360f018e8638603e6a1791450e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-16 15:26:26 +02:00
Giuseppe D'Angelo
0533695ddd QDir: remove an unneeded QFlags->int conversion
Just use the original QFlags. Drive by, use testFlag to check if
it contains a given value or not.

Change-Id: I4d5e8454df33a3f4727855d55f7587143450dda6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-16 11:42:08 +02:00
Giuseppe D'Angelo
5f29ed0d5c QDir(Iterator): code tidies
* Turn some `flags & bit` statements that rely on QFlags->int->bool
implicit conversions, into some more idiomatic `return
flags.testAnyFlag(bit)`. This is in preparation for a future patch, and
to avoid inserting casts (return statements do not contextually convert
to bool).

* Remove a magic constant, replacing it by the symbolic one.

Change-Id: I62fc2b2bf6f0ab8fad121edd19cb2ea0d9e3582a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-16 11:42:05 +02:00
Thiago Macieira
4d24fcd3e1 QDateTime: fix our oversight in Qt 6.0 not changing the ShortData
For 32-bit systems. They're not important (to me), but might as well fix
this oversight.

Change-Id: I755911ae7d0341f49039fffd167b26617db93354
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-05-15 12:14:48 -07:00
Giuseppe D'Angelo
c4947c1c4c QFlags: add test(Any)Flag(s)
QFlags was lacking a named function for testing whether a QFlags object
contains _any_ of the bits set by a given enumerator/other QFlags.

Drive-by, add testFlags taking a QFlags, not just an object of the
enumeration; and simplify the implementation of testFlags to more
closely follow what its documentation says it does.

[ChangeLog][QtCore][QFlags] The testFlags, testAnyFlag and
testAnyFlags functions have been added.

Change-Id: Ie8688c8b0dd393d34d32bc7786cdcee3eba24d1c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-15 17:34:01 +02:00