Commit Graph

45413 Commits

Author SHA1 Message Date
Marc Mutz
a6a412dbb6 QItemSelectionModel: replace a QPair with a dedicated struct
Pairs are easy to use, but they have no semantics attached: Two
QPair<int, int> compare equal, e.g., even though one is used as a
coordinate and the other as, say, a fraction. It also carries no
information for the reader of the code, as exemplified by the urge to
comment on the content of the pairs in both functions that use them.

So, write a minimal struct with equality and qHash() instead. The
comments are now no longer needed.

Change-Id: I51f6ff049a5f8fa61c51856376ac2fcbfb8dd506
Reviewed-by: David Faure <david.faure@kdab.com>
2020-05-05 07:24:26 +02:00
Giuseppe D'Angelo
2eee9e6fcf QKeySequence: remove docs of methods recently removed
Amends dccf28b7c3.

Change-Id: Ic4eeda8706b58fdff716e8f86a2bf7cc77ec0c7a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-05 00:32:27 +00:00
Giuseppe D'Angelo
3aadbec516 QAbstractScollArea: Cast an enumerator to int before doing math on it
Change-Id: I78288c7d104a33936b6f1f3f7bff9a076845cfc8
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2020-05-05 00:32:01 +00:00
Giuseppe D'Angelo
ca88c6ab58 QFileDialog: fix enumeration mismatch
To define a shortcut a Qt::ArrowType enum value was getting
mixed with a keyboard modifier. An actual mistake spotted
by blocking mixed-enum operations!

Change-Id: I4df56ee411599937c243288e8518b5c1df446397
Pick-To: 5.15
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2020-05-05 00:31:57 +00:00
Giuseppe D'Angelo
2c9a29a09a QHashFunctions: port to if constexpr
Condition is a compile-time one.

Change-Id: I6e60f12cc51e96b2528c375017357c0631e2fc0b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2020-05-05 02:31:54 +02:00
Yuhang Zhao
317383217b Add more entries for QMAKE_TARGET_XXX
Change-Id: I1cf4a8f19ec47247fbe469b9cc81ed80f6ba5a82
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-05 08:24:22 +08:00
Qt Forward Merge Bot
5e94fdc488 Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-05-04 23:12:40 +02:00
Sona Kurazyan
ed6fbeffb2 Port more tests from qtbase/tests/auto/corelib/io/ to CMake
Change-Id: I56427e3e1908047a0674c8c80c24eeda80e947c2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-04 19:21:15 +02:00
Qt Forward Merge Bot
0f7987f0c9 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	src/corelib/text/qlocale.cpp
	src/network/access/qnetworkaccessmanager.cpp

Regenerated tests/auto/testlib/selftests/float/CMakeLists.txt

Change-Id: I5a8ae42511380ca49a38b13c6fa8a3c5df8bed01
2020-05-04 17:38:40 +02:00
Volker Hilsheimer
112c285fcc QFile::moveToTrash: use $XDG_DATA_HOME/Trash as the trash directory
The code assumed that files in $HOME should be moved into $HOME/.Trash,
which is not what the spec says. The "home trash" is defined to be
$XDG_DATA_HOME/Trash, and we can expect $XDG_DATA_HOME to exist. If it
doesn't, then we can safely fail, as the environment is not compliant
with the Desktop Base Directory Specification [1] anyway.

[1] http://www.freedesktop.org/Standards/basedir-spec

This will make the tests fail on such non-compliant environments, such
as server versions of the distribution. That's acceptable.

[ChangeLog][QtCore][QFile] moveToTrash now creates the trash folder on
Linux as $XDG_DATA_HOME/Trash, as required by the freedesktop.org spec.

Change-Id: I7ef73c0c268ef5ea4df141bb7831b93a65ad213a
Fixes: QTBUG-83933
Pick-to: 5.15
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Faure <david.faure@kdab.com>
2020-05-04 16:26:26 +02:00
Marc Mutz
ea7d85457d QFileSystemEngine: 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: Ife8e09b4a54060ef52c9aac43e400736ea398c29
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-04 08:53:52 +02:00
Lars Knoll
7f02abd301 Fix 64bit size issues in QCache
size() and count() should return a qsizetype in Qt 6 in line
with QHash and other containers.

Add a cast in keys(), as QVector still needs to get converted to use
qsizetype for it's length.

Change-Id: I64a9d16ec4279d3dbb35c718b16a741665b9769e
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-05-04 08:31:05 +02:00
Friedemann Kleint
da3cb1deb6 uic: Generate Qt 5 connection syntax
Add a enum and formatting for member function pointer based
connections. Now preferably use member function pointer for Qt classes
or parameterless connections.

This should not require qOverload() within Qt classes after the
Signal/Slot disambiguation.

Add command line option to force either syntax for all connections.

Task-number: QTBUG-76375
Change-Id: Icdb4051e1173172a71cd536bdbc7d1ab1edf267d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-04 08:12:33 +02:00
Eskil Abrahamsen Blomfeldt
8231614661 Fix QTextDocumentLayout test with certain fonts
If there is a negative right bearing on the last character of the string,
it will stretch past the tab position (which aligns the advance position,
and not the right edge of the glyph). For certain fonts, this would cause
the actual ideal width to be calculated as 301 instead of 300 (which is
the right alignment edge set in the code).

Pick-to: 5.15
Fixes: QTBUG-46206
Change-Id: I03e8b8fb86e9ebe5337d3ba3384ade73d2ccdd69
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-04 08:00:37 +02:00
Eskil Abrahamsen Blomfeldt
7a18b7e2c2 Fix font height metrics with embedded bitmaps
For fonts with embedded bitmaps, we cannot trust the HHEA and
OS/2 tables, since there are a different set of font metrics
in the EBLC/CBLC tables for each of the predefined bitmap
sizes.

In this case, we can safely fall back to the metrics returned
by the system, as the inconsistency we were originally fixing
was only between OS/2 and HHEA and will not matter for the
bitmap fonts.

This patch also simplifies the code path through the font
engines a bit. Instead of setting the system metrics in the
processHheaTable() function when the table cannot be found,
we instead always fetch the system metrics at the very start
of initializeHeightMetrics() and then override if there are
no embedded bitmaps, and if the HHEA and OS/2 tables are
available. This also reduces the number of virtual functions
needed to sort out the height metrics.

Fixes: QTBUG-83754
Change-Id: Ib9dc6fc6cf972e48209a4a272469d2b4bd1ebffe
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2020-05-04 05:46:25 +00:00
Paul Wicking
b7e3a9e504 Fix typo in readme
Change-Id: I6066eb5309ff7e6e4e6fd1b8dff65957be6d5a55
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-04 07:01:55 +02:00
Kai Koehne
e720b7ff47 Doc: Small fixes in qt5_wrap_cpp documentation
Pick-to: 5.15
Change-Id: I0cc066eb5b53c7efb94a9f94cf574b2507f90cf8
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-05-03 10:30:46 +02:00
Marc Mutz
0f2869fcdc QDirIterator: port visitedLinks from 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.

The old code performed the visitedLinks check unconditionally, but
since we add entries to visitedLinks only when following symlinks (and
this property cannot be changed under iteration, as `iteratorFlags` is
a const member), the new code only performs the check conditionally,
with unchanged semantics.

Change-Id: Ia2c2dda16136ef5256e2c345b8ecba530883ee37
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-03 08:16:33 +02:00
Marc Mutz
1ba42c10bb QDirIterator: move a guard condition from caller to callee
The private pushDirectory() method is only called from the
QDirIterator ctor and from checkAndPushDirectory(). Moving the loop
check from checkAndPushDirectory() to pushDirectory() therefore
doesn't change anything, since, for the ctor case, it will always
fail.

This is preparation of using QDuplicateTracker for `visitedLinks`.

Change-Id: I609934002dabebf0a3e7a516b8398eae7db770d5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-03 08:16:23 +02:00
Marc Mutz
e62f6ffcb3 QDirIterator: make a confusing condition less so
The old code checked for non-empty-ness before asking whether it
contains a certain path. But an empty container cannot contain any
path.

Simply remove the isEmpty() check.

Change-Id: Ie40279a8db4900c2f7892c2a058206d622565b10
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-03 08:16:16 +02:00
Lars Knoll
74306a02ce Don't use a QTextStream to read lines from a file
QFile::readLine() can do the same at a fraction of the cost
of QTextStream.

Change-Id: I8c542756bcbd893dfa76d03e76e3ce0810aa2871
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-02 21:32:05 +02:00
Lars Knoll
8d89402435 Fix warnings about size_t to uint truncation
Use size_t for the internal hashing in QTextFormat to be
in line with QHash.

Change-Id: I210ab1622225f8e435d22e27ee7f730a4522ebe7
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-05-02 21:32:05 +02:00
Lars Knoll
8292e3c590 Fix compile error on iOS
Change-Id: I776967c5d69e8d2d318fb2670e401d4ee3dccb67
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-02 18:53:03 +02:00
Marc Mutz
343ba5f0a9 QUrlIdna: avoid QString creation
Change-Id: Id05eecfcb1e170920c05fb0c7f17e46f039b4dee
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-02 07:30:44 +02:00
Marc Mutz
8fea227f30 QUrl: optimize fromAce()
Change-Id: I255b8c806e1386f654c372e8a327ca7aef1b610a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-02 07:30:30 +02:00
Marc Mutz
84aad0ab7b QUrl: avoid QString creation in setHost()
Change-Id: I7c55fc6c5b0194a2d77428f70f5a3053768b3d43
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-02 07:30:21 +02:00
Marc Mutz
13bea13792 QUrlIdna: port qt_ACE_do() to QStringView
Change-Id: I29abc17576ceb72dd678e3ca59456e6220acd0a6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-02 07:30:10 +02:00
Marc Mutz
2e69375616 QUrlIdna: port nextDotDelimiter() to QStringView
Change-Id: I4fec88be2dacadcbb72927b973a51e1ead178c88
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-02 05:29:58 +00:00
Marc Mutz
f3449b4d0a QString: replace a few autos with char32_t
(under protest)

Amends 4ba25a0920.

Change-Id: I5d5eecd9196fff34ac008bcb0213f476ccbb1155
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-02 07:29:18 +02:00
Joerg Bornemann
b530ddf795 CMake: Write QT.XXX.plugin_types to qt_lib_XXX.pri files
This is needed for building Qt plugins with qmake against other
CMake-built modules.

Change-Id: Ibd6ad0b08645c798be74285b24f71add947bea88
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-01 19:11:57 +02:00
Alexandru Croitor
29bb6311e3 CMake: Add some missing MinGW defines
Task-number: QTBUG-83929
Change-Id: Iaa12f1f8652cb132bead91160a2898657de52edb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-05-01 19:11:41 +02:00
Alexandru Croitor
27aeb30b5d CMake: Limit warnings_are_errors flags to C++ and Objective-C++
Otherwise when applied to bundled 3rd party library C files,
the MinGW build fails when compiling src/3rdparty/md4c/md4c.c.

Change-Id: Ia522b10aa69aa15f239d20c65e31c84edbccee6d
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-05-01 19:11:37 +02:00
Alexandru Croitor
c85b393023 CMake: Fix developer build of MinGW cmake configuration
qmake is not warnings clean, so don't add -Werror.

Change-Id: I7a823241ded56967c1b802203f404ee36ed26429
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-01 19:11:33 +02:00
Alexandru Croitor
a876ff1283 CMake: Fix failing standalone tests on Windows
Due to the install prefix being changed for standalone tests,
the correct $qt_prefix/bin folder was not added to the PATH
environment variable when running tests.

Make sure to always include the the original qt install prefix,
even if a different install prefix is specified when configuring
standalone tests.

Amends 39090ea15c

Change-Id: I22aab732bb2bb679074a811d28d8209e1d535df3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-01 19:11:29 +02:00
Alexandru Croitor
88f6087f01 CMake: Use NAME_MISMATCHED in find_package_handle_standard_args of ECM
Gets rid of mismatch warnings when looking for various
ECM packages like XCB.

Change-Id: I0bf4db993195993df7789c032454b7883e8efd35
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-05-01 19:11:25 +02:00
Alexandru Croitor
f2ae9b3baa CMake: Adjust instructions for MinGW builds
Don't do any of the MSVC-related instructions when targeting MinGW.
Make sure to pass gcc and g++ as compilers when targeting MinGW.
Don't use any ENV_PREFIX that sets up the MSVC environment.

Task-number: QTBUG-75578
Change-Id: Icf5c39b58391d473d914fe8dc17d062812b07df1
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-05-01 19:11:22 +02:00
Alexandru Croitor
c571cb71a7 CMake: Fix 32 bit Qt builds like our MinGW config in Coin
Enable sse2 and fpmath for modules when appropriate, the logic
is a port of the code in mkspecs/features/qt_module.prf.

Fix qdrawhelper.cpp to always be compiled when using GCC with a
special case. pro2cmake.py failed to handle the source subtraction
correctly.

Fixes: QTBUG-83791
Task-number: QTBUG-75578
Change-Id: Ibe32a250b266d580ad21f6c55f09fd03a14ceb82
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-05-01 19:11:17 +02:00
Lars Knoll
be04ee67de Correctly flag remaining chars for the ICU codec
This will help us get rid of an extremely ugly hack in
QTextStream, where we copy the state.

Change-Id: If3e15eeb4e35c8607be54dd11c09ddfed87a4d93
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-01 18:53:21 +02:00
Lars Knoll
0a02a598a4 Read XML as utf-8 not latin1 if we don't have codecs
99.5% of all XML documents in the world are encoded in utf-8, not in
latin1.

Also fix the tr() methods to use fromUtf8() in line with the Qt6
policy that source code should be in utf8.

Change-Id: Ie8744786185de839bfa5c9853b7bc36e36af293a
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-05-01 18:53:03 +02:00
Lars Knoll
5e5085c3bb Remove QTextCodec dependency from the xcb plugin
Change-Id: I4b6a7352ff86b40ac5c6b118f29f630a7f9e3a7e
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-01 18:52:35 +02:00
Lars Knoll
4db2f067f1 Force the ibase plugin to use utf8
Firebird supports utf8 properly since version 2.0
(released some time before 2012), so force the client
encoding to it, and remove the QTextCodec related code.

Remove pre Firebird 2.0 code paths at the same time
and add an assertion to test that we have recent enough
client APIs.

Change-Id: I4c23e23f2fb1b4f550eaca63c47587fe9aaf3a6d
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-05-01 18:52:15 +02:00
Lars Knoll
8ab3b54fb7 Always assume utf8 for the client connection with the mysql server
The code was already trying to set the client charset to utf8. Enforce
this further and issue a warning if it fails.

Remove the text codec dependencies and directly use to/fromUtf8().

Change-Id: Ib75e46aaf0d1a274f6832b19eb38623a5cae5eb3
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-05-01 18:52:15 +02:00
Lars Knoll
52053a8994 Remove useless code
We don't rely on a latin1 locale anymore for the test,
and the other code was not doing anything.

Change-Id: I08bc08d200c9e037884d8b680dfbb24c129f3d2e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-05-01 18:52:15 +02:00
Lars Knoll
55dc178271 Remove QTextStream dependency from tst_qfile
Change-Id: I83cb05da8c094185b50e9cedea2e705ad1c7f948
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-05-01 18:52:15 +02:00
Lars Knoll
5acc3dd242 Remove a couple of QTextStream usages
Don't use QTextStream to write a QString to a file in UTF-8.
This can be done more easily, by directly converting the
QString to utf-8 and calling write on the io device.

Change-Id: I4b617b342ab339affb396ed49c5a920985d1ddfd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-05-01 18:52:14 +02:00
Lars Knoll
a308df82ae Don't use a QTextStream to write the trash info file
Using a QTextStream to write the file is probably around
50 times slower than simply creating the required string
here and writing it.

Change-Id: Ia848e4ad2688f098c671938d7ad9aaa4764a4158
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-05-01 18:50:10 +02:00
Lars Knoll
42d2d70abe Remove textcodec codepaths in qmake
They were anyway unused since years

Change-Id: I559b5042f6b942d7a940ac374d2b2740f2d4dc12
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-01 18:50:02 +02:00
Ilya Fedin
38337fa9d3 Fix URL opening in snap sandbox
For some reason, snapd doesn't allow dbus activating of xdg-desktop-portal and returns AccessDenied to any request. Qt checks the returned error and if it is not ServiceUnknown, Qt doesn't try to open URL through xdg-open, which encounters into situation that URLs doesn't open until some other app tries to access xdg-desktop-portal.

Fixes: QTBUG-83837
Change-Id: I9e600f734401bd4295d97e2b5686b916c6c7f762
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-01 20:03:06 +04:00
David Faure
f0ea852d4d QCommandLineParser: Wrap very long option names to leave room for descriptions
Fixes: QTBUG-79926
Change-Id: I3302e0ed5b58949a35ccb001c71b22a6400a6c81
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-01 10:53:55 +02:00
Nico Vertriest
a426326e99 Doc: Make snippets Qt Widgets compilable
Removed mainwindowsnippet.cpp and widgetdelegate.cpp
from snippets.pro

Task-number: QTBUG-81497
Change-Id: I40d1f34e64d958d2fb857dc8e468b9c40fff527c
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2020-05-01 06:44:07 +02:00