Commit Graph

45921 Commits

Author SHA1 Message Date
Edward Welbourne
e325bd68fd Catch overflow in QDateTime::fromSecsSinceEpoch()
It's documented to be undefined if the number of seconds is outside
the allowed range, but it doesn't hurt for that undefined behavior to
happen to be that the result is invalid. Added a simple test.

Change-Id: I20c3f680c7948b3904f213452272133be77e4d62
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-08 09:51:24 +02:00
Edward Welbourne
bd5fe6f385 Merge some QDateTime methods marked for merging
New methods added that can take default arguments to make old methods
redundant, now that we can break binary compatibility.

Change-Id: Iface9d91d4636965285a3ad0c5347fcd7ce5398c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-08 09:51:10 +02:00
Edward Welbourne
5ba66c5622 Remove all locale-dependence from Q(Date|Time)+
[ChangeLog][Important Behavior Changes][QDateTime] Removed all
locale-dependence from QDate, QTime and QDateTime, including the
Qt::DateFormat members that select the formats of the default and
system locales and the toString(Qt::DateFormat, QCalendar) overload,
which only used its calendar for these formats.  All toString()
methods now use, and all fromString() methods only recognize, the C
locale's names for days and months.  Use QLocale's methods if you need
to take locale into account.

Fixes: QTBUG-80441
Change-Id: I3a8968438741afb00f44262f79659c51e9b06c35
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-08 09:50:51 +02:00
Edward Welbourne
48e5a37536 Move a test of QLocale's methods out of tst_QDateTime
It clearly belonged in tst_QDate::toDateTime(), for which it adds a
few more test-case and in which it inspires some further testing.
The new testing of case-insensitivity doesn't work if the format
contains stray non-format characters, so added a new data column to
take care of that.

Pick-to: 5.15
Change-Id: I73619be02091c97024a84cb963c7029e9fd0569a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-08 09:50:24 +02:00
Edward Welbourne
1f13a0fbec Condition some date-time tests on feature textdate
They use the Qt::TextDate format, so do depend on the feature.
Rename one in the process; nothing in its test has anything to do with
de_DE locale.

Pick-to: 5.15
Change-Id: I2adae5c46e6009c13b433993ed2c3c761a500bfb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-08 09:50:16 +02:00
Albert Astals Cid
4fa9444090 QByteArrayLiteral: Remove const temporary that may prevent optimization
clang-tidy 10 was complaining about
http://clang.llvm.org/extra/clang-tidy/checks/performance-no-automatic-move.html

Pick-To: 5.15
Change-Id: I63ba4111e01bb9d3ee87940253c4a79cc42c0bdf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-08 07:28:05 +00:00
Marc Mutz
a5094bc270 QGraphicsAnchorLayout: port to QHVContainer [2/4]: edgeOrientation()
Port edgeOrientation() and all its callers from Orientation to
Qt::Orientation.

This function is singled out, since one caller is performing a
conversion from Orientation to Qt::Orientation, which, if left
unchanged, would cause an off-by-one bug.

Change-Id: I37365195ea9552243822803b095a3926a28e7dd0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-05-08 08:52:50 +02:00
Thiago Macieira
3144f90d93 QString: mark qustrlen() as unsuitable for ASan
We load an aligned 16-byte on the first load, even if 14 of the 16 bytes
are before the string contents themselves.

Pick-To: 5.15
Change-Id: Ibdc95e9af7bd456a94ecfffd1603f2b8c87655b1
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2020-05-07 22:43:04 -07:00
Giuseppe D'Angelo
b4a05b1233 Provide qHash for all C++ fundamental types
Except for (void and) bool, which we may not want to have
to avoid accidental implicit conversions.
Drive-by, rearrange qHash overloads to C++ types first,
and then Qt ones.

Change-Id: I9c4ecef5f28568d35ca52e339583851ce53b3bae
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-08 01:36:32 +02:00
Joerg Bornemann
657fa0462d CMake: Fix Windows RC file generation for multi-config builds
For Ninja Multi-Config we now generate RC files in a path matching the
current config name.

We have to work around https://gitlab.kitware.com/cmake/cmake/-/issues/20682
to add the generated config-dependent RC files to the target.

But due to https://gitlab.kitware.com/cmake/cmake/-/issues/20683 the
OriginalFilename entry in the generated resource will be wrong for all
configurations but the main one. Cross fingers that this will be fixed
upstream. In the meantime: ignore the issue.

Drive-by changes:
 - Fix the function comment.
 - Surround the RC file name by double quotes in case there are spaces
   in the path.

Fixes: QTBUG-83986
Change-Id: If2fec41fa8050b3feb92c3ce051fde1a5bad0239
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-07 21:30:33 +02:00
Peter Seiderer
c5b8b66210 evdevkeyboard: fix input_event time related compile
Fixes:

  evdevkeyboard/qevdevkeyboardhandler.cpp: In member function ‘void QEvdevKeyboardHandler::switchLed(int, bool)’:
  evdevkeyboard/qevdevkeyboardhandler.cpp:153:28: error: ‘struct input_event’ has no member named ‘time’; did you mean ‘type’?
       ::gettimeofday(&led_ie.time, 0);
                              ^~~~
                              type

Task-number: QTBUG-84012
Change-Id: I1d127561e0406ae570da656d3e31f9434c7b8798
Pick-to: 5.15
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-05-07 21:27:48 +02:00
Peter Seiderer
71fb4d081c evdevtouch: fix input_event time related compile
Fixes:

  evdevtouch/qevdevtouchhandler.cpp: In member function ‘void QEvdevTouchScreenData::processInputEvent(input_event*)’:
  evdevtouch/qevdevtouchhandler.cpp:579:29: error: ‘struct input_event’ has no member named ‘time’; did you mean ‘type’?
           m_timeStamp = data->time.tv_sec + data->time.tv_usec / 1000000.0;
                               ^~~~
                               type
  evdevtouch/qevdevtouchhandler.cpp:579:49: error: ‘struct input_event’ has no member named ‘time’; did you mean ‘type’?
           m_timeStamp = data->time.tv_sec + data->time.tv_usec / 1000000.0;
                                                   ^~~~
                                                   type

Task-number: QTBUG-84012
Change-Id: Ib8d726a0baf2bdc85da9341229fffaddc0e373ee
Pick-to: 5.15
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-05-07 21:27:35 +02:00
Laszlo Agocs
8cdc9ac5b2 rhi: vulkan: Fix calling finish() twice with some copy commands in-between
The native command buffer handle was not updated, so the subsequent
finish() call attempted to record an invalid VkCommandBuffer. The
problem was not present with offscreen frames, only when finish() is
called with a swapchain-based frame active.

Task-number: QTBUG-84066
Change-Id: I9c4cb701c3dbbc28f237d6ae1cbf65aafd1fa95f
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2020-05-07 21:15:52 +02:00
Marc Mutz
2f8cfc2c60 QGraphicsAnchorLayout: port to QHVContainer [1/4]: local QHVContainer
This part of the patch changes the definitons of the member variables
from 'C arrays of extent 2' to QHVContainer and fixes the code where
ints were used to index into the array.

To not drown in renames, keep the locally-defined enum 'Orientation',
and create a local version of QHVContainer whose index operator is
overloaded for both Qt::Orientation and the local 'Orientation'.

Follow-up patches will remove these, then, completely.

After this patch, NOrientations is no longer used, and consequently
removed.

Change-Id: I2a241520fce4beeb87fc0e26cd6ab18f324a956a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-05-07 21:06:02 +02:00
Liang Qi
fc65683e65 Revert "Don't reference build directory in helper lib pri"
This reverts commit c9d9ac5bb0.

This breaks prefix build which tries to link to install folder.

Task-number: QTBUG-83967
Change-Id: I084152afde91c2063154bef8ac99d7e997c9394b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-05-07 20:58:25 +02:00
Fredrik Orderud
a8b373d678 qstandardpaths_win.cpp: Fix GetCurrentProcessToken() for Win7
The GetCurrentProcessToken() was made an inline function
for Windows 8. Expand it to ensure builds work independent
of WINVER and disable low integrity support for Windows 7.

Fixes: QTBUG-83941
Task-number: QTBUG-83453
Change-Id: Ic989f16621cd80cbc70c6b62779afab8a12714df
Reviewed-by: Fredrik Orderud <forderud@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-07 16:39:39 +02:00
Thiago Macieira
798492ccee QCborValue: catch overflow in QByteArray when decoding chunked strings
We checked against integer overflow, but not against overflowing the
QByteArray size limit. That caused a std::bad_alloc to be thrown, which
is bad when decoding unknown data. QCborStreamReader wasn't affected,
since it doesn't merge chunks.

Change-Id: I99ab0f318b1c43b89888fffd160c36f495fada87
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-07 07:39:26 -07:00
Mårten Nordheim
66908badac Add more deprecation notices to QtNetwork release notes
And move the ones that was already there under the QtNetwork point.

Change-Id: I4f9641f78c624b1846699292e053ee148178df4a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-05-07 16:39:14 +02:00
Joerg Bornemann
95b441d097 pro2cmake: Add library mappings for the restructured ActiveQt module
Change-Id: I643cb2afc0e4b74abcbd67bb9002ab334337be37
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-07 16:23:15 +02:00
Kai Koehne
38fafdafc9 Doc: Remove deprecated API from XML processing overview
Pick-to: 5.15
Fixes: QTBUG-83873
Change-Id: I7fce8de11a9fb09a158f7ad5e32c0fcc323dbdf1
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-05-07 16:02:51 +02:00
Kai Koehne
ae4a5b9067 Enable warnings-are-errors also for snippets
Pick-to: 5.15
Change-Id: I6b3645924e4f090c7887ce0d6296a71dc8f8159d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-05-07 13:55:30 +00:00
Shawn Rutledge
3e12951c0b Remove QScreen::orientationUpdateMask
It simplifies the API and reduces surprise to have rotation working by default.
On Android, the manifest specifies which orientations the application has
been designed to support; on iOS, it is controlled via the
UISupportedInterfaceOrientations property list key.
In addition, QWindow::contentOrientation() is another way to give
a hint to the window manager, or on iOS to directly control whether
the window's rotation is locked or not.

Task-number: QTBUG-35427
Task-number: QTBUG-38576
Task-number: QTBUG-44569
Task-number: QTBUG-51012
Task-number: QTBUG-83055
Change-Id: Ieed818497f686399db23813269af322bfdd237af
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-05-07 13:48:08 +00:00
Christophe Giboudeaux
5dcaa11cc2 pro2cmake: Honor INSTALL_EXAMPLESDIR if defined
When building examples standalone, 'INSTALL_EXAMPLESDIR' may be
undefined.

The converted .pro files now check whether the variable is
set to prevent installation into unexpected locations.

Fixes: QTBUG-81797
Change-Id: I9f97568923c8103011a41d9af7cfe02dd1e40b56
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-07 15:41:26 +02:00
Alexandru Croitor
bf315c5526 CMake: Make build system of installed Qt more relocatable
Aka handle CMAKE_INSTALL_PREFIX in a more relocatable way.

The following story inspired this change.

If a user wants to build a Qt repo into a different install prefix
than the usual Qt one, this will fail configuration because we
look for various things like syncqt, qdoc, etc relative to
CMAKE_INSTALL_PREFIX, which will now point to a different location
where none of the above tools are located.

The intent for such a use case is to support building Qt packages with
Conan, which sets a random install prefix when configuring a repo.

The idea is to derive the qt prefix dynamically from the
QtBuildInternals package location. Essentially it's a reverse relative
path from the QtBuildInternalsConfig.cmake file to the install prefix
that was specified when initially configuring qtbase.

Once the dynamic prefix is computed (so we know where the possibly
relocated Qt is), we can find tools like syncqt and qdoc.

This is an initial attempt to support a use case like that.

More design work will probably needed in case if tools / libs need to
be found in a location different than the Qt install prefix (so
support for multiple install prefixes / search paths).

An example of such a case would be when building qtdeclarative and
qtquickcontrols2 as Conan packages in one go. Most likely the
qmltyperegistrar tool will be located in the random install prefix
set by Conan, so building qtquickcontrols2 might fail due to not
finding the tool in the original Qt install prefix.

As to the implementation details, the change does the following:
- Dynamically computes and sets the
  QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX variable when
  find_package()'ing QtBuildInternals. It's an absolute path
  pointing to where the relocated Qt is.

- When building qtbase this variable is not yet available (due
  to QtBuildInternalsExtra not existing), in that case we set
  the variable to the absolute path of CMAKE_INSTALL_PREFIX
  (but only for the initial qtbase configuration).

- Remove QT_BUILD_INTERNALS_ORIGINAL_INSTALL_PREFIX which was used
  for standalone tests purposes. It's not needed now that we compute
  the location of the Qt prefix dynamically.

- The Unixy qt-cmake and qt-cmake-private shell scripts now
  use a relative path to find the toolchain file we created.

- The toolchain file also dynamically computes the location of the Qt
  packages, and adds them to CMAKE_PREFIX_PATH.

- A lot of existing CMAKE_INSTALL_PREFIX uses are replaced with
  QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX. This includes finding
  tool locations, mkspecs dir, path environment setup for tools, etc.

- Some places still use CMAKE_PREFIX_PATH in the following cases
  - When determining paths while configuring qtbase (valid cases)
  - When I wasn't sure what the behavior should be, so I left them
    as-is (an example is documentation generation, do we want to
    install it into the random Conan prefix, or into the main prefix?
    Currently it installs in the random prefix).

Note that relocating a Qt installation does not work for non-prefix /
non-installed builds, due to hardcoded paths to include directories
and libraries in generated FooTargets.cmake files.

Task-number: QTBUG-83999
Change-Id: I87d6558729db93121b1715771034b03ce3295923
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-07 15:41:16 +02:00
Alexandru Croitor
c70dcffbdb CMake: Replace hardcoded include dirs for the global qtbase targets
Change-Id: I22a120a0cb8ca690d224b1301b85e704364fbce0
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-05-07 15:41:11 +02:00
Marc Mutz
d124eeb00c Port qt_string_count() to QStringView
It was not using QStringView API, but immediately dropped to bare
metal operations (reinterpret_cast, ushort), subjecting itself to
ushort -> char16_t issues.

The new formulation avoids low-level primitives.

Change-Id: I8e75c7ea7409b133ff43bf5c829aa1f8f7503f11
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-07 15:28:26 +02:00
Marc Mutz
1eaf7fd544 QStyleSheetStyle: fix some premature pessimizations
- Use QStringView to substring before converting to L1
- cache result of toLatin1()

Pick-to: 5.15
Change-Id: I509f551913e77075e60903ebe65b880bd3f7e973
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-07 13:28:24 +00:00
Marc Mutz
c3ca27d02c QStyleSheetStyle: port a local QSet to QDuplicateTracker
Apart from a more fitting, minimal, API, QDuplicateTracker also
transparently uses C++17 pmr::monotonic_buffer_resource to avoid, or
at least reduce, memory allocations.

Change-Id: Ice3ebf1891141d2ac1ec9dd069fb40e98d4056c6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-07 15:28:21 +02:00
Marc Mutz
a96900eea5 QString: remove weird uses of QChar::unicode()
Both *rc and fillChar have type QChar. So don't use QChar::unicode()
to assign them to each other, just use QChar::op=...

Change-Id: I050035ca16d613f3c57eb5a582978d23c2f04f36
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-07 15:28:17 +02:00
Marc Mutz
81c648590e QGraphicsAnchorLayout: rename AnchorData::{orientation -> isVertical}
That's basically what it is, and we don't want to extent the storage
from one to two bits when porting
QGraphicsAnchorLayoutPrivate::Orientation to Qt::Orientation later on.

Change-Id: I965164141e8d08dbf190e2cd71d9bb7a272b1fda
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2020-05-07 15:28:14 +02:00
Marc Mutz
9a66dff369 QLocale/Mac: make envVarLocale() thread-safe
The old code used a static QByteArray, but would write to it on every
invocation of the function. This makes the function non-re-entrant,
even though it's callable from non-GUI-threads (via
QSystemLocale::fallbackUiLocale()).

Fix by using an automatic QByteArray instead.

Change-Id: I93eea1dff1c72f3ea280283bb68b4ed47d2a8e1d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-07 15:28:12 +02:00
Jarek Kobus
a245945f29 Add more tests for QtConcurrent::filterReduced()
Test the case where reduce function of the form:
V function(T &result, const U &intermediate)
has T and U types different.

Task-number: QTBUG-83802
Change-Id: Ic89396caba16e7e47ae3ec1527e31b8620f1b08c
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-05-07 15:23:58 +02:00
Jarek Kobus
daea738b9f Cleanup the qtconcurrentfilter test
Get rid of code repetition in concurrentfilter test.
Move tests with initial value next to their original version.
Join new lambda tests into a common functions
testing all possible 16 combinations of
functor / function / member / lambda, as they
test in fact the same function. There is no need
to distinguish lambda case over other cases.
This helps in test readability and maintenance.
Add missing tests for lambdas with a combination
of initial value.

Task-number: QTBUG-83802
Change-Id: I45930c1e18a9e4e561909f46a5cbbdf0ad7ba333
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-05-07 15:23:46 +02:00
Giuseppe D'Angelo
e106dfdd6b Clean up some more mixed enum/int math
Add casts when necessary, and replace a bitwise trick with
the proper function call.

Pick-To: 5.15
Change-Id: I8b3109781af1e7fdc5d1c4c3fafe43394c81d71d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-07 13:23:36 +00:00
Allan Sandfeld Jensen
891b60bbc8 Fix QRunnable::ref use in QThreadPool
The reference counter could only ever be -1, 0 or 1,
as an autoDeleted QRunnable can only be in a single
thread pool.

This commits keeps the reference counting for now,
but asserts sanity, simplifies locking and fixes a
leak.

Pick-To: 5.15
Fixes: QTBUG-20251
Fixes: QTBUG-65486
Change-Id: I4de44e9a4e3710225971d1eab8f2e332513f75ad
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-05-07 13:00:30 +00:00
Volker Hilsheimer
9b4b406142 Handle disk full situations by skipping QFile::moveToTrash test
If any of the temporary directories and files can't be created, skip the
test. Otherwise, the cleanup routine would recursively delete "/".

Change-Id: I51f908a468be8fd2ebd523ff7ce27a7c78d1b4e2
Fixes: QTBUG-83863
Pick-to: 5.15
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-07 14:27:17 +02:00
Volker Hilsheimer
a033c23ddf QFile::moveToTrash: work with relative file paths on Windows
The system APIs expect an absolute "display name" of the file path,
so make it absolute.

The test was overly tolerant in accepting failure, as a QStorageInfo
initialized with a file path that doesn't exist is invalid, and thus
always different from the QStorageInfo of the home directory. Fix the
test to compare only valid QStorageInfo objects, and postpone the check
until the file we want to move has been created.

[ChangeLog][QtCore][QFile] moveToTrash supports relative file paths
on Windows

Change-Id: I94c8cd40c60fde469e38f76a98f867f20c6a0b15
Fixes: QTBUG-84015
Pick-to: 5.15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-05-07 14:27:09 +02:00
Joerg Bornemann
ef0287d589 CMake: Fix icons in generated RC file
Change-Id: Idb11bd2058f2ec3f258845aea0d314430ff7c578
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-07 14:23:22 +02:00
Joerg Bornemann
864e1e10c4 CMake: Do not generate RC files for STATIC and OBJECT libraries
Those library types typically do not have Windows resources with
version information.

Change-Id: I1a385c2ae4e40d5c153ac6501c5ed826eaf75655
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-07 14:23:22 +02:00
Laszlo Agocs
0acab3c1ad rhi: Correct another scissor/viewport clamping problem
When x or y are >= the width or height of the render target, then the
width or height of the scissor/viewport rect is zero, no further logic
is needed.

This is different from the case of x or y being negative, because then
there is still a chance that there is an in-bounds area (if width or
height are large enough).

It is important to make this check based on the original value of x
and y, not the clamped ones. Otherwise we end up with a 1 pixel wide
region even when the expected result is a width or height of 0.

Previously the incorrect subtraction of 1 in the final clamping of w and h
masked this, but once that is fixed, the issue fixed here becomes visible
in the cubemap_scissor manual test.

Change-Id: I3d4b0a163a16aa1116b1e838fa95c0faf7b56a3d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-05-07 08:56:28 +00:00
Eirik Aavitsland
f116221ab9 RHI: fix off-by-one clipping
In cases where qrhi_toTopLeftRenderTargetRect() would clip the width or height
to the available space, it would subtract 1 from the result, leading to
painting errors.

Fixes: QTBUG-83928
Change-Id: I65d23151d838386b516ded0588702bc0bf4c0d93
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-05-07 08:56:24 +00:00
Kai Koehne
56c203fc09 Snippets: Fix dependency issues
The widget snippet was sometimes ignored, because the printsupport
dependency was not explicit in the top-level src.pro file. This lead
to a situation that, if printsupport by chance was already built,
it was tested, otherwise silently ignored.

This shows that having requires(qtHaveModule()) inside src/ is actually
harmful, and they are therefore removed from snippets.pro. Also, the
dependencies for the snippets projects are now moved to a central place
so that the correctness is easier to check.

Pick-to: 5.15
Change-Id: Ice051fa04848040e206c78361fbbcf680383c6b2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-05-07 08:37:00 +02:00
Kai Koehne
5bfbae7d20 Snippets: Fix gcc warning about unused variable
Pick-to: 5.15
Change-Id: I4396556038a545beedf599be1a2c61cbde99903a
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-05-07 08:36:59 +02:00
Friedemann Kleint
c75151f5d9 Fix build of the widgets doc snippets
Rename main() of the graphicsview.cpp snippet to ensure it
is not considered a real main() function and prevent future
duplicate symbols.

Amends 2e1ef96cf8.

Pick-to: 5.15
Task-number: QTBUG-81497
Change-Id: Ibbb29e17f263ff02d3910852b195b1513b953f75
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2020-05-07 06:36:59 +00:00
Mårten Nordheim
654cd10755 Make QVector's default ctor constexpr
Because then other objects can be made constexpr

Change-Id: I083d4e664549cf48db1c8f89a873c48b9c558b60
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-06 11:28:27 +02:00
Giuseppe D'Angelo
8c889bf110 QModelIndex/QAIM: improve const correctness
QAIM::createIndex() takes a non-const void*. It's
typically called from inside QAIM::index(), which is a
const member function. If the data storage wrapped
by the model is const correct, it means that we have
to drop constness somewhere before calling createIndex().

To support this: change createIndex() to take a
const void * instead. This is painless.

Accessing the pointer is a bit more troubling, because
the accessor (QModelIndex::internalPointer()) returns
void *. (Effectively, now it does a const_cast...).
To avoid a massive source break, I've left it alone,
and instead added another function to retrieve a
const void *.

Read-only models can now be fully (deep) const correct.

[ChangeLog][QtCore][QAbstractItemModel] The
createIndex() function now takes a const void *, rather
than a void *.

[ChangeLog][QtCore][QModelIndex] Added the
constInternalPointer() function, to retrieve the
internal pointer as a pointer-to-const.

Change-Id: I108912b6814fcd5fe0c5cb7db6c721ba51e83de0
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-06 11:27:48 +02:00
Thiago Macieira
0de4f0dcc3 Fix build of rdrand & rdseed with ICC on Linux
qsimd.cpp(636): error: argument of type "qregisteruint={quint64={unsigned long long}} *" is incompatible with parameter of type "unsigned long *"

Pick-To: 5.15
Change-Id: I99ab0f318b1c43b89888fffd160c4785c98adc4d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-06 01:58:50 -07:00
Allan Sandfeld Jensen
45baf3b090 Template fetching of pixels for perspective transformed bilinear
We already templated the affine fetch logic to de-doublicate code, this
does the same with the perspective transform logic.

Change-Id: Ief58b8cc36af8abcdd5cbd1c4ca614567c1c99b9
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-05-06 10:49:42 +02:00
Friedemann Kleint
984767023e Fix build of the widgets doc snippets after opengl split
Add the Open GL modules.

Amends a426326e99.

Task-number: QTBUG-81497
Change-Id: I648c171a1a329bbc7710254b9e7498de221b318b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-05-06 10:34:40 +02:00
Friedemann Kleint
2e1ef96cf8 Fix build of the widgets doc snippets on Windows
- Fix warning about missing return from main()
- Turn it into a library to prevent link errors from missing main()
  (used by winmain()).

Amends a426326e99.

Pick-to: 5.15
Task-number: QTBUG-81497
Change-Id: Idbcb5c26538ee474bc80387d0a1dae3af7b53744
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-05-06 10:34:32 +02:00