The local position needs to be corrected when the Qt receiver window
does not correspond to the native event receiver window.
Fixes: QTBUG-97095
Pick-to: 6.2 5.15
Change-Id: Ic9fa3d84b6ee84ae5f8fa2408b0d60e35dbfa328
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
There's no need to dereference+reference a QList's iterator
only to pass the result to an algorithm, just pass the iterator.
Change-Id: I7367010f6ab489d951715259bd51aeec790d3c84
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Currently using nested Q_FOREACH loops produces warnings about
shadowing local variables (if enabled). For example, this code:
QList<int> aList;
QList<int> bList;
foreach (int a, aList) {
Q_UNUSED(a);
foreach (int b, bList)
Q_UNUSED(b);
}
produces the following warning with MSVC:
warning C4456: declaration of '_container_' hides previous local
declaration
This is due to using variable _container_ as loop variable for both
loops.
This patch appends current line number to the name of the loop
variables so that most of the uses of Q_FOREACH will not result
in shadowing.
The patch originally by Benoit Regrain.
Fixes: QTBUG-79081
Pick-to: 5.15 6.2
Change-Id: I55235e917e920171b138c8b3239a95dfe2ac7988
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It is unsupported with clang-cl and breaks the build.
This is a fixup for:
51e8d3592a Let QLocale::uiLanguages() use WinRT API when possible
Task-number: QTBUG-94341
Pick-to: 6.2
Change-Id: Icf32339e81d67d4c119b7fb8d8d834c744b9ead0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This was handled correctly when the backend supplies transitions
bracketing the time in question, but the fallback code tried to use
the DST offset at the time with larger offset from UTC; this did not
work when the gap was due to a change in standard time. Discovered by
ANS1 parsing of a date-time with two-digit year, for which the
date-time parser tried to use 1921-05-01T00:00 local time when filling
in the fields it had parsed; but, when run in Europe/Helsinki, there
is no such time due to the 20m 11s skipped when joining EET from the
prior local solar mean time.
Correct the calculation to use the actual change in offset from UTC,
as used in the (far better tested) between-transitions branch of the
code, rather than the DST offset after the transition.
Add a test-case based on the ASN.1 certificate date whose parsing
revealed the issue. Although it seems nothing in Coin can reproduce
the issue, the reporter has verified that the test does indeed fail on
the system where the bug was found and the fix does fix it.
Fixes: QTBUG-96861
Pick-to: 6.2
Change-Id: I12b02bad01daca2073d1a356452cd573684aa688
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When adding resources generated via a custom command, the project fails
to configure when targeting iOS with CMake and Xcode with the error:
CMake Error in src/CMakeLists.txt:
The custom command generating
src/.qsb/TestShader.frag.qsb
is attached to multiple targets:
TestApp_other_files
TestApp
but none of these is a common dependency of the other(s). This is
not allowed by the Xcode "new build system".
This happens e.g. when using qt6_add_shaders, which adds a custom
command to generate the qsb files. Or by simply adding resources via
qt6_add_resources, which depend on a custom command.
The problem is that qt6_add_resources also adds the resource to a
second "fake" target ${target}_other_files via
_qt_internal_process_resource and _qt_internal_expose_source_file_to_ide.
See c7d1874cd1.
Since these targets do not have a common dependency CMake fails to
configure the project.
So lets fix it similar to change 1bd0a5ce02352a600367beb5a5421c8f8332e1fe
and let the ${target}_other_files depend in the main ${target}.
Pick-to: 6.2
Task-number: QTBUG-95763
Change-Id: Iecdb40993a91da8bfbf6553892f9b0722d2e886c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When parsing CSS, a border-color value is parsed as four brushes, as css
allows assigning up to four values, one for each side.
When applying the CSS to the HTML, we accessed it as a color value,
which overwrote the parsed value with a QColor. So while we had a valid
parsed value (and didn't re-parse), the code accessing that value still
expected it to be a list, and thus failed to retrieve the data.
There are several ways to fix that, but the cleanest way without
introducing any performance penalty from repeatedly parsing (and in fact
removing a parse of the string into a color) is to enable colorValue to
interpret an already parsed value that is a list without overwriting the
parsed value again. To avoid similar issues in the future, add assert
that the parsed value has the right type in brushValues.
As a drive-by, speed things up further by making use of qMetaTypeId
being constexpr, which allows for it to be used in a switch statement.
Add a test case.
Fixes: QTBUG-96603
Pick-to: 6.2 5.15
Change-Id: Icdbff874daedc91bff497cd0cd1d99e4c713217c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Because of the addition of the operator T*(), the expression "it + N"
where N was not exactly qsizetype but any other integer type was a
compilation failure because of ambiguous overload resolution.
With GCC it's apparently a warning:
warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
note: candidate 1: ‘QList<T>::iterator QList<T>::iterator::operator+(qsizetype) const [with T = char; qsizetype = long long int]’
note: candidate 2: ‘operator+(char*, ptrdiff_t {aka long int})’ (built-in)
With Clang, it's an error:
error: use of overloaded operator '+' is ambiguous (with operand types 'QList<int>::const_iterator' and 'ptrdiff_t' (aka 'long'))
note: candidate function
inline const_iterator operator+(qsizetype j) const { return const_iterator(i+j); }
note: built-in candidate operator+(const int *, long)
Pick-to: 6.2
Fixes: QTBUG-96128
Change-Id: Ie72b0dd0fbe84d2caae0fffd16a06f23dd56b060
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
And don't set non-default large value in QNetworkRequest's constructor.
Some servers consider those values as 'flow control error'.
Pick-to: 6.2
Fixes: QTBUG-97384
Change-Id: I801b7c83fe7e7392a02ba653c36dfa8a22c21d1e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The macro takes only one parameter, sentences must be wrapped in {}.
Pick-to: 6.2
Fixes: QTBUG-97441
Change-Id: I7177548a32a67d720c2b551d16c09d898b0fda51
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
On macOS, it is possible to right-click-open a context menu for a window
that is not active. This does not activate the window.
When then clicking into the window to activate it, the popup is closed,
but only after the WindowActivate events has been sent. This blocks the
event delivery, as QApplication (since commit 78264f333e)
interpreted activation changes while popups are open to be just delayed
focus events. The UI ends up in a broken state where focus cannot be set
on the widgets in the window.
To fix this, don't ignore such activation events on macOS. As a drive-by,
give the variables more meaningful names.
Note: We cannot call closeAllPopups before delivering WindowActivate,
as that would close the popup before the mouse event is delivered, making
it impossible to select any of the actions from the menu.
Ideally, clicking into a popup of an otherwise inactive application would
not activate that application (that is the default behavior for native
macOS applications), but that's out of scope for this patch.
Fixes: QTBUG-78750
Task-number: QTBUG-69710
Task-number: QTBUG-66513
Pick-to: 6.2
Change-Id: I6344370ae7be31630e37514e04918b2d6cb8b69a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The documentation snippets name the result of dotProduct()
"lengthSquared", but it is just a coincidence, not the property of dot
product of two different points. Just name the result `dotProduct`
without claiming any properties.
Also fix the type of the result in the QPointF case.
Fixes: QTBUG-94979
Change-Id: I4c337dd8335953489eac86c07a219c0a2d232369
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
When using the Freetype font database, we would ignore the
typographical width of loaded fonts, which could make it
impossible to select certain fonts in a family.
[ChangeLog][Freetype] Fixed a bug where fonts of different
width within the same family would be unselectable if the
Freetype font database (no-fontconfig configuration) was in
use.
Pick-to: 5.15 6.2
Fixes: QTBUG-89640
Change-Id: Ic9c17a7c3cc14eb7e942b05d6b21b7c1602816cf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Retaining texture upload commands comes at a price, because it
means we also retain the backing storage, which could e.g. be
fullscreen buffers for applications on Wayland. These would
eventually be overwritten, but just clearing the array between
frames is also fine because the data is never reused and the
array is a QVarLengthArray anyway so it already has a lot of
reserved space.
Pick-to: 6.2
Change-Id: I7389487be67b671830787e30e1468c303b7ac5c2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
On low-end hardware without fast framebuffer clears one can
significantly reduce the fill rate by disabling framebuffer clears
(provided, as it's usually the case, that the application has content
filling the entire framebuffer).
Add a couple of environment variables to do so, one to disable all
clears and one to disable only color clears (in case the surface is
requested without a depth buffer). Note that disabling all clears
on a surface *with* a depth buffer still requires
QSG_NO_DEPTH_BUFFER to be set, otherwise QtQuick is going to assume
that there is a clean usable depth buffer.
Change-Id: I96ad0a3d28dd0ab65cc960fb7cb2e0a8b6f35628
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Accidentally broken in 4b899a29fa
Change-Id: I8ff52153c3549fcda4ebd178cc4fc1ea9538be86
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Elvis Lee <kwangwoong.lee@lge.com>
I forgot
Fixes: QTBUG-97409
Change-Id: I5ee94b2cc4c70b6408bb9bb9368c6876f3179783
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
- when there is no intersection between the current selection and the
spans collection, get ranges for all cells, just as if no span exists
- when there is an intersection between the current selection and the
spans collection, get separate ranges for each cell (as before)
This fixes the regular case of selecting multiple non-spanned cells
after some cells are merged (get a single range for all cells instead of
separate range for each cell). However, when selecting together a group
of spanned and non-spanned cells, you still get a separate range for
each cell. But this is normal behavior in similar applications; for
example in LibreOffice, you cannot select and merge spanned and
non-spanned cells: an error dialog tells you that it's not allowed.
Done-with: Christos Kokkinidis
Pick-to: 6.2
Fixes: QTBUG-255
Change-Id: Ic38f9a064a1f499825e7f750668013fc2dc564ba
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Add operators as hidden friends, add test case to make sure that
basic value-type operations are possible with this type.
Task-number: QTBUG-255
Change-Id: I7fbf453aa16084c0b2a0079487cacb4e092ff664
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Less clunky due to having better constexpr support, plus fold
expressions.
Change-Id: I3eb1bd30e0124f89a052fffd16a6bc73ba79ec19
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
It's not used anywhere. It's been a legacy since 5.0 anyway.
Pick-to: 6.2
Change-Id: I2bbf422288924c198645fffd16a9740444c7f13b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
They return a pointer to the actual header, skipping the magic string.
This is done in preparation for the header located in an ELF note, which
won't have the magic.
Change-Id: I3eb1bd30e0124f89a052fffd16a8229bec2ad588
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The .qtmetadata section is already suppressed for static plugins, but we
carried this unnecessary magic string. For library file formats where we
don't have a scanner (Windows COFF PE), a library that linked multiple
static plugins could end up with multiple metadata found.
We can't suppress the header because the version of moc could be
different to the version of Qt, so we need to read the header version
too. Right now, the version isn't output by moc (all the logic is in
qplugin.h), but this could change again in the future. In any case, 4
extra bytes are not a big deal, so the header stays.
Change-Id: I3eb1bd30e0124f89a052fffd16a82088d8303081
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Looks like it was copied from QUtf16::convertFromUnicode(), but for the
UTF-32 case that is not correct. UTF-16 to UTF-32 conversions can change
the length of the string due to surrogates.
There are unit test tests for creating and parsing UTF-32 headers, and
for detecting content as UTF-32, but there aren't any for UTF-32
conversions. I don't have time to add a full test for that.
Fixes: QTBUG-97122
Pick-to: 6.2 6.1
Change-Id: Ic17a33f599b844d8ab5dfffd16ab2c4cb6b0547d
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This allows Qt Quick Controls to detect if a dark theme is in use,
and if so, use a dark theme of the current style (if available).
Fixes: QTBUG-93955
Pick-to: 6.2
Change-Id: I15fc8a2271acf9ba27232359056d5a681d4cffca
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Leaving it set to 0 will cause mktime() to interpret other fields as
in standard time, potentially "correcting" them and tm_isdst to
represent the equivalent moment in daylight-saving time. Set it to -1
to tell mktime() to let the system work out whether the time is
standard or daylight-saving.
Change-Id: Id33d4cb0afdb14f236ca5ce04cf605610a30d712
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's available on MinGW, so not limited to MSVC; and the MinGW
localtime() and localtime_r() fail in some cases where it works.
Use the generic name rather than _localtime64_s(), since localtime_s()
now just calls it; and, in any case, we were assuming time_t is
__time64_t when calling it.
Change-Id: I316cc5b1a3e19cd6725555042dfaba3124a25a03
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QDialog overrides setVisible to set focus on the default push button, or
(if there is no such button), make the first autoDefault push button the
default button. QDialog also explicitly sends a FocusIn event to the
focus widget in the dialog.
All this should not be done if the dialog does not become active after
getting shown, which will be prevented if the WA_ShowWithoutActivating
attribute is set.
Add a test case.
Fixes: QTBUG-8857
Pick-to: 6.2
Change-Id: If47021a4721a280ba45e95b43d0424cdacd9b4ea
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The need for this union has disappeared at some point during refactoring
It does confuse MemorySanitizer, though, so it's good to remove it.
Change-Id: I5f5050adba302bf96db96d5f303d2a25630543ce
Fixes: QTBUG-97109
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For a widget that implements height-for-width, the vertical scrollbar
becoming visible might be just enough to make the scrollbar unnecessary.
In that situation, the scrollbar flips on and off continuously.
To avoid that situation, make the width of the widget smaller until the
height fits without scrollbar, up to the point where we have space for
the scrollbar anyway.
The calcuation here is assumed to be cheap, but depends on the
heightForWidth implementation in the widget. Running the while-loop a
few dozen times should have no performance impact during resizing
and laying out the scroll area contents.
Add a test that confirms that within a brief period of time we only get
the one hide-event we expect.
Done-with: Zou Ya <zouya@uniontech.com>
Fixes: QTBUG-92958
Pick-to: 6.2 5.15
Change-Id: I0faeb5f9b1a226aada958c18333d9c2ac8203dd1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Previously, when deciding where the actual data is, Frame was calling
padding() to test if offset is needed. A curious case with a DATA frame
containing compressed body and having 'PADDED' flag set with a padding
equal to ... 0, ended in a decompression error (and assert in 6.2 code).
Pick-to: 6.2 5.15
Fixes: QTBUG-97179
Change-Id: I9341a4d68510aa4c26f4972afdcd09a530d5a367
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
When setCurrentIndex is called by removeTab, the old current index
might no longer be valid. Only update the lastTab value of the new
current tab if the old current index is still valid.
As a drive-by, use the validIndex helper function.
Fixes: QTBUG-94352
Pick-to: 6.2
Change-Id: I945e2093a90a1fccbba86d32b1113f83fedd41de
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This simplifies the code. While at it, also expand default case
so changes in the QChar::Direction enum don't go unnoticed.
Change-Id: Id52140b0aaf7fd259c4b8079462811603eb3ff93
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
No need to reinevent the wheel. Also, use nanoseconds
now that we have the precision available.
Change-Id: I287d06198edc3f5bdf7f85bd5f3e235b1fea95a3
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Unify cancel and finish in QPromise destructor in a single call. This
saves us one extra mutex lock and atomic state change.
Task-number: QTBUG-84977
Change-Id: Iac06302c39a2863008b27325fcf6792d4f58c8ae
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Change-Id: I5d66a67a5c16a479f62b9f43cb769d5ee5f66b60
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Use '-G Ninja' instead of '-G"Ninja"'.
Pick-to: 6.2
Change-Id: I53a77ea3b2d1547bb516b3ab756f5ae0f24092b1
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
We prefer the shared cache path, because there is no reason to give up
benefitting from sharing the content between applications. If that path
is not QFileInfo().isWritable(), we fall back to the local cache path.
However, there are reportedly systems with security solutions such as
AppArmor where the writable check passes and yet attempting to create a
file still fails. Then there is no cache in effect, because nothing ever
gets written out.
Handle this better: if writing the file fails and we still use our first
choice, the global cache location, fall back to the secondary choice
(the app-local path) and try again.
Pick-to: 6.2 6.1 5.15
Fixes: QTBUG-96789
Change-Id: Ifea32e9af0cf85aa70f3069256ed3d6a7e2fbe90
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dalton Durst <dalton@ubports.com>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This was confusing for me, being unfamiliar with the API.
Pick-to: 6.2 5.15
Change-Id: I831c6d0aa30847e069a7c21c279f147a1b24e486
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Unfortunately we can't depend on the C++11, 14 or 17 Standard
Library, which is not properly and completely implemented
everywhere. All Library features above C++98 must be checked with
their corresponding __cpp_lib macro before use. This does not
apply to the C++17 Core Language.
qwaitcondition_p.h:144:20: error: 'mutex' in namespace 'std' does not name a type
144 | using mutex = std::mutex;
| ^~~~~
qwaitcondition_p.h:59:1: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
58 | #include <condition_variable>
+++ |+#include <mutex>
59 | #include <mutex>
qwaitcondition_p.h:145:33: error: 'condition_variable' in namespace 'std' does not name a type
145 | using condition_variable = std::condition_variable;
| ^~~~~~~~~~~~~~~~~~
qwaitcondition_p.h:59:1: note: 'std::condition_variable' is defined in header '<condition_variable>'; did you forget to '#include <condition_variable>'?
58 | #include <condition_variable>
+++ |+#include <condition_variable>
59 | #include <mutex>
Pick-to: 6.2
Change-Id: I2bbf422288924c198645fffd16a9249e5330136a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
On a mobile device, selecting text in a line edit brings up the text
action popup for select/copy/cut. In a spinbox where the user changes the
value using the buttons, this can be very irritating, without providing
any usability - the user is unlikely to start typing, at least not
without first transferring focus into the lineedit first to bring up the
keyboard.
This style hint allows styles to override the default behavior of
QAbstractSpinBox. Implement the customization for the Android style, and
add a test case for QSpinBox.
[ChangeLog][QtWidgets][QStyle] A new style hint, SH_SpinBox_SelectOnStep,
specifies whether pressing the up/down buttons or keys in a spinbox will
automatically select the text.
Fixes: QTBUG-93366
Change-Id: If06365a7c62087a2213145e13119f56544ac33b5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Moving the class out makes it easier to navigate the code
Change-Id: I8de67641512a7dbbf6446cdca9d8dea79a63c217
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
We were using the non-standard interface for PropertiesChanged, and
support for this was dropped in a Network Manager update earlier this
year[0].
Switch to using the standard interface.
[0] https://networkmanager.dev/blog/networkmanager-1-32/
Pick-to: 6.2
Change-Id: Ibdf2b635ae13a3150c4d2faa028c15c70c8af5ca
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
The first callback added for the android backend does not have the value
as a parameter which is something the other callbacks have. Change it so
it does.
And promote the lambda to a real function.
Change-Id: I06f10f7c79f33a5ea3154f2fc6d20d550cd7eca7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
It's part of the capabilities which we are already using. It also lets
us work around a pre-existing edge-case where, if you have a VPN enabled
and enable Airplane mode it will continue to tell you it is Online even
when it is not. This happens because VPN is reported as a transport and
when Airplane mode is enabled it may be left enabled as the _only_
transport.
At the same time clear the default filters (if any), and filter out
suspended connections. May not necessarily make any difference.
And add a comment for why we cannot use a technically more suitable
type of callback.
Task-number: QTBUG-91023
Change-Id: Ic26c4d4e8da139ec8606a0b1bf5fb7157bd0beaf
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The new public API returns and notifies changes to the currently active
transport medium for the application. And there's a new private API to
report it, with backends to follow.
Task-number: QTBUG-91023
Change-Id: I527985f9dabcd7bc4a32f36597e21bc4ab664c4e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
On macOS, when showing a window, we decide if it should be made
key and therefore active, if the app has no active modal session
or if the window's worksWhenModal returns true.
However, the window needs to be made key also when a modal window
is present, but not visible. Add this condition when checking if
the window needs to be made key.
This makes the behavior consistent with what happens when a modal
is minimized on macOS. The input focus is passed to the next window,
and the window appears active, even if it can not be interacted with.
Fixes: QTBUG-85574
Pick-to: 5.15 6.2
Change-Id: I204d4f912128f4a46840789fc2ee08e1b2716bfc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
In QDoubleSpinBoxPrivate::validateAndInterpret() some code still
assumed checking one entry in a QString is enough (it isn't - the
grouping separator may be a surrogate pair) and nothing considered the
case of an empty grouping separator (as can arise if the user sets
that in their system configuration, as a brute-force way to suppress
digit-grouping). Failure to consider this case failed an assertion on
dereferencing the first character of the separator.
Handle the case of empty separator and suppress tests that try to
match a separator, when there is no separator.
Pick-to: 6.2
Fixes: QTBUG-96734
Change-Id: I63d3205ef8656a2cd2c0d855a25e712ad66e2429
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
WM_GETDPISCALEDSIZE and WM_DPICHANGED.
Pick-to: 6.2
Change-Id: I0614b0f552e52fc77d026dbc7e8c13b05f7d0e9e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The event flow for programatic window geometry change
(e.g. from MoveWindow()) differs from user-interactive
geometry change: We still get WM_DPICHANGED, but this
event is not preceded by WM_GETDPISCALEDSIZE, so we don’t
get to override the window size.
However, Qt has already scaled the window size for the
new DPI in this case (the scaled size is provided to
QWindowsWindow::setGeometry()), so we can omit making
second native set-geometry call.
Pick-to: 6.2
Change-Id: Ia7d42d7fee49adf757e7fe75d77f1731405ad519
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
By handling WM_GETDPISCALEDSIZE we can keep QWindow’s
device independent size constant across DPI changes.
This is done by scaling QPlatformWindow’s native size
such that the change of scale factor and change of
QPlatformWindow size cancels out.
Qt now handles DPI change using two events:
WM_GETDPISCALEDSIZE: Compute the new size for the window.
WM_DPICHANGED: Apply the new DPI and window geometry.
The reason for this complication is that Windows retains
control over the window position during the DPI change,
in order to e.g. accurately track the cursor position
during a screen change.
The default WM_GETDPISCALEDSIZE implementation (provided
by Windows) scales the win32 window size linearly with
the DPI change. We want to use linear scaling as well,
however the win32 window size includes the margins, which
do not change linearly as the DPI changes.
Instead, scale the QPlatformWindow size, and then add
the new margins.
Pick-to: 6.2
Change-Id: I4f225be8fad56b1fa77e9e3cfd6538a206589d73
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
We want to have as little code in the QWindowsContext
event switch as possible.
Pick-to: 6.2
Change-Id: I04d578aae81c4ee804310a70bd87ee60b2890b6a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Closing a window with a native child results in the native child's
QWidgetWindow being closed. That explicitly calls setVisible(false)
on the child, which will still have the ExplicitShowHide attribute
set from the initial (explicit) show. Even though we then reset
the ExplicitShowHide, the WState_Hidden attribute will still be
set, so Qt considers the window to have been hidden, and not show
it again when the parent becomes visible.
Add a test case.
Fixes: QTBUG-96286
Fixes: QTBUG-79012
Fixes: QTBUG-71519
Change-Id: I482e6d5236c959d82ce66798176b259a3176972c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The only place where we use it, we swiftly cast it to QMetaObject*
anyway. Generating an object with virtual methods, only to then cast to
its non-virtual base type is dangerous. Also, if we are required to
return a QAbstractDynamicMetaObject from a method of
QDynamicMetaObjectData, we cannot implement QDynamicMetaObjectData
without also implementing QAbstractDynamicMetaObject. This indirectly
forces us to copy metaobjects around as we cannot wrap an existing
metaobject into a QDynamicMetaObjectData subclass.
Copying metaobjects around makes QMetaObject::inherits() unusable
because inherits() assumes identity is determined by identity of the
pointer.
Change-Id: Icbe697efa6fd66649eef3c91260c95cda62e3c90
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The static analyzer can't see that the QPointer not being null implies
that the QWidget pointer is still valid. Since we reset the widget
pointer to nullptr earlier on if the QPointer is null, just test for the
widget pointer instead.
Amends f6befd3e63 and fixes report
020fbdde70065e8de370537304d13d21.
Change-Id: I715764956a02b1300766a3cea2d427f840f1cec8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This reverts commit 7fd9ed3201.
While trimming the font name worked for cases with application fonts,
it actually introduced an assert for system fonts that ended with a
space, because enumerating these failed. So the original assumption
that all Windows APIs also trimmed the family name was wrong.
The original bug was that the font with the trailing space could
not be selected, but when using setFamilies(), it can. So there is
a perfectly fine way around the original bug when using a font that
has this problem. Therefore, no additional fix is needed for that.
[ChangeLog][Windows] Fixed an assert that happened when the system
had a font with a trailing or leading space in its name.
Pick-to: 5.15 6.1 6.2
Fixes: QTBUG-93885
Task-number: QTBUG-79140
Change-Id: I6d9df31a4f2c6555d38d51da374f69b6fb0f1ecb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Even if the code fails, the runtime will have a xdg-open binary
that supports the required API (portals in flatpak and userd launcher
in snap)
Task-number: QTBUG-83939
Change-Id: I8527cfe20411c535686b7171ff9ef285ab9e10aa
Reviewed-by: Jan Grulich <jgrulich@redhat.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This rewrite uses the actual structures supplied by the system's C
library, so it should be easier to read. It removes hardcoded constants
with little evident meaning in favor of sizeof() and the macros from
that header. It also removes advancing the data pointer in favor of
having absolute offsets.
The resulting implementation is stricter than the original, checking
more fields in the header. Because the QPluginLoader and QFactoryLoader
users may make decisions based on availability of plugins before
attempting to load them, it's better to be stricter here than to fail
later when trying to dlopen() them.
Debugging and testing are much improved. Instead of stored artifacts, I
added a routine to modify a valid plugin to make it invalid, given the
conditions we've found so far.
If you turn debugging on for this category, you'll see things like:
not-elf.fcqdMq.so : Not an ELF file (invalid signature)
wrong-word-size.QrnSAx.so : ELF 32-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
invalid-word-size.bOkXvp.so : Invalid ELF file (class 0), LSB (GNU/Linux)
unknown-word-size.ogYKeF.so : Invalid ELF file (class 66), LSB (GNU/Linux)
wrong-endian.owiElX.so : ELF 64-bit MSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
invalid-endian.FRxClR.so : ELF 64-bit invalid endianness (0) (GNU/Linux)
unknown-endian.FfvRrP.so : ELF 64-bit invalid endianness (65) (GNU/Linux)
elf-version-0.gPTdpQ.so : ELF 64-bit LSB (GNU/Linux), file version 0
elf-version-2.jlIUUg.so : ELF 64-bit LSB (GNU/Linux), file version 2
executable.LlXiFp.so : ELF 64-bit LSB (GNU/Linux), version 1, executable, x86-64
relocatable.UsOYuy.so : ELF 64-bit LSB (GNU/Linux), version 1, relocatable, x86-64
core-file.hqvNRz.so : ELF 64-bit LSB (GNU/Linux), version 1, core dump, x86-64
invalid-type.CIJgfS.so : ELF 64-bit LSB (GNU/Linux), version 1, unknown type 259, x86-64
wrong-arch.UcNmgz.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, AArch64
file-version-0.lZYuda.so : ELF 64-bit LSB (GNU/Linux), version 0, shared library or PIC executable, x86-64
file-version-2.ucfdwL.so : ELF 64-bit LSB (GNU/Linux), version 2, shared library or PIC executable, x86-64
no-sections.rSjsHh.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
no-sections.rSjsHh.so : contains 0 sections of 64 bytes at offset 0 ; section header string table (shstrtab) is entry 0
no-sections.rSjsHh.so : no section table present, not able to find Qt metadata
qtmetadata-executable.vrxcIf.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
qtmetadata-executable.vrxcIf.so : contains 42 sections of 64 bytes at offset 997256 ; section header string table (shstrtab) is entry 41
qtmetadata-executable.vrxcIf.so : shstrtab section is located at offset 996831 size 423
qtmetadata-executable.vrxcIf.so : section 0 name "" type NULL flags X offset 0x0 size 0x0
qtmetadata-executable.vrxcIf.so : section 1 name ".note.gnu.property" type NOTE flags AX offset 0x2a8 size 0x30
qtmetadata-executable.vrxcIf.so : section 2 name ".note.gnu.build-id" type NOTE flags AX offset 0x2d8 size 0x24
qtmetadata-executable.vrxcIf.so : section 3 name ".hash" type HASH flags AX offset 0x300 size 0x44c
qtmetadata-executable.vrxcIf.so : section 4 name ".gnu.hash" type 0x6ffffff6 flags AX offset 0x750 size 0x3b8
qtmetadata-executable.vrxcIf.so : section 5 name ".dynsym" type DYNSYM flags AX offset 0xb08 size 0xd50
qtmetadata-executable.vrxcIf.so : section 6 name ".dynstr" type STRTAB flags AX offset 0x1858 size 0x15d8
qtmetadata-executable.vrxcIf.so : section 7 name ".gnu.version" type 0x6fffffff flags AX offset 0x2e30 size 0x11c
qtmetadata-executable.vrxcIf.so : section 8 name ".gnu.version_r" type 0x6ffffffe flags AX offset 0x2f50 size 0xb0
qtmetadata-executable.vrxcIf.so : section 9 name ".rela.dyn" type RELA flags AX offset 0x3000 size 0x480
qtmetadata-executable.vrxcIf.so : section 10 name ".rela.plt" type RELA flags AX offset 0x3480 size 0x7e0
qtmetadata-executable.vrxcIf.so : section 11 name ".init" type PROGBITS flags AX offset 0x4000 size 0x1b
qtmetadata-executable.vrxcIf.so : section 12 name ".plt" type PROGBITS flags AX offset 0x4020 size 0x550
qtmetadata-executable.vrxcIf.so : section 13 name ".plt.got" type PROGBITS flags AX offset 0x4570 size 0x8
qtmetadata-executable.vrxcIf.so : section 14 name ".text" type PROGBITS flags AX offset 0x4580 size 0x110e
qtmetadata-executable.vrxcIf.so : section 15 name ".fini" type PROGBITS flags AX offset 0x5690 size 0xd
qtmetadata-executable.vrxcIf.so : section 16 name ".rodata" type PROGBITS flags AX offset 0x6000 size 0x473
qtmetadata-executable.vrxcIf.so : section 17 name ".qtversion" type PROGBITS flags AX offset 0x6478 size 0x10
qtmetadata-executable.vrxcIf.so : section 18 name ".qtmetadata" type PROGBITS flags AX offset 0x64a0 size 0x19b
qtmetadata-executable.vrxcIf.so : found .qtmetadata section
qtmetadata-writable.stzwrk.so : ELF 64-bit LSB (GNU/Linux), version 1, shared library or PIC executable, x86-64
Change-Id: I42eb903a916645db9900fffd16a4437af9728eea
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
OpenSSL v3 among other nice things brought some nasty crashes
(essentially, finally breaking what was already not so nice
in 1.x: see, e.g. ASN1_ITEM_free and ASN1_ITEM_ptr that we
have to use to free resources allocated by openssl). Let's,
at least, not use v3 from Qt built with 1.1.1 and vice
versa.
Pick-to: 6.2 5.15
Change-Id: If14a2a0ce2189a1b7967b7ab7248d11d0f2fc423
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Update the build.gradle for main Qt jar code, and add same files for
network and network information backend, so the code can be managed
from Android Studio.
This also adds .gitignore to ignore Android Studio build artefacts.
Pick-to: 6.2
Change-Id: Ic06e9d12708070fad112f17e58b8754608d184f3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
jcenter() is deprecated and will be shutdown by next year [1], thus
the replacement mavenCentral() could be used instead.
[1] https://blog.gradle.org/jcenter-shutdown
Pick-to: 6.2
Change-Id: Ic9d1c15d657f23712ee4c866d5c1a45706353429
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Add startOnReservedThread that specifically releases a reserved thread
and uses it atomically for a given task. This can make a positive
number of reserved threads work.
Change-Id: I4bd1dced24bb46fcb365f12cbc9c7905dc66cdf1
Reviewed-by: David Faure <david.faure@kdab.com>
This allows to create EGL context without involving Xlib.
This extension was created a year ago and is present in Mesa since 21.0
Change-Id: Id9bcbffe8c46cb00d9cc0a9a425c1706d1b52b28
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
After calling close(), the socket can enter 'Closing' state, in which
we try to write buffered data before disconnecting. As the device is
already closed, we must disable any pipe reader activity and clear the
read buffer.
Change-Id: I8994df32bf324325d54dd36cbe1a1ee3f08022d1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>