After the windows font engine was no longer marking everything as
scalable we started limiting the font size of requests to the maximum
of Courier when it was requested. This was a regression from 5.8 and not
in agreement with our documentation.
The problem is that we would only make the switch from Courier to
Courier New after having already gone through the foundry-lookup and
found a closest-available font size for Courier.
With this sanitization step in the backend we can make these changes
early enough that we haven't yet adjusted e.g. the font size.
Pick-to: 6.2 5.15
Fixes: QTBUG-58995
Change-Id: I319e93e6b78c7c3c5539964ac5ab4e05f8902ab6
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
- GHS compiler is not fully compliant with iec559. Therefore we need
to update is_iec559 checking for GHS case.
Pick-to: 6.2
Change-Id: Ia094509d26bf5f0109f2937547a056267019cffb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
When running a test using -callgrind, we recurse into a child process,
run under valgrind, to which we pass -callgrindchild; and we only want
the output from the child process, since the parent won't actually be
running any tests. We also won't be using the global data table for
the test in the parent process. So bypass the set-up and tear-down of
both logging and the global data table in the parent process.
Prior to commit 3ee6d8d336, these parts
of the set-up and tear-down were skipped in the callgrind parent
process, but that refactoring split qExec() up into qInit(), qRun()
and qCleanup() to enable QtQuick to recombine them to implement an
equivalent of qExec(), calling qRun() once for each built-in style. It
needs these pieces of set-up to happen in qInit(), and of tear-down in
qCleanup(), to avoid repeating them for each style. Leave a comment in
qExec() that might help future readers to understand why it's done the
way it is.
Change-Id: Ieaca9a125c713b8fcf8dec8f9be0c024a798d504
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Its twoHundredMillionInstructions() test has #if-ery to limit it to
gcc and x86; however, it was testing only __i386 for the x86 part,
where gcc defines __x86_64 instead on modern 64-bit systems. In the
process, invert the condition and the branches it controls - positive
tests are easier to comprehend.
Change-Id: I8e906c606c48aa5034e02e3ed5d042fbb1f2ecbc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Development web server for web applications. Supports
http and https. Sets COOP and COEP headers.
The web server script supports certificate generation using
mkcert (github.com/FiloSottile/mkcert). Briefly, mkcert
supports generating server certificates for the current
local ip address(es), using a certificate authority
which can be installed on devices where the app should
run.
The COOP and COEP headers are required to enable the
SharedArrayBuffer API, which is required for Emscripten’s
pthreads implementation.
The server serves the current directory on localhost
by default. Use the “-a” argument to bind to an additional
address, or "--all” to bind to all IPv4 addresses found on
local network interfaces. Change the directory by passing
it as a positional argument.
Task-number: QTBUG-79087
Change-Id: Id0cba649e42af53ed8106e336a77e78398bcf901
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>
We can expect that users use Qt 6 to try out Qt 6 examples.
Pick-to: 6.2
Change-Id: Ifa7bd9471a712fa1d63107b7ff2d392b7aefdcfe
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Currently the compositor draws the Qt logo by default;
check if the window has an icon and draw that instead
if set.
Fixes: QTBUG-86052
Pick-to: 6.2
Change-Id: Ia4f9c03562c15993c86cb8717f27e47ab669353d
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
It's a precondition and we might just as well check it, given that
people have actually got the order of the arguments wrong (cf.
QTBUG-69330).
Unfortunately, Q_ASSERT is defined below qBound in qglobal.h, so I had
to reshuffle some code around.
Change-Id: I82e52bcb863ff8c96594817e0cd5d7d2abe2e57e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
A default constructed QPageLayout has an invalid QPageSize. When
asking for its size, an invalid QSize is returned (-1, -1). This
size is then used to calculate the maximum margins the page layout
can have, resulting in negative margins.
I'm not sure if that makes sense for QPageLayout (in principle, a
negative margin is acceptable, meaning to "grow" the size), but then
this margin is passed as an upper bound to a series of qBound calls in
QPageLayoutPrivate::clampMargins.
To fix this, change the calculations of the maximum margins by using
a lower bound of 0.
Change-Id: I429104acfb2296d9eb1ee54c113e9d7e22d9b6ab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
If a QListView's model is reset to an empty one, its columnCount()
below the root is going to be 0. Therefore, the code was doing a
qBound(0, d->column, -1)
which is meaningless (high < low). Instead, do the two logical
operations explicitly: first do an upper bound on d->column
(using qMin) and then lower bound the result by 0 (using qMax).
The code worked by chance, because 0 was eventually the correct
number to use as a bound for d->column.
Change-Id: Ic32077cdab01eaa715137c05ed1f9d66c8eb2f67
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
These are left-overs from the initial qmake2cmake conversion.
Pick-to: 6.2
Change-Id: Ie15c9ff022ea4566d10c1ba74599de9af83d29a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
[ChangeLog][QtCore][QStringBuilder] Added support for QByteArrayView.
Change-Id: If2c23549d533dd31c320f3ee455fcd01ea5b460a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
[ChangeLog][QtNetwork][QNetworkRequest] Added
QNetworkRequest::Http2CleartextAllowedAttribute which controls whether
HTTP/2 cleartext (h2c) is allowed or not. The default is false. This
replaces the QT_NETWORK_H2C_ALLOWED environment variable.
Task-number: QTBUG-98642
Change-Id: I43ae1cc671788f6d2559cd316f6667b412c8e75e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Visual Studio 2019 introduced the dubbed FH4 feature
which can make C++ exception handling smaller on x64.
According to the article [1], it's enabled by default
for UWP applications, and Microsoft also use it in
their own widely-known commercial products such as
Office to reduce the binary size.
So make use of this feature for Qt when possible, to
get smaller binary.
As a drive-by, add "/EHs-c-" explicitly to the flags
when we want to disable C++ exception handling.
[1] Official article that introduces dubbed FH4:
https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/
Change-Id: I2e3330de477f78372cf7903d0ef7a732b09552a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The new overload allows creation of files with non-default permissions.
This is useful when files need to be created with more restrictive
permissions than the default ones, and removes the time window when
such files are available with less restrictive permissions.
[ChangeLog][QtCore][QFile] Added QDir::open() overload that
accepts permissions argument.
Fixes: QTBUG-79750
Change-Id: Iddfced3c324e03f2c53f421c9b31c76dee82df58
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The new argument allows atomic creation of files with non-default
permissions.
Task-number: QTBUG-79750
Change-Id: I4c49455b41f924ba87148302c8d0f77f5de0832b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
After 556511f9f3, which moved the resolve
mask storage into the palette's d-pointer, modifying the resolve mask
requires a detach. As of now, we only detached when setting a different
brush, but always modified the resolve mask, which broke palettes that
shared the d-pointer (likely the global default palette).
However, detaching has negative side effects when styles set brushes on
temporary palette objects and then use that palette object's cache key
to build a cache of pixmaps. As each drawing would detach the palette
(even if the palette doesn't change, which is likely), the cache key
changes with each detach, and the cache would quickly increase in size.
This was addressed in changes d7bcdc3a44
and 1e75dcf251.
We can either detach and find other ways to address the issues from
QTBUG-65475, or we can not change the resolve mask when the brush doesn't
change and completely ignore the call.
Since QFont ignores the setting of any attribute to a value that is
identical to the current value, and since it's possible to force that
the resolve-bit is set by calling setBrush twice with different brushes,
ignoring the call seems like the better solution.
[ChangeLog][QtGui][QPalette] Setting a brush on a palette that is
identical to the current brush no longer sets the resolve mask bit for
that particular role, so items using the palette will continue to
inherit changes from parent items.
Fixes: QTBUG-98762
Task-number: QTBUG-65475
Pick-to: 6.2
Change-Id: Ife0f934b6a066858408ef75b7bb7ab61193ceb47
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Allows changing the font used to display a font family
[ChangeLog][QtWidgets][QFontComboBox] Added the setDisplayFont() function, in order to be able to control the font used to render the font name and sample text (when previewing the fonts).
Change-Id: I94bfef43142c5346237e3069449bd19dbacb7420
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Allows setting the sample text to be used
[ChangeLog][QtWidgets][QFontComboBox] Added the setSampleText() function, in order to be able to control the sample text displayed by the combobox (when previewing the fonts).
Change-Id: Iedcd3bb72bc6aec9a178f14f7fbbe324ba0223ef
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Apparently this code is needed on other platforms now, not only macOS.
Pick-to: 6.2
Fixes: QTBUG-98504
Change-Id: Ie0a7e38609e8fc8c11915784dd3652a3517bb639
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Only use shellQuote() if the path is actually passed to a native API.
For QFile API, use the unquoted path.
Fixes: QTBUG-97649
Pick-to: 5.15 6.2
Change-Id: I9d8131819010bbd2faa8a81eef367245d90a767f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
addApplicationFont and addApplicationFontFromData basically do the same
thing (with one reading the data from a file and another reading
it directly from QByteArray)
The documentation is not quite identical, so fix that by using \include
magic of qdoc
As a drive-by, remove outdated \note within addApplicationFont() description
Fixes: QTBUG-98752
Pick-to: 5.15 6.2
Change-Id: I29738e7411d241c26a4b2e1dd91d0af867fcc111
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Says GCC -std=c++20:
src/gui/util/qlayoutpolicy_p.h:127:30: warning: bitwise operation between different enumeration types ‘QLayoutPolicy::Policy’ and ‘QLayoutPolicy::PolicyFlag’ is deprecated [-Wdeprecated-enum-enum-conversion]
127 | if (verticalPolicy() & ExpandFlag)
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
Fix by making Policy a QFlags<PolicyFlag>, which we can do because the
class is private. In QSizePolicy, this would break BC.
Since a QFlags cannot be opened for constants like an enum, we need to
define the ex-Policy-enumerators as static inline constexpr objects
instead.
Pick-to: 6.2
Change-Id: I29bc938f86508deed3f99ad9d1c1892547206c05
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Less noisy compiler error messages.
[ChangeLog][Potentially Source-Incompatible Changes][QSizePolicy]
qHash() is now a hidden friend and can only be called by unqualified
(qHash(sp)), not by qualified lookup (as in, say, ::qHash(sp) or
QT_PREPEND_NAMESPACE(qHash)(sp)).
Task-number: QTBUG-98863
Change-Id: I37d26c661c2d8bb74350eb9378bd19fa426678d2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This can be useful for some cases when the Android APIs have calls
that expects a FileDescriptor instead of a Uri or an int file
descriptor (like a case in Qt Multimedia with MediaRecorder).
Pick-to: 6.2
Task-number: QTBUG-96081
Task-number: QTBUG-96957
Change-Id: I0ab8d37a43b7cb94f6ebb5d48014e5a7903aadc7
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
The method getUriWithValidPermission() now returns null only if the
Uri couldn't be parsed, otherwise, returns the parsed Uri and fail later
when used if it doesn't have permissions for example.
Also, Don't use use hardcoded strings for method names, and print the
exception message instead of the whole stack.
Pick-to: 6.2
Task-number: QTBUG-96081
Task-number: QTBUG-96957
Change-Id: If7ba88265c9683e6660cb483cfee6c22016f2976
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
QApplication hides the fact that the reason is never set by several
QPA plugins, but Quick items don't receive the correct reason on
Windows, Android, the offscreen plugin, and other platforms.
Add relevant scenario to the QFocusEvent test case, and fix the
plugins to always set the focus reason when handling window activation
changes. Exclude the minimal plugin from the test, it seems largely
unmaintained anyway.
Task-number: QTBUG-75862
Change-Id: I5404a225b387fc9a3851b6968d0777c687127ed1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
In xcb plugin, XCB_EVENT_MASK_RESIZE_REDIRECT is set but it is not
necessary. Mouse events are disabled by setTransparentForMouseEvents
and there is no reason to have this event mask.
Fixes: QTBUG-86372
Pick-to: 6.2 5.15
Change-Id: I2124b0684a0847d6705344bb5850bac178a292b6
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
When you are editing in a QTextEdit and press enter to start a new line,
calling insertBlock() with no arguments tries to preserve the current
charFormat and blockFormat. That is often OK:
- if you hit enter at the end of a list item, you probably want another
item in the same list
- if you are writing code inside a code block, you're probably just
writing the next statement on the next line: stay in the same block
- margins, indents, tab positions should stay the same (but hopefully
your editor has UI to manually reset the block format to default
in case you are not continuing in the same style)
But there are some exceptions we can apply to be helpful:
- nobody ever wants to follow an <hr/> with another one (but
hopefully the application has an action to insert one manually)
- a heading is more likely to be followed by a paragraph, or perhaps
a smaller heading; another heading at the same level is unlikely.
We need to reset the char format, not only the block format, because
the large font and heavy font weight are stored there.
- when adding to a todo list, hitting enter at the end of the last task,
let's assume the next task is not yet done, so it will be unchecked
by default (else, why are you writing a todo list at all)
To achieve that, we need to customize the formats and call the
insertBlock() overload that takes them. The no-argument insertBlock()
will continue to preserve the formats, because it's an old API that is
used for much more than interactive editing.
Additionally, word processors tend to let you end a list (for example)
by hitting enter twice. In that case, you stay in the same paragraph
that you created the first time you hit enter, but now the formats are
reset to default, so that you can go on typing an ordinary paragraph,
rather than having to mouse up to the toolbar to select the paragraph
style in a combobox, or something like that. So we now do that: reset
both block and char formats after you hit enter on a blank line; but if
you then hit enter again, after the block format has been reset, then
you will get the actual blank line (empty block) inserted.
[ChangeLog][QtWidgets][QTextEdit] Hitting enter at the end of a line
with a special block format (horizontal rule, heading, checklist item)
now makes some "smart" adjustments to avoid retaining properties that
are unlikely to be continued on the next line. Hitting enter twice now
resets block and char formats to default.
Fixes: QTBUG-48815
Task-number: QTBUG-80473
Fixes: QTBUG-97459
Change-Id: I3dfdd5b4c0d9ffb4673acc861cb7b5c22291df25
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
When building a shared library (with qmake) in a user project
targeting Android, the library gets a QT_ARCH suffix added to its
name.
This suffix is not added when building a static library
(CONFIG += staticlib).
In the context of a multi-abi android qmake build, all the arch
specific static libraries would have the same name and would
override each other.
This happens with Qt 5.15 and it would also happen in Qt 6,
but we don't support multi-abi qmake builds in Qt 6 so far.
When the original fix to include the arch suffix for shared libraries
was done in Qt 5, d463a63bb9
it was likely an oversight that it was not applied to static
libraries as well.
The !static part of the condition was added in
72d4f0750b .
The change only handled installation responsibilities, not naming of
libraries.
Fix static libraries to include the arch suffix, but only in Qt 6.
It's too late to fix it in Qt 5, there might be projects that rely on
there not being a suffix in static library names. Adding the suffix
would suddenly cause linking errors.
Amends d463a63bb9
[ChangeLog][Android][qmake] Static libraries targeting Android will
now include an arch suffix when built using qmake.
Fixes: QTBUG-83165
Change-Id: I6f68dcb74cec30b4c8f0bc5a819d89843e9d695e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
If the certificate didn't change then our trust in it didn't either.
Sadly, cannot have an autotest because we don't have any way
to facilitate a renegotiation at the moment and with TLS 1.3
not having them at all it's unlikely we ever will.
Pick-to: 6.2 5.15
Task-number: QTBUG-92231
Change-Id: Ibaa9b2f627daca05021c574e69526710aacdadae
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
- there is no possibilities for running autotests on CI
Pick-to: 6.2
Change-Id: I15f0c600172ec4962edf3716a651483982c4f8c6
Reviewed-by: Toni Saario <toni.saario@qt.io>
Qt Android was using consecutive numbers starting from 1 as ids for View.setId(int). The ids are used internally with an assumption that they are unique. It was potentially leading to collisions and unexpected behavior when adding custom views with id generated by View.generateViewId().
Task-number: QTBUG-98649
Pick-to: 5.15 6.2
Change-Id: I5bf2fe1d196c7adafeec544d8d945ebd82ba5cb6
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Noticed while reviewing usage of this type. The code has a whole
TempStorage class to take care of keeping allocated memory live until
we're done with it, explicitly including date-time objects as a
special case, but neglected to use it in one place.
Pick-to: 6.2 5.15
Change-Id: Ic94c56d67dda6dc3ee36a025a2e0149f6b2a1837
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
We can now get qt_configure_strs to tell us the size of the string, as
well as its start, bypassing the strlen()-calling branch of
fromLocal8Bit() that caused the need for a hack using a volatile
variable. However, QT_CONFIGURE_SETTINGS_PATH still needs the volatile
hack.
Change-Id: I0181abf512123e6355acdd506d6845c3fb75c0e3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Apparently -Wdeprecated-copy got added between clang 9 and 11.
Versions without it warn about the attempt to suppress this option's
warnings.
This follows-up on commit 8662fbdd7e
Change-Id: I7fe9258cfe8a79d24c1f8b331a56468415b25cdb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Commit 6cee204d56 introduced overloads
of lastIndexOf() which drop the 'from' argument, inadvertently fixing
QTBUG-80694, but failed to provide the new overloads for all existing
lastIndexOf() overloads, making the fix for QTBUG-80694 incomplete.
This patch completes the fix, by adding the missing overloads (for
char-likes) and also adds the missing (non-regex) tests to
tst_qstringapisymmetry.
Also amends 1c164ec7f2.
Fixes: QTBUG-80694
Change-Id: Ib4b3d597d658ce2edf01a2bce0d711ecea593d6e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Handle the timing from drmEvent when page flip finished.
The information can be used to optimize rendering timing.
Change-Id: I14612ca48a8fea5208aa74949d7543787e860c5f
Reviewed-by: Elvis Lee <kwangwoong.lee@lge.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
cmake_automoc_parser has the logic preventing the run of moc with the
--collect-json parameter if metatype json files are not changed.
This logic only verify if the file list is changed but not their
content. This change adds a timestamp file that contains the last
metatype json file timestamp that was modified during the last
cmake_automoc_parser run. The logic still prevents of running
'moc --collect-json' when the list of metatype json files is not
changed, but also checks if their content is no changed.
Another approach it to generate the depfile that can be utilized by
CMake in add_custom_command as DEPFILE argument. But this concept only
works from the second build attempt because of an issue related to
dyndep.
Pick-to: 6.2
Fixes: QTBUG-98532
Change-Id: I713f8bfa9ae769cefe0beac0b7fa19750b00a765
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Encapsulate configuration options in a function and use it instead of
a globally defined variable.
Pick-to: 6.2
Change-Id: I5c69c207788fe069fdd046b68a6bc58aa16e71b4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>