3a449bbb69 amended the code to remove
acquiring a lock when waking up a condition variable. It is fine to
not have a lock associated when waking a condition variable; what I
misunderstood was the scope of the lock, which (and this underlines
the importance of commenting _what exactly_ a lock protects, for
each and ever lock) protected both the buffer as well as the counter
of the buffer. This made my reasoning flawed: it is necessary to keep
the lock while notifying, otherwise the counterpart could verify the
condition isn't satisfied and wait (e.g. see numUsedBytes==0), missing
the wake from the other thread (which could arrive between the check and
the wait).
Amends the previous commit.
Change-Id: If7db2d045331f1b33b976fb6bf6aa9117c41678f
Pick-to: 5.15 6.2 6.4 6.5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Qt 6.5 will require emscripten 3.1.25. This is not the
most recent version (3.1.27 at the time of writing),
however .26 and .27 make changes to stack layout and size
which require further investigation.
Change-Id: Ibe285ef160d450d6b2c63a7fb71d3561b0032e37
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This API is undocumented, but by keeping unchanged makes
it easier to use from external projects.
openFile(): Copy the accept/filter list parsing function
from 6.4. It makes sense to implement this behind the
API, so that user code doesn't have to reimplement it.
saveFile(): Slightly more complicated; the new variant which
takes a QByteArray is better since the implementation can
then keep a reference to the data for as long as it needs,
without copying the data. Add the const char * variant to
keep existing code going for now.
Adjust the calling code in widgets.
Pick-to: 6.5
Change-Id: I1899ebffdb90e40429dcb10313ccc5334f20c34f
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
QGtk3Theme detects the appearance property by theme name: If the name
contains the keyword "dark", the theme is considered to be dark and
otherwise light.
This detection logic fails, when the GTK theme is dark without
containing the "dark" keyword, e.g. the dark theme "Adapta-Nokto".
While QGtk3Theme imports the right colors in that case, it wrongly
identifies a light theme.
This patch adapts the detection logic: If the theme name contains the
"dark" keyword, it is considered a dark theme without further checks.
If it doesn't, the current GTK3 theme's default background and
foreground colors will be read. If the foreground is lighter than the
background, the theme is considered dark. If the background is lighter
than the foreground, the theme is considered light. If both colors are
identical, the appearance will be Qt::Appearance::Unknown.
Task-number: QTBUG-93955
Pick-to: 6.5
Change-Id: I0e0f4870a1397b6a7918331a852284bb1c91199e
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
1) Do not attempt to take the first character of event.key when the
key is a dead key - this always returns D as in Dead
2) Do not attempt to immediately modify the pressed key with the dead
key as the dead key itself will be modified
Pick-to: 6.5
Fixes: QTBUG-109629
Change-Id: Ic66536b8b27df23c2f1c4ebf1c02e713990e62ef
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Implement a11y support by adding html elements (Checkbox, Radio Button,
TabView,Spinbox, ScrollBar, Slider, Event for Button) and events of
the appropriate type and/or with the appropriate ARIA attribute
behind the canvas.
Pick-to: 6.5
Change-Id: I52902eae2bd4ac7a125815e1d2dd3077211fc118
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Implement a11y support by adding html elements (Toolbar, Menu,
DialogBox) and events of the appropriate type and/or with the
appropriate ARIA attribute behind the canvas.
Pick-to: 6.5
Change-Id: If9c9fbff9a451b44e57de5d8834f4a78f33f41bc
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
We want to make support for screen readers available
incrementally to avoid destabilizing existing functionality.
Accomplish this by initially adding a single "enable
screen reader" button only. When pressed, this button
will remove itself and populate the page with the actual
accessibility elements.
Pick-to: 6.5
Change-Id: I65036d249c408d4dc1fa75e8c807d9b7300e4722
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Add accessibility (a11y) container QWasmWindow. This
container should underlap the canvas with identical
geometry but ordered below.
Pick-to: 6.5
Change-Id: I7b91e3e69e3b1afa1b03ef7f7b7336e48f1a1594
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
In a 'ninja qtdeclarative' build, the addCursor() function alone is
compiled 458x for a total of almost 10s cumulative compilation time.
This makes it one of the top-20 template instantiations in a Clang
-ftime-trace build.
The removeCursor() function doesn't show up quite as much, but
de-inline, too, while we're at it.
Pick-to: 6.5
Task-number: QTBUG-97601
Change-Id: I37b920a8b364861efab78f736d71642dc82d8982
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
They offer no value over the traits in the standard library (in fact,
they're implemented precisely in terms of those traits).
This commit is done in preparation for their removal.
Change-Id: I3fb67e03e1c476f6ac0b369dfbbcf46b291270c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The test function places a QSpinBox in a QHBoxLayout, which has a
QWidget parent. The spin box is expected to be shown with the widget.
While the widget is the layout's parent, the layout is not explicitly
set. That makes the test function flaky in some cases.
This patch adds QWidget::setLayout() to explicitly set the layout on
the widget.
Pick-to: 6.5 6.4 6.2
Change-Id: I3a1cc77c302c5ba96d3628d035139f9718dda9e5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
- port from QSharedPointer to std::shared_ptr (one instead of two
atomic ops per shared-pointer copy)
- port to std::make_shared (one instead of two memory allocations for
shared-pointer + payload creation)
Pick-to: 6.5
Change-Id: Idecef5732d181a63e6936f54204eeb7ecbdc4a0f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
The reason for having a link to a "user page" on cppreference was to
have in the same place the papers, feature-test macro and corrisponding
value. This information has now been updated in a "official" page so we
can just link to that one instead.
Change-Id: I42658a46c8c0d3b78e1c10c06c81fa4bc78af9aa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The logic for writing 0 and false to the keys and values
is off by one.
While we are at it, unify the naming between the two settings
that are possible to reduce (samples and sRGB).
Amends d64f776a9a
Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-109453
Change-Id: I97f3a3c7175bcb555c70967056ab2de45b077f48
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
The history of that one line of code is... interesting, to say the
least. `defaultConnection` was originally declared as `char *`, which
happened to work on older MSVC versions. Then it gained a workaround for
other platforms by conditionally marking it const, with a const_cast to
keep the code working on MSVC. Now it is unconditionally declared as a
const char *, but the const_cast is still there. Get rid of it.
Change-Id: Ibfb6728e05f15f540137c94f2d278bd5db988b63
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The QAndroidApplication::runOnAndroidMainThread() function creates a
task on QThreadPool::globalInstance() to wait for a timeout and cancel
the QFuture representing the task.
It does so by passing a lambda to QThreadPool::start(std::function)
that captures the future, a local variable, by reference. This is UB
when the lambda is ever executed, because the local stack variable's
lifetime will have ended.
To fix, simply capture the future by value, not by reference. Since
QFuture::cancel() is not const, we need to make the lambda mutable.
Fixes: QTBUG-109586
Pick-to: 6.5 6.4 6.2
Change-Id: Icacfb0dc76bcd3a145f90126f535e7c0f4b5ef6a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Nicer member names make the code using the type more readable. It also
allows to add other members later.
Pick-to: 6.5 6.4 6.2
Change-Id: I69f1f97673a8f1ad8eb73e4f1e5323eccf929413
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
The latter is in a module (QtConcurrent) that depends on QtCore. Don't
make QtCore depend on QtConcurrent...
The code doesn't use the QFuture returned from QtConcurrent::run(),
anyway, so QThreadPool::start(function<void()>) is more than an
adequate replacement.
Task-number: QTBUG-109586
Pick-to: 6.5 6.4 6.2
Change-Id: Id00a42525c3d7454a1fa2d4812de634dbbea1035
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
A waiting task on QThreadPool::globalInstance() will block the worker
thread that it was scheduled on, making it unavailable for productive
work. That's why one should only put CPU-bound tasks onto
QThreadPool::globalInstance(). When blocking nonetheless, use the
releaseThread()/reserveThread() trick to avoid deadlocks caused by the
pool running out of workers.
So, do that here.
Task-number: QTBUG-109586
Pick-to: 6.5 6.4 6.2
Change-Id: Ia2660c69e1f23b5df0c308576301aac6e05d4725
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Creating a QRunnable is expensive business, incl. setting up
QThreadPool::globalInstance() if it wasn't set up already, so don't do
it for a no-op task.
Somewhat mitigates, but doesn't fix, QTBUG-109586.
Task-number: QTBUG-109586
Pick-to: 6.5 6.4 6.2
Change-Id: If2043134414d68adc9188e5bb7650ca08046b4aa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
"f" is used a lot as the name of the argument to methods in this class,
so rename the member to something else.
Change-Id: Iddb0e1ba1f6a3e0adf5d1b8ff00a8f82a68f6738
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Not so much about performance as it is better readability, it's the same
file, we're just rereading its metadata from the filesystem.
Change-Id: Ia7ae35aea5fec67ead1fc8ead99586b3b0a14727
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
These are timestamps, so UTC is all we need. This is faster than getting
the times in the Local Time Zone just to compare them.
Change-Id: I5ceebafea12a7015dce9e3c00d1b35f8da2afb1d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Our previous assumption was that the right value was used if we ran into
an "access denied" error. That error only states that the function has
been called before though. The warning should be omitted if the right
value has been set before.
Pick-to: 6.5
Change-Id: I1379242f68e2f09bc6a25dd322fe3634622d8e8e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Use less \notes, more sections.
Change-Id: I4c94d67a66c906e0d3b6f55127fce85e974b9138
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
The fileTime() method and co. get the specified file time but always
converted it to LocalTime; in some cases, e.g. when sorting dir entries by
last modification time in QDir, or when comparing a timestamp of a file
against its last modification time, basically all that's needed is the last
modification time returned by the underlying stat call (in QFileSystemEngine),
which is msecs since the Epoch.
API docs changes coauthored with Kai Köhne.
QDir benchmark results follow in the next commit.
[ChangeLog][QtCore][QFileInfo] Overload file time related methods to
take QTimeZone argument; mainly useful if all you need is UTC time,
e.g. to compare file timestamps, this is inherently faster as no
conversions need to be performed.
Change-Id: If73a54e935fe272e34acbf083973c30b61510be8
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The existing symLinkTarget() always resolves the symlink target to an
absolute path; readSymLink() provides access to the relative path when
that is how the symlink references its target.
[ChangeLog][QtCore][QFileInfo] Added readSymLink() to read the symlink's
raw target, without resolving to an absolute path.
Fixes: QTBUG-96761
Change-Id: I360e55f1a3bdb00e2966229ea8de78cf29a29417
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Drop the use of \qtcmakepackage for the module page that results in
incorrect instructions, and replace it with a snippet with the correct
commands to use.
Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-109214
Change-Id: I936910ddb9e4118f931d85e4b096ad52006dcc32
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Use new case folding functions in the implementation of
QLatin1StringMatcher instead.
Task-number: QTBUG-100236
Change-Id: I853091d11070483ad2128b9de3c776f5ca8e7f45
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It is now not the screen that handles all of the events and relays
them to individual windows, but the window elements themselves.
This allows us to get rid of manual window targeting logic and let
the browser do its job.
Fixes: QTBUG-107217
Pick-to: 6.5
Change-Id: I4dc5a74b1343f027f72c1da4623b99cd28bfbb38
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Adding support to different authentication modes to Oracle DB.
Adjust the connection string parsing a little bit as a drive-by.
Change-Id: I24ed70ed5085f22ba58eff70caa685579d31c96f
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
testWhiteSpaceNames() returns true for all current database drivers so
it's useless and can be removed. safeDropView() and getPSQLVersion()
is not called anywhere, getMySqlVersion() is only used for a check for a
MySql version we no longer support.
Change-Id: I8d02f17f475821e81d309ee96897e772cdfb895d
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Move the documentation of the connection options to the SQL Drivers page
and try to add a small but useful documention to each option.
Fixes: QTBUG-109507
Change-Id: Id1d51d7a666ac0f15cde8d73bff153dad271d34b
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Cleanup an unused function in QSqlRecordPrivate and use member
initializers for the ctors in QSqlRecord/QSqlField
Change-Id: I7d585e70c83373b3092e9f1425233af42b8c379d
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Move the paragraphs dealing with encodeName()/decodeName() and Unix
special files to 'Platform Specific Issues'.
Pick-to: 6.5
Change-Id: I076191e041ef238556aab28b5ad5d51974f8f7ff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Make it explicit that the local 8 bit encoding is UTF-8 on all
platforms but Windows.
Pick-to: 6.5
Change-Id: Icaabfd28689a71ee5cc2957f058f9388405496d5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QTemporaryFile is derived from QFile, so it's not a reason why
QFileDevice should exist. Instead, mention QSaveFile.
Pick-to: 6.5
Change-Id: I1de3a32746a313ec57323f3f8ae42e326f11d147
Reviewed-by: David Faure <david.faure@kdab.com>
Refactor the getImage/Pixmap and getImageSize/PixmapSize functions into
templates. The functions were practically identical, and the
inconsistencies between them seem to be rather bugs or omissions than
intentional. E.g. maintaining the aspect ratio if width/height are not
specified was only implemented for the pixmap case.
Task-number: QTBUG-109212
Change-Id: Ic0de0a2d7f883c4efac97111e2c1e438f278d70d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
The qt_findAtNxFile helper in qicon.cpp expects a local file name that
can be probed with QFile::exists. If the src attribute of an <img>
element specifies the location of the image as a file:/ or qrc:/ url
rather than as a local file name, then we need to strip the scheme
off the file path, and in the case of a qrc URL leave the :/ prefix
before calling the qt_findAtNxFile helper.
Amends, and partially reverts, 760df72565.
We can't avoid testing whether the source in the HTML is provided as a
URL before interpreting it as a file name.
Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-109212
Change-Id: I7ea7a5bfde79bab90a8025c42e754129813dd0fc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The 413593183b patch changed the way
how the display metrics are retrieved. By doing so, it was found that
the previous way retrieved the scaledDensity always equal to density.
It is intentional for scaledDensity to be dependent on the font scale
chosen by the user. However, this change altered not only the font scale
but also the layout. This patch will make the layout dependent on the
density instead of the scaledDensity and normalize the way the display
metrics are retrieved among Android versions.
Currently, the fontScale is ignored, QTBUG-109566 will track future
developments.
Fixes: QTBUG-109026
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I6adacd17583cbe9bee368af35c50b780872ab222
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Variable unused causes compile error or warning, use Q_UNUSED to eliminate it.
Change-Id: I6efbc3150cef962fa45ccbbed0dc04794db3cbbe
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
The mutual ownership of chunkCompleted<->fileReader caused both not
to be freed, which resulted in a memory leak. Resolve this by
introducing the ChunkedFileReader class which owns itself until file
read is finished.
Also, resolve a similar issue in qwasmlocalfileaccess.
Fixes: QTBUG-109436
Pick-to: 6.5
Change-Id: Ieec4cde15a893fa6a2e21a62d3bb6637374c5364
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
QtBase didn't contain any checks for QT_RESTRICTED_CAST_FROM_ASCII, so
a recent addition to the QString::append/insert/prepend overload set
made calls with C string literal arguments ambiguous without the CI
noticing. We had a similar problem with QString::multiArg.
To increase test coverage, we now run tst_qstring two times:
- without any define
- with QT_RESTRICTED_CAST_FROM_ASCII (lots of changes necessary)
Most removals are expected, because they disable tests that check the
implicit conversions from QByteArray and const char*, but the
relational operators with QLatin1String objects might warrant fixing.
In some places, when the conversion wasn't the functionality under
test, replaced C string literals or QByteArrays with QLatin1String.
We should also test with QT_NO_CAST_FROM_ASCII, but that's even larger
surgery.
QString doesn't have a ctor from std::nullptr_t, so QString s =
nullptr; doesn't compile in C++17 mode, but does in C++20 mode, due to
the const char8_t* ctor.
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I0c5a31719a4b8dd585dd748e0ca0d99964866064
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The latter are locale-dependent, and while that doesn't produce wrong
results here¹, it means they need to be out-of-line, whereas
QtMiscUtils functions are inline constexpr.
¹ isdigit could give a false positive on non-US-ASCII-digits, I
suppose.
As a drive-by, rely on the QtMiscUtils::fromHex() returning a negative
value when a non-hex character was encountered, to avoid the extra
isxdigit() checks. This property is preserved through the bit
manipulations: ORing together negative values yields a negative number
iff either or both operands were negative (in two's complement, which
Qt requires). The caller also checks the array bounds before calling,
so the isxdigit() calls didn't act as an implicit bounds check
(returning false if they encounter '\0'), either.
Task-number: QTBUG-109235
Pick-to: 6.5
Change-Id: I4cd734468e223f1047a53afd264d077b28cb5f1d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>