Commit Graph

55591 Commits

Author SHA1 Message Date
Marc Mutz
de699decb4 QFSFileEngine: don't call QFileSystemEntry::filePath() twice
Cache the result. Clean up the return statement as a drive-by.

Change-Id: Ic1bebd4ad4dd970202701be60fbcd286b9924df5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 11:36:09 +01:00
Marc Mutz
78073f8ab6 Restore C++20-deprecated mixed-enum bitwise operators
C++20 deprecated arithmetic on enum types. For enums used on QFlags<>,
these operators have always been user-defined, but when the two enums
are of different type, such as QFrame::Shape and QFrame::Shadow, the
deprecation warning pops up.

We have in the past fixed these in our headers by manual casts, but
that doesn't help our users when our API requires them to OR together
enums of different type.

Until we can rework these APIs to use a variadic QFlags type, we need
to fix it in an SC and BC way, which is what this patch sets out to
do.

The idea is simply to mark pairs of enums that are designed to be ORed
together and replace the deprecated built-in bitwise operators with
user-defined ones in C++20. To ensure SC and BC, we pass an explicit
result type and use that to check, in C++17 builds, that it matches
the decltype of the result of the built-in operator.

This patch is the first in a series of similar patches. It introduces
said markup macro and applies it to all enum pairs that create
warnings on (my) Linux GCC 11.3 and Clang 10.0.0 builds. It is
expected that more such markups are needed, for other modules, and for
symmetry.

Even with this patch, there is one mixed-enum warning left, in
qxcbwindow.cpp. This appears to be a genuine bug (cf. QTBUG-101306),
so this patch doesn't mark the enums involved in it as designed to be
used together.

This patch also unearthed that QT_TYPESAFE_FLAGS, possibly
unsurprisingly so, breaks several mixed bitwise flags-enum operations
(QTBUG-101344).

Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-99948
Change-Id: I86ec11c1e4d31dfa81e2c3aad031b2aa113503eb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-15 11:36:09 +01:00
Marc Mutz
3636325946 QLibrary: fix possible arg() format clobbering
The fileName could potentially contain the string "%n", n ≤ 5, in
which case the following .arg() calls would interpolate their
arguments at the wrong position.

Fix by interpolating fileName last.

Pick-to: 6.3 6.2 5.15
Change-Id: I1a75a7671cbfe85ba3b2df240c3ef74482fc848d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 11:36:09 +01:00
Marc Mutz
ce83a03cfd QColor: deprecate isValidColor, setNamedColor, string-ish ctors
[ChangeLog][QtGui][QColor] The constructors from string-ish type, as
well as the setNamedColor() and isValidColor() functions, have been
deprecated effective Qt 6.6 in favor of fromString() and
isValidColorName(), resp.

Fixes: QTBUG-101389
Change-Id: I002646bd48c1e4340dc6842fd136fc9f35bb9b61
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 10:36:09 +00:00
Heikki Halmet
ee0908228f Revert "Blacklist: test cases blacklisted in tst_QXmlStream:"
This reverts commit d3a297c0ab.

Reason for revert: Unnecessary blacklisting

Task-number: QTBUG-101332
Change-Id: I1e2c94585e719199724695347b243dffcde49259
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2022-03-15 07:32:32 +00:00
Christian Heimlich
7f3c68316e QVersionNumber: Make documentation period display style consistent
In the current documentation for this class there are two ways that the
period character is referred to.

Code Style: https://doc.qt.io/qt-6/qversionnumber.html#fromString
Quote Style: https://doc.qt.io/qt-6/qversionnumber.html#fromString-1

The code-style version is significantly clearer and clean looking, while
the quote-style version is easy to misinterpret, especially when
followed by an additional period at the end of a sentence.

This change updates the documentation so that the nicer style is used in
all locations to improve clarity and consistency.

Change-Id: I11a6d82accb923e24c00b93728ea084d27efd06d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 02:48:44 -04:00
Giuseppe D'Angelo
9b8015ed8d QMutexLocker: add isLocked()
It's basically for free.

[ChangeLog][QtCore][QMutexLocker] Added the isLocked() function.

Change-Id: Idad5fa249ba8f135dcf81c7b7596caa3a888e99c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 03:32:14 +01:00
Thiago Macieira
07b176ce70 qversiontagging: merge the qt_version_tag symbols
The symbols all still exist, but they all have the same address. For
example, in my Linux debug build:

 $ eu-readelf --dyn-syms lib/libQt6Core.t.so | grep qt_version_tag
 4352: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag_6_0@@Qt_6
 4356: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag_6_1@@Qt_6
 4358: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag_6_2@@Qt_6
 4362: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag_6_3@@Qt_6
 4364: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag_6_4@@Qt_6
 6458: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag@@Qt_6.4
 6460: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag@Qt_6.0
 6462: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag@Qt_6.2
 6463: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag@Qt_6.3
 6466: 00000000005e3e74      1 OBJECT  GLOBAL DEFAULT       18 qt_version_tag@Qt_6.1

(The part after the @ is the ELF version; two @ indicates the default
version)

Saves N bytes where N is the Qt minor version number. The exclusion of
Darwin (macOS) is because clang says that it has the "alias" attribute,
but then fails when you use it.

Change-Id: I74249c52dc02478ba93cfffd16d249d77d6f7565
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-14 18:26:13 -08:00
Thiago Macieira
dda4186842 qversiontagging: remove the old inline assembly content
No longer used, since GCC and Clang always have __attribute__((used)).

Change-Id: I74249c52dc02478ba93cfffd16d2494fa632ea10
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-14 18:26:12 -08:00
Thiago Macieira
40c8bc4202 qversiontagging: Use C++17 inline variables also on Unix
C++17 inline variables allow us to declare a variable that shall be
merged before linking, which replaces the need for the "comdat" part of
the inline assembly. The GCC attribute "used" tells the compiler not to
discard this variable, like the MinGW case. Additionally, the "retain"
attribute (where supported) tells both the compiler and linker not to
discard, allowing an intermediary, static library to keep this
definition.

This enables support for OSes besides FreeBSD and Linux, where it was
previously available. For example, on macOS:

 $ nm libexec/rcc | grep qt_version_tag
                 U _qt_version_tag_6_4
 00000001000ec608 s _qt_version_tag_6_4_use

On Linux, the assembly output before this change (Clang 13) was:
        .section        .qtversion,"aG",@progbits,qt_version_tag,comdat
        .p2align        3
        .quad   qt_version_tag@GOT
        .long   394240
        .p2align        3

After this change:
        .hidden qt_version_tag_use              # @qt_version_tag_use
        .type   qt_version_tag_use,@object
        .section        .qtversion,"aGwR",@progbits,qt_version_tag_use,comdat
        .weak   qt_version_tag_use
        .p2align        3
qt_version_tag_use:
        .quad   qt_version_tag
        .quad   394240                          # 0x60400
        .size   qt_version_tag_use, 16

The notable changes here are that there is a symbol and that the section
is writable. The latter is required because we store the pointer to the
qt_version_tag variable instead of just an offset in the GOT. The total
number of relocations in the resulting binary remains the same. We've
actually shrunk the binary by one pointer size.

Change-Id: I74249c52dc02478ba93cfffd16d23951a6bcd784
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-14 18:26:10 -08:00
Thiago Macieira
13ad42c679 qversiontagging: Add Windows support
Details in the comment in the header. I haven't recently tested with
MSVC, but I designed this originally in 2015 when I did have access to
Visual Studio so I know it works (I've confirmed with Godbolt).

With MinGW, this produces assembly:

        .globl  qt_version_tag_used
        .section        .qtversion,"dr"
        .linkonce same_size
        .align 16
qt_version_tag_used:
        .quad   __imp_qt_version_tag_6_4
        .quad   394240

394240 is 0x060400. The DLL import table contains:

 0015f03c       0015f294 00000000 00000000 00165478 0016012c

        DLL Name: Qt6Core.t.dll
        vma:  Hint/Ord Member-Name Bound-To
        161318      7  _Z11qt_assert_xPKcS0_S0_i
...
        164cf8   6073  qt_version_tag_6_4

Change-Id: I42e7ef1a481840699a8dffff1404f45b13f60ba6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-03-14 18:26:09 -08:00
Volker Hilsheimer
b2edef557c Baseline: don't compensate for DPRs != 1.0
The resulting blurriness is too significant, and it's hard to see where
the difference comes from. Better to encode the screen DPR into the
appearance ID if it's not 1.0, and warn about the comparison not being
done to the baseline images with a 1.0 DPR.

Pick-to: 6.3
Change-Id: Iceab7b0a4cc50627145bd1267cff22344f7d8e5b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-03-14 23:38:10 +01:00
Volker Hilsheimer
16d154ca5f Baseline: Allow setting git commit through environment variable
Widget tests run in VMs that don't have their own git clone.

Pick-to: 6.3
Change-Id: I20ab32affabfc7ce6dfaa445306b19efb51803e9
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-03-14 23:38:09 +01:00
Volker Hilsheimer
ad333b9b87 Baseline testing: make style name explicit
Mangling it into the checksum makes it hard to navigate the available
images.

Pick-to: 6.3
Change-Id: I54dcab5681e747ce1c5fe1b141ef6c4441d1f7eb
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-03-14 23:38:09 +01:00
Alexey Edelev
d1e02c3855 Add '-stdlib=libc++' only for c++ compilers
Pick-to: 6.2 6.3
Task-number: QTBUG-101602
Change-Id: I4ecbb73f845d94156189acfd1a3074b676c90fc4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-14 20:52:47 +01:00
Edward Welbourne
b15e01ff4e Use LogElementType rather than int as test-element type
All callers do in fact pass members of the enum, so just making the
defualt value be LET_Undefined rather than -1 eliminates any need for
it to be an int.

Change-Id: Ic1c9ae1522363666d1208aba60d4b4df5eff6ce0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-14 20:16:35 +01:00
Edward Welbourne
d854534789 Correct character semantics documentation in QByteArray(View)
QByteArray's list of case-implicating functions included three that
don't implicate case and omitted one that does. QByteArrayView lacked
any mention of the liminal nature of these and other methods that
presume any particular semantics to character data.

Pick-to: 6.2 6.3
Change-Id: I928ef2274704584f8a137c0a4a7aa3c3da57718e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-14 20:16:35 +01:00
Edward Welbourne
479c95729a Support global data tags in blacklisting identification of test-cases
Previously the blacklisting file format only worked with slot:data or
plain slot names for the items to blacklist. However, tests with
global data report themselves with the global data-row tag in the same
way as function-specific ones do; and tests which have both join the
two as slot(global:data) in the test output name, so the reader is apt
to mistake global:data for a data tag. In any case, it is potentially
desirable to be able to blacklist a function with either or both of
global and local data-row tags specified. Add support for that and
remove a blacklisting that was only needed due to the lack of this
support.

For now, make the new parameter to checkBlackLists() optional, so
that qtdeclarative's qmltest framework can adapt to this change.

Fixes: QTBUG-100870
Change-Id: I9125811ebdab75d3fb462ba8b60561f003426502
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-14 20:16:35 +01:00
Edward Welbourne
f081b2cb37 Inline q_toPercentEncoding() in QByteArray::toPercentEncoding()
The latter didn't do much aside from call the former, which was
private with no other callers. This prepares the way for som tidy-up.

Change-Id: Iff741662365553e719a9c8b1253aff11de96455f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-14 20:16:35 +01:00
Edward Welbourne
5a349a9c1b Eliminate the last place that QBA::nulTerminated() is needed
By simply forwarding two QByteArray values (as views, since that
suffices) we can retain knowledge of their sizes and thus avoid the
need to null-terminate in order to forward to a hand-rolled strchr()
that depended on that. Using QBAV::contains() turns out to be quite
expensive, so use memchr() to implement a more efficient check.
In the process, turn a pointlessly repeated check into an assertion.

Change-Id: I316623206e1cf315a59d54cf574649d6acbb5c43
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-14 20:16:35 +01:00
Edward Welbourne
5291dc7dcf Avoid possible allocation by amending a condition
QBA::toPercentEncoding() duplicated a condition to decide whether it
should include a percent-replacement character in its always-encode
list (which might allocate memory), where simply pretesting each
character against the percent achieves the same effect more cheaply.

Change-Id: Ic87a977713207d74b07ee6b811b0ead3b6945ef6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-14 20:16:35 +01:00
Edward Welbourne
08d6bc2477 Prevent exclusion of percent character from percent-encoding
When a percent-replacement present in the exclude list would,
normally, not have been encoded, it was encoded regardless, as
otherwise round-tripping fails. However, when percent or its
replacement would normally have been encoded, its presence in the
exclude list lead to it not being encoded, which duly breaks
round-tripping.  It also violates
https://datatracker.ietf.org/doc/html/rfc3986#section-2.4

[ChangeLog][Incompatible behavior change][QByteArray] When
converting to percent-encoding, it was possible to exclude the percent
character (or its replacement, unless this is one of the characters
not normally encoded) from conversion.  Doing so would violate RFC
3986 Section 2.4 and break round-tripping of any string that contains
the percent character. The percent character, or its replacement, is
now always encoded, even if mentioned in the exclude list, as the
documentation has always claimed.

Change-Id: I885ce33e05dc6877f1b3700fb0870fa30556a5aa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-14 20:16:35 +01:00
Edward Welbourne
84984cfce2 Add some %-encoding round-trip tests that use % in the plain-text
This was not previously tested.

Change-Id: Icd287b519f6bc5d450f4490990ac78b0d06774f6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-14 20:16:34 +01:00
Laszlo Agocs
1ea73bc29b Fix losing QOpenGLWidget paints when a child widget is invisible
Pick-to: 6.3 6.2
Change-Id: I136b486d30e31acadd6b1b837dc7e834ee3e23fb
Fixes: QTBUG-101620
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2022-03-14 17:48:52 +01:00
Topi Reinio
dd0c886783 Doc: Use \QtVersion macro to display correct version in code snippet
Pick-to: 6.3
Fixes: QTBUG-100770
Change-Id: Iec0e91bfb98781e63e5379bd0aa67d37df7c6cac
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2022-03-14 16:13:06 +01:00
Volker Hilsheimer
fd4186cd23 Fix click position for check box and radio button baseline tests
Some styles override the clickable area.

Pick-to: 6.3
Change-Id: Id6ec9d9aa2faff39489b2baa412af4339779ff5c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-03-14 16:13:06 +01:00
Morten Johan Sørvig
4676418842 wasm: prevent WebGL vertex attribute errors
WebGL is stricter than OpenGL ES and require that unused
vertex attribute arrays are disabled. This prevents
errors such as:

  WebGL: INVALID_OPERATION: drawElements: no buffer
  is bound to enabled attribute

Pick-to: 6.3
Change-Id: I68384a9f6954b6a1960ba6e8afd1fdbdfefe2335
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-03-14 15:13:06 +00:00
Marc Mutz
67385c04ce QDataStream: make qfloat16 streaming a non-member
Remove the member function from the API and re-add it as a hidden
friend on qfloat16, where it will be a complete type.

[ChangeLog][QtCore][Potentially Souce-Incompatible Changes] The
qfloat16 QDataStream operators are now hidden friends and only found
by argument-dependent lookup. Previously, these were member functions
on QDataStream.

Fixes: QTBUG-93499
Pick-to: 6.3
Change-Id: Ib3d4df7a3fe3a9d0938f3be8b70b50fef0416262
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-03-14 15:55:12 +01:00
Oliver Eftevaag
06c2ffdae7 Fix typo
Change-Id: I4cc6c6867490c1e10ca6c4bf5620325826a687a3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-14 10:15:12 +01:00
Ville Voutilainen
7f85425cb5 pthread_yield() has been removed in newer linux distros
pthread_yield() is a non-posix extension and was deprecated for a long time.
It's been removed recently at least from Fedora 35. Use sched_yield() instead.

Change-Id: Iae47fa09cc89005aa466446149be87e1b673c074
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-14 07:53:34 +02:00
ChunLin Wang
3017f59345 Remove disappeared QIconEngine::IconNameHook from QIcon
QIconEngine::IconNameHook disappeared,see commit
fce84f76f0

Fixes: QTBUG-98755
Pick-to: 6.2 6.3
Change-Id: Id0600b5682de4bfeaae9ca4e975d454d7ee158ff
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-14 02:53:53 +00:00
Aleksandr Reviakin
367f96aedf wasm: Use % instead of vh for canvas dimensions
Pick-to: 6.3
Fixes: QTBUG-95067
Change-Id: I19e439eb81200728c2b773ab6799bb205caa1231
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-03-13 23:24:59 +00:00
Liang Qi
9c6b986d96 gui: return first default device when seatName isNull
for QInputDevice::primaryKeyboard() and
QPointingDevice::primaryPointingDevice().

This also reverts ae9fefe3c8.

Fixes: QTBUG-100790
Pick-to: 6.3
Change-Id: Id02f277db25f823eb29e939e25801325df8e4076
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-03-13 22:08:16 +01:00
David Faure
7382e5735e QCompleter: fix crash when setting the same model twice
Found when retesting the testcase completer.zip from QTBUG-54642

Pick-to: 6.3 6.2 5.15
Change-Id: Id84eefeb3a33dc6d790cfa23755352381cc097a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-13 16:13:29 +00:00
Axel Spoerl
2140edaaab Add setCurrentId in QWizard
setCurrentId(int id) implemented incl. forward skip warning
respective test added in tst_qwizard

Fixes: QTBUG-99488
Change-Id: Ieaf31698baf1e8ec97484b4a221c8587385c9fb3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-12 13:24:29 +01:00
Giuseppe D'Angelo
297fdcaf30 Enable QT_TYPESAFE_FLAGS in headersclean
Change-Id: Ie40a18af7f97b73ea79a09e0dea3fe08c56a1ebb
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-12 06:33:29 +01:00
Volker Hilsheimer
63a3fd12fe QFile::moveToTrash: Remove support for old MinGW SDKs
SDK headers that shipped with older versions of MinGW didn't declare
the IFileOperation COM interface, so the original implementation of
moveToTrash included an inferior fallback that used the Shell APIs.

That fallback was already removed in 6a51ff3f0d,
now remove the #ifdef'ery as well.

Change-Id: Iba44df8267f5c1e3e883368d848eb9be1bd02ac3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2022-03-12 03:40:24 +01:00
Sona Kurazyan
6585963583 Deprecate {QString, QByteArray}::count()
And remove their uses.

[ChangeLog][QtCore][Deprecation Notice] Deprecated QString::count()
and QByteArray::count() that take no parameters, to avoid confusion
with the algorithm overloads of the same name. They can be replaced
by size() or length() methods.

Change-Id: I6541e3235ab58cf750d89568d66d3b1d9bbd4a04
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-12 01:05:45 +01:00
Sona Kurazyan
28d2514428 Use qstringfwd.h when forward declaring string classes
Task-number: QTBUG-98434
Change-Id: I37b70a1b7bc164fa7dc9cb702827297ca66a6fdc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-12 01:05:45 +01:00
Niklas Wenzel
b83fc8aafa GDI: Fix style name detection if font has no typographic subfamily name
This fixes the detection of font style names for the fonts "Bahnschrift"
and "Alef Bold" as described in Microsoft's documentation:
https://docs.microsoft.com/en-us/typography/opentype/spec/name

Fixes: QTBUG-101609
Fixes: QTBUG-101610
Pick-to: 6.3
Change-Id: I5bd2b72817c07195f1e98d1d924c6f673d9e24e0
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-03-11 21:25:01 +01:00
Niklas Wenzel
cb65e4182f Add styleName to debug output
This makes it easier to debug the font matching behavior.

Task-number: QTBUG-101436
Pick-to: 6.3
Change-Id: Id682384e7d9d669b9e736e00ef22cadfd0b4bfec
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-03-11 21:25:01 +01:00
Laszlo Agocs
68a4c5da9a Compose render-to-texture widgets through QRhi
QPlatformTextureList holds a QRhiTexture instead of GLuint. A
QPlatformBackingStore now optionally can own a QRhi and a
QRhiSwapChain for the associated window.  Non-GL rendering must use
this QRhi everywhere, whereas GL (QOpenGLWidget) can choose to still
rely on resource sharing between contexts. A widget tells that it
wants QRhi and the desired configuration in a new virtual function in
QWidgetPrivate returning a QPlatformBackingStoreRhiConfig. This is
evaluated (among a top-level's all children) upon create() before
creating the repaint manager and the QWidgetWindow.

In QOpenGLWidget what do request is obvious: it will request an
OpenGL-based QRhi. QQuickWidget (or a potential future QRhiWidget)
will be more interesting: it needs to honor the standard Qt Quick
env.vars. and QQuickWindow APIs (or, in whatever way the user
configured the QRhiWidget), and so will set up the config struct
accordingly.

In addition, the rhiconfig and surface type is (re)evaluated when
(re)parenting a widget to a new tlw. If needed, this will now trigger
a destroy - create on the tlw. This should be be safe to do in
setParent. When multiple child widgets report an enabled rhiconfig,
the first one (the first child encountered) wins. So e.g. attempting
to have a QOpenGLWidget and a Vulkan-based QQuickWidget in the same
top-level window will fail one of the widgets (it likely won't
render).

RasterGLSurface is no longer used by widgets. Rather, the appropriate
surface type is chosen.

The rhi support in the backingstore is usable without widgets as well.
To make rhiFlush() functional, one needs to call setRhiConfig() after
creating the QBackingStore. (like QWidget does to top-level windows)

Most of the QT_NO_OPENGL ifdefs are eliminated all over the place.
Everything with QRhi is unconditional code at compile time, except the
actual initialization.

Having to plumb the widget tlw's shareContext (or, now, the QRhi)
through QWindowPrivate is no longer needed.  The old approach does not
scale: to implement composeAndFlush (now rhiFlush) we need more than
just a QRhi object, and this way we no longer pollute everything
starting from the widget level (QWidget's topextra -> QWidgetWindow ->
QWindowPrivate) just to send data around.

The BackingStoreOpenGLSupport interface and the QtGui - QtOpenGL split
is all gone. Instead, there is a QBackingStoreDefaultCompositor in
QtGui which is what the default implementations of composeAndFlush and
toTexture call. (overriding composeAndFlush and co. f.ex. in eglfs
should continue working mostly as-is, apart from adapting to the
texture list changes and getting the native OpenGL texture id out of
the QRhiTexture)

As QQuickWidget is way too complicated to just port as-is, an rhi
manual test (rhiwidget) is introduced as a first step, in ordewr to
exercise a simple, custom render-to-texture widget that does something
using a (not necessarily OpenGL-backed) QRhi and acts as fully
functional QWidget (modeled after QOpenGLWidget). This can also form
the foundation of a potential future QRhiWidget.

It is also possible to force the QRhi-based flushing always,
regardless of the presence of render-to-texture widgets. To exercise
this, set the env.var. QT_WIDGETS_RHI=1. This picks a
platform-specific default, and can be overridden with
QT_WIDGETS_RHI_BACKEND. (in sync with Qt Quick) This can eventually be
extended to query the platform plugin as well to check if the platform
plugin prefers to always do flushes with a 3D API.

QOpenGLWidget should work like before from the user's perspective, while
internally it has to do some things differently to play nice and prevent
regressions with the new rendering architecture. To exercise this
better, the qopenglwidget example gets a new tab-based view (that could
perhaps replace the example's main window later on?). The openglwidget
manual test is made compatible with Qt 6, and gets a counterpart in form
of the dockedopenglwidget manual test, which is a modified version of
the cube example that features dock widgets. This is relevant in
particular because render-to-texture widgets within a QDockWidget has
its own specific quirks, with logic taking this into account, hence
testing is essential.

For existing applications there are two important consequences with
this patch in place:

- Once the rhi-based composition is enabled, it stays active for the
lifetime of the top-level window.

- Dynamically creating and parenting the first render-to-texture
widget to an already created tlw will destroy and recreate the tlw
(and the underlying window). The visible effects of this depend on the
platform.  (e.g. the window may disappear and reappear on some,
whereas with other windowing systems it is not noticeable at all -
this is not really different from similar situtions with reparenting
or when moving windows between screens, so should be acceptable in
practice)

- On iOS raster windows are flushed with Metal (and rhi) from now on
(previously this was through OpenGL by making flush() call
composeAndFlush().

Change-Id: Id05bd0f7a26fa845f8b7ad8eedda3b0e78ab7a4e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-11 21:25:00 +01:00
Tor Arne Vestbø
8ccf1080fc tst_QLocalSocket: Clean up leftover local sockets before listening
If a test crashes it might leave local sockets, causing test failures
on subsequent runs due to the socket already being "in use".

Pick-to: 6.3
Change-Id: Ie1107c414f4819026907071c7b8281b2e27b8541
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-11 20:32:08 +01:00
Tor Arne Vestbø
d5b3238def tst_QLocalSocket: Output error when listening fails
Pick-to: 6.3
Change-Id: I742de5f522e4a28794abdee863eea2758536d392
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-11 20:32:08 +01:00
Morten Johan Sørvig
851dc581cf Revert "QScreen_win: retrieve user friendly monitor name"
This made the screen names be non-unique (in my case
“28E850”), which causes the code in handleScreenChanges()
to think they are the same screen.

This reverts commit e9fd1c6aab.

Pick-to: 6.3 6.2
Change-Id: I97fb76aeb66857b4bf9b3c5b4bd6db6024446798
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
2022-03-11 19:32:08 +00:00
Fabian Kosmale
57c1e8d533 build system: support module local definitions
This introduces a new helper function,
qt_internal_add_repo_local_defines and makes use of it in
qt_internal_add_{module,test,executable,benchmark,plugin}. That function
checks whether QT_EXTRA_INTERNAL_TARGET_DEFINES is set. If it is, the
defines listed in there will be aded to all targets passed to the
functions mentioned above.

The intended usage is that QT_EXTRA_INTERNAL_TARGET_DEFINES gets set
in the repository local .cmake.conf. This allows e.g. opting in to
source incompatible changes in leaf modules (as long as those are
guarded by some define).

Pick-to: 6.2 6.3
Fixes: QTBUG-101640
Change-Id: I06c3693ee69f46e95a48de724621f0c97e7cc3a8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-11 20:32:08 +01:00
Marc Mutz
d743fd0d0a qDecodeDataUrl(): treat ";base64" marker as case-insensitive
RFC2397 doesn't explicitly mention it, but references RFC2045, which,
in Section 2, states:

> All media type values, subtype values, and parameter names as
> defined are case-insensitive.

and goes on, in 6.1:

>   mechanism := "7bit" / "8bit" / "binary" /
>                  "quoted-printable" / "base64" /
>                  ietf-token / x-token
>
>   These values are not case sensitive

So regardless of whether "base64" is a parameter name, or a mechanism,
we need to treat it case-insensitively.

Use QLatin1String::endsWith() instead of QByteArray::endsWith(),
because the former takes Qt::CaseInsensitive while the latter would
need a toLower().

Add a test.

As a drive-by, use the same trick for the existing case-insensitive
comparison with "charset".

As a further drive-by, fix inappropriate uses of QLatin1String (=
where they don't prevent allocations).

[ChangeLog][QtCore][QUrl] Now recognizes the ";base64" marker in
"data:" URLs case-insensitively.

Pick-to: 6.3 6.2
Change-Id: Ife6ba771553aaad3b7c119c1fa631f41ffa8f590
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-11 19:15:49 +00:00
Marc Mutz
cfa4879b41 De-inline dtors of QTextureFileHandler hierarchy
Destructors of polymorphic classes should be out-of-line to pin vtable
and type_info objects to a single TU.

Pick-to: 6.3
Task-number: QTBUG-45582
Change-Id: I541437a3ff53852527f6278355f7b549e62e17f7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-11 19:15:49 +00:00
Marc Mutz
61e3fe7fd9 Do not assume implicit string-ish → QColor conversion
We want to mark the corresponding QColor ctor(s) explicit.
Use Qt::GlobalColor or the new QColor::fromString() instead.

Change-Id: I68bf75a094e6821b97682de5a0ffd975834d22d0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-11 20:15:49 +01:00
Marc Mutz
abe3b4c9b9 Extract Header qstringfwd.h
... from qstringalgorithms.h and qutf8stringview.h, in order to
centralize the declaration of the string classes, much like
qcontainerfwd.h does for Qt containers.

[ChangeLog][QtCore] Added header qstringfwd.h containing
forward-declarations of all Qt string classes.

Task-number: QTBUG-98434
Change-Id: I4cf1ede9fe6c286230f4c7e7abe379da28ce5d15
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-11 20:15:49 +01:00