Commit Graph

64050 Commits

Author SHA1 Message Date
Tor Arne Vestbø
c5d9e4a7a7 Teach QMessageDialogOptions about default and escape buttons
There's logic in QMessageBox to resolve the default and escape button
if not set by the user. And the user may of course override these.

We now propagate the resulting buttons via the dialog helper, and
pick them up in the macOS native dialog backend. The only common
information we have between the standard buttons and custom buttons
is the button identifier, which for standard buttons is the enum
value, and for custom buttons is an auto generated identifier.
The same identifier is used when reporting the clicked button
from the native dialog helper.

Fixes: QTBUG-118308
Pick-to: 6.6 6.5
Change-Id: I5ca45604b51f0bbf74e56134d7b55bb8911f3563
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-26 01:20:44 +02:00
Tor Arne Vestbø
d44413d526 Explicitly focus automatic default button in QDialogButtonBox inside dialog
QDialogButtonBox has logic to automatically resolve a default button,
in case one is not already set via QPushButton directly, or via e.g.
QMessageBox::setDefaultButton().

Unfortunately, this default button can in some cases be overridden by
the first button in the dialog button box. The reason this happens
is that the first button is the focus proxy of the button box, so
when the button box gains focus, it will transfer it to the first
button. And since QPushButtons inside a QDialog have their autoDefault
property set to true by default, this focus transfer will also reset
the default button to the focused button.

This arbitrarily happens for any role that happens to be earlier in
the QDialogButtonBox::ButtonLayout than the AcceptRole, and can be
very confusing for the user, so we try to avoid the situation by
explicitly setting the automatic default button as the focus
widget of the button box, unless one is set already.

This is also what QMessageBox::setDefaultButton() does internally.

The only case we're not covering is when the user sets a push button
as default via QPushButton::setDefault(), but we conservatively
assume that the user then also calls setFocus() on the button.

Pick-to: 6.5 6.6
Change-Id: Ibdac0a51ba9439321d4fd7a1dac1ed695e11d693
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-26 00:14:33 +02:00
Tor Arne Vestbø
b0ddca18d7 QMessageBox: Do last minute setup in setVisible instead of showEvent
The native message dialogs are shown in QMessageBox::setVisible,
instead of plumbed via e.g. QWidgetPrivate::show_sys (which is not
virtual). And we try to show the native dialog before we call the
base class QDialog::setVisible(), where we end up sending the show
event.

As the native dialogs might rely on the last minute setup of adding
an OK button or detecting the escape button, we need to do it in
setVisible instead.

We can not switch the order of showing the native dialogs after
calling the base class setVisible (and getting showEvent), as
we need to know whether the native dialog could be shown or not
to decide whether to show the fallback widget dialog.

The part from showEvent that added the detailsButton has been
removed, as we're already doing that in setDetailsText().

Pick-to: 6.5 6.6
Change-Id: I23f1d87d542d9dadfd71924f8119c22720f4b276
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-10-26 00:14:33 +02:00
Michael Weghorn
1b0e76f514 a11y atspi: Don't restrict top-level window to 2 a11y roles
So far, only accessible interfaces of roles QAccessible::Dialog
and QAccessible::Window were taken into account when trying to
find the top-level window in order to calculate the window-relative
coordinates relative to that one.

However, an app doesn't necessarily need to have any such widget/
window as it's top-level object, but can have any widget there.
Therefore, consider any a11y object that is a direct child of the
application's a11y object a top-level window as well.

For example, in the spinboxes example
(qtbase/examples/widgets/widgets/spinboxes/spinboxes), the top-level
widget is a QGroupBox, which has an accessible role of QAccessible::Client,
which maps to ATSPI_ROLE_FILLER for AT-SPI on Linux.

Since that's the top-level widget, window-relative coordinates
should be calculated relative to it.
(Without this change in place, screen coordinates would be
used for the window-relative coordinates as well, as found by
the script attached to QTBUG-106527.)

Also deduplicate a bit and just have a single loop instead
of the extra check on the interface itself at the beginning.

Fixes: QTBUG-106527
Pick-to: 6.6 6.5
Change-Id: I8d2a00bcc22c71d696e4f48233afddc80e93bc1b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-26 00:14:33 +02:00
Tor Arne Vestbø
78cb91c5ca macOS: Avoid adding modal session for window that's already added
Investigating QCocoaWindow::setVisible idempotence revealed that our
QCocoaEventDispatcherPrivate::beginModalSession() implementation would
happily add the same window multiple times, resulting in trying to
re-start a modal session for the same window when the window was
closed, confusing AppKit's logic for choosing the next key window
when a modal window is closed.

We now bail out if we detect this scenario, even if setVisible has
been fixed. Additional logging has also been added.

Pick-to: 6.6 6.5
Change-Id: I07418c12b421fb0b4ebf875050e32f56fdad6197
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-26 00:14:33 +02:00
Fredrik Ålund
00ed8d7822 Fix datatype mappings for the Mimer SQL QtSql plugin
Some of the datatype mappings for Mimer SQL are wrong and some are
missing. Also, fix the datatype documentation for Mimer SQL.

Fixes: QTBUG-111219
Pick-to: 6.6
Change-Id: Ic7edaaca9af9b3b480079b04b05c58ab22f34fa3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-25 23:01:56 +02:00
Marc Mutz
fbb1cc234b qmainindowlayout_p.h: make header guard match file name
Pick-to: 6.6 6.5
Change-Id: I922e54f93897ffd82931419afcbba4d148ca5e8d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-25 21:01:56 +00:00
Christian Ehrlicher
bd7c409b9c QCommonStyle: use addIconFiles() to avoid copy'n'paste
Use addIconFiles() instead repeating the addIcon() function with every
size to avoid copy'n'paste errors and make the whole stuff more
readable.

Task-number: QTBUG-118122
Change-Id: I71ab5ca0526024c6f96e20871018b4af43dac3bf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-25 21:01:58 +02:00
Thiago Macieira
2fefc8c63c QString/QByteArray: add lvalue and rvalue overloads of left/mid/right
The first/last/sliced API may be what we suggest users use, but the vast
majority of the installed codebase uses left/mid/right because they've
been available since time immemorial.

An additional benefit of this is to make left() and right() available as
inline methods.

Change-Id: Ifeb6206a9fa04424964bfffd1788383817ed906c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 12:01:58 -07:00
Thiago Macieira
1cce2cceff QString/QByteArray: make the sliced(pos) overload call the other sliced
Complements 00c1c04bd5.

Change-Id: I8f3ce163ccc5408cac39fffd178c543d594cf64f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-10-25 12:01:58 -07:00
Thiago Macieira
f4101f9953 QString/QBA: add lvalue and rvalue overloads to first/last/sliced/chopped
Those ought to have been the original implementation, when they were
added in commit 38096a3d70, for Qt 6.0.

Because these classes are exported, we need to provide the previous only
implementations for MSVC. All other compilers would provide inline or
emit local, out-of-line copies.

Change-Id: Ifeb6206a9fa04424964bfffd178836a2ae56157d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 12:01:58 -07:00
Thiago Macieira
2fd0996324 QArrayDataPointer: add an allocating constructor
It's by far the most common use, so having to call two things is just
cumbersome.

Change-Id: I79e700614d034281bf55fffd178f454c4e31929e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 12:01:58 -07:00
Anton Kudryavtsev
793cfec941 qtextengine: use const methods more
to avoid implicit detach

Change-Id: I2fd36fef138eee23c12d413dfec3232ad1fa01df
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 19:53:14 +03:00
Anton Kudryavtsev
621f7c8735 qtextengine: replace qlist with qvla
CoW is not required here

Change-Id: Ia0d55dd1e82a225e089ca50f0d3c72bfb52d44f4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 19:53:14 +03:00
Anton Kudryavtsev
1427aa6711 Tidy up qtextlayout
- remove unused variable
- port index-based loop to range-based for
- use const method more to avoid implicit detach

Change-Id: I223f6c221d0c6277e94efd2e7b7be0f8d8456c60
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 19:53:14 +03:00
Edward Welbourne
887e18990d tst_QLocale: base europeanTimeZone test on 2013, actually used in test
The test that needs this bool is using 2013, so test that year for a
match. (Africa/Tunis toyed with DST in 1990, the year used before, but
thought better of it.) In the process, move the initialization to the
member-initialization of the class and make the member const.

Change-Id: Ib87636cdb0b038fad0cdef9fbe49e96f7bf79d1f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 18:32:06 +02:00
Alexey Edelev
a3f1b8e4d9 Do not collect the Private module dependencies values in public variables
Qt ModuleConfig.cmake files set variables like <package>_INCLUDE_DIRS,
<package>_DEFINITIONS, etc., which can be used by user projects to
acquire the module related information. These variables also accumulate
information from Qt Module dependencies. Since we do not separate the
Private and regular modules in dependency list, the resulting variables
contain values from both. This change puts the information from Private
dependencies to the variables of Private module. The exception is
PRIVATE_INCLUDE_DIRS which will contain include directories from Private
dependencies for non-Private module too.

Fixes: QTBUG-118462
Change-Id: I51e6d63651ed1913005064c90f77eba219cf60ea
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-10-25 18:32:06 +02:00
Morten Sørvig
fde6bdfc5a wasm: add QIODevices for accessing JS data
BlobIoDevice: Supports reading data from a JS Blob,
which can be a File (on disk) or some other object
which can provide data. The native access functions
are async and using this class requires that asyncify
is available.

Uint8ArrayIODevice: Supports reading and writing to
a Uint8Array / ArrayBuffer. Similar to the existing
QByteArray::fromEcmaUint8Array() API, except that it
supports incremental accesss.

Change-Id: Ic5de3534ff75eb6c745287b73b15ccd92d74ac2c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-25 17:56:55 +02:00
Tor Arne Vestbø
cd3a409589 macOS: Include StandardButton::RestoreDefaults when adding native alert buttons
The loop was breaking one button too early.

Pick-to: 6.5 6.6
Change-Id: Ic5027a2e4e35fbd54bf25b310768fd3278d4874b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-25 17:56:54 +02:00
Tor Arne Vestbø
4a16e51bc3 macOS: Don't refuse key window for direct transient parent of modal window
As explain in detail in 1bde203605, AppKit
doesn't treat non-direct transient parents of a window modal window as
being blocked by that modal window, but Qt does. To align with Qt, we
worked around it by returning NO from canBecomeKeyWindow for windows
that were blocked by a modal window.

This however had an unintended side effect for native dialogs, due
to the way we hide these dialogs. When a native dialog is closed,
AppKit will look for another window to make key, and as part of that
it checks canBecomeKeyWindow. The problem is that the modal blocked
status has not been updated in QGuiApplicationPrivate at that point,
so we tell AppKit it can't make the transient parent key.

The modal blocked status is only updated once we hit QWidget::setVisible,
at which point dialogs like QMessageBox and QColorDialog has already
called setNativeDialogVisible(false) in its setVisible() override,
triggering the close logic described above.

To fix this properly we need to have the dialogs call the base class
first when hiding, and then setNativeDialogVisible(), and also have
the macOS native dialog helpers react to hide() by ordering out the
window in case it didn't work at an earlier point. This kind of
change is risky for Qt 6.5/6.6 however, so we opt for a simpler
solution for now.

By limiting the original workaround for non-direct transient parents
not being blocked to just those transient parents, and only for window
modal dialogs, we avoid the issue with failing to transfer key status.

Task-number: QTBUG-104905
Fixes: QTBUG-118320
Pick-to: 6.6 6.5
Change-Id: Iabbca0b74a7db4e9821a9b60730d01fbad1425db
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-25 17:56:54 +02:00
Tor Arne Vestbø
be268ae197 macOS: Make QCocoaWindow::setVisible idempotent
The implementation of QCocoaWindow::setVisible is not idempotent,
as for modal windows it calls beginSheet/endSheet or starts/ends modal
sessions, which will confuse the AppKit modal session stack.

Once a window has been shown QWindowPrivate::setVisible hides/masks this
issue, by returning early if the visibility has not changed, but during
first show QWindowPrivate::setVisible will update the QWindow state,
before creating the platform window. If the platform window then picks
up the QWindow's visible state during creation, it will result in one
QPlatformWindow::setVisible() call during creation, and another one
via QWindowPrivate::setVisible after the platform window has been
created.

To fix this we can check the existing NSView.hidden state and skip
the setVisible call if it's already up to date. But one complication
is that our QCocoaWindow::setVisible has different behaviors depending
on whether the window has been initialized yet or not, due to how
handleGeometryChange skips sending geometry changes for uninitialized
windows. So we need to also bail out if we're still initializing the
window. This is fine, as we know we'll get a follow up setVisible
call via QWindow, both when QWindow itself creates the platform window
as part of setVisible, as well as when the user does a two step create
and then show.

For good measure we throw in a recursion check as well, in case some
of the logic in QCocoaWindow::setVisible before we update NSView.hidden
recurses back into QCocoaWindow::setVisible.

Pick-to: 6.5 6.6
Change-Id: Ibdcf4859e58d6684aac4490126d35eb12fdd5943
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-25 17:56:54 +02:00
Volker Hilsheimer
342b37f388 Revert "QAtomic: remove the copy ctor and assignment operator"
This reverts commit 6a93ec2435.

Reason for revert: Breaks qtdeclarative build, submodules need
to be clean before we deprecate or remove APIs.

Change-Id: Id0726b9bfad6072065b380b44b6ff6dffda79e45
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-10-25 15:56:54 +00:00
Tor Arne Vestbø
1af821825a macOS: Fix tst_MacGui::nonModalOrder()
The test is testing whether the order of creating a child window
of a modal dialog and showing the parent dialog matters. But to
allow child windows of a modal dialog to become active that child
also needs to be a dialog. That's a limitation on macOS, where
only NSPanel subclasses can override worksWhenModal.

Fix the test, and rewrite it using more modern idioms, avoiding
the need for long waits in the test.

Pick-to: 6.6 6.5
Change-Id: Ifb640d0288a3c7ed37f2c61294e34cd96fba49ca
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-25 17:41:32 +02:00
Tor Arne Vestbø
7fb0c2bbf9 QMessageBox: Opt out of native dialog if standard buttons have menu
Amends 2d59f2e8ca, which only checked
this for custom buttons, but standard buttons can also be customized.

Pick-to: 6.5 6.6
Change-Id: Ie8bafcf5007a0b4789b2d0ee1ddbc660a952fee4
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-10-25 17:41:32 +02:00
André Klitzing
fd9c567156 Use SSL_CTX_set_dh_auto if DHparam is empty
[ChangeLog][QtNetwork][QSslDiffieHellmanParameters] An empty
Diffie-Hellmann parameter enables auto selection of openssl
backend.

Fixes: QTBUG-117666
Change-Id: Ic2e0529d48542752ca801bcb4d609988e5ddff25
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-25 17:23:13 +02:00
Volker Hilsheimer
5628600a07 Revert "QWeakPointer: deprecate its relational operators"
This reverts commit bb23a05905.

Reason for revert: this change resulted in a flood of build-breaking
warnings in submodules that need to be cleaned up before we try again.
Also, the discussion following this change shows that this needs more
clarification of the implications and options. Until that is concluded,
the status quo is acceptable.

Change-Id: Id8f67ed585517935c31e29d48099b1c84b787b74
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-10-25 11:24:24 +00:00
Huang Rui
993db5a122 forkfd_linux: change childStack size from 4096 to SIGSTKSZ
Starting from qt-6.6.0, the childStack size has been too small to run
qmake or qsb in the sandbox, which will cause segfault.
This problem can be fixed by changing the childStack size to SIGSTKSZ.
For security reasons, some Linux distributions, such as gentoo, will
use the sandbox when building applications. Previously, qt-6.5.0 could
be successfully built in the sandbox. The problem started with qt-6.6.0.
See also: https://bugs.gentoo.org/915695

Pick-to: 6.6
Change-Id: I229c25397f557dd2fec3e0ec53ac68fda28bab13
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-25 14:15:56 +08:00
Zhao Yuhang
fd300f143f Win: minor improvement of the console debug trick
If the application has already attached to the console, the
AttachConsole() API will fail but we can still redirect our
output to the console. The previous code doesn't take this
case into consideration, now it's covered by this patch.

Please refer to the "Remarks" section:
https://learn.microsoft.com/en-us/windows/console/attachconsole

Pick-to: 6.6
Change-Id: I1c5033cc962dcd5a757ff15cc677a51e21330e0b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-25 04:15:19 +00:00
Giuseppe D'Angelo
6a93ec2435 QAtomic: remove the copy ctor and assignment operator
These special member functions have no purpose.

We never *documented* their semantics. Any code using them is
unconditionally wrong (which semantics was it assuming?), so we can
accept the SIC (type A). If a user needs such a copy, they would have to
reason on the intended semantics (relaxed? acquire/release?) and be
explicit in their code. Especially for assignment, they would need
understand the consequences of the memory ordering that apply on _each_
atomic object involved and not on the assignment operation as a whole
(there are no such semantics).

Testing this change on qtbase has already found bugs.

From a purely technical point of view: we don't guarantee lock-free
atomics nor we require them from the underlying platform. An atomic is
therefore allowed to be implemented as a mutex protecting a value, and
mutexes are not copiable. std::atomic follows the exactly same pattern
(not copiable nor copy-assignable) for exactly the same reasons, and Qt
atomics are implemented on top of std:: ones.

[ChangeLog][QtCore] The copy constructor and assignment operators of
Qt atomic classes (QAtomicInteger, QAtomicPointer) have been removed.
Their usage in user code should be considered a programming error, as no
memory ordering semantics were ever documented for these operations (and
therefore relying on any specific semantic would be relying on
undocumented, unportable behavior). This matches the API of the
std::atomic class in C++. Note that you can still use explicit
load/store operations to transfer a value across two Qt atomic objects,
and therefore use the memory ordering specified for the load/store
operations.

Change-Id: Iab653bad761afb8b3e3b6a967ece7b28713aa944
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-25 04:47:47 +02:00
Ahmad Samir
6f9271ce7c QStaticLatin1StringMatcher: touch up API docs
- Fix method name, it starts with a small letter
- Improve grammar in one sentence
- Use "INTEGRITY", less ambiguous and that's how their web site spells
  it

Change-Id: Icfca9d7ebe64cd2f012456507ebf65c1e62f9e9d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-25 04:14:35 +03:00
Ahmad Samir
e1dcc858b2 QStringList: improve benchmark code
Make the strings in the stringlist-to-be-joined unique, which matches
actual use-cases better than joining a list of identical strings,
especially with QString's implicit sharing, if it's copies of the same
QString, it's sharing the underlying data.

Pick-to: 6.6 6.5 6.2 5.15
Task-number: QTBUG-116859
Change-Id: I1da93885e938045322ba8337df5e4e96985f892f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-25 03:19:20 +03:00
Tasuku Suzuki
a86fda6423 Fix build with -no-feature-library
Change-Id: Ief76068a37d32759666e3aa2a24f126f18eca88b
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-10-25 08:37:23 +09:00
Tor Arne Vestbø
ea0b99c006 macOS: Explicitly mark NSView as needing display when unhiding it
AppKit doesn't do this automatically for us, and since we may have
decided to not draw anything when the view was not exposed, we need
to inform clients that its time to draw something now.

Pick-to: 6.5 6.6
Change-Id: Ib2dd969632898ba5640d6848356acd1b97da652d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
2023-10-24 23:56:43 +02:00
Tor Arne Vestbø
1fd1ffd03d standarddialogs: Don't assume QMessageBox::exec() returns clicked role
When adding custom buttons to a QMessageBox the return value of exec()
as well as result() is not a StandardButton value, but instead an opaque
value, and the documentation says to use clickedButton() to determine
which button was clicked.

Pick-to: 6.6 6.5
Change-Id: Ib47a218989b4dcb5d51f648bc55bc02399bae602
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-10-24 22:30:03 +02:00
Mårten Nordheim
13fbedd162 QStringConverter[win]: expose+test control of code-page
Then we can easily test how fromLocal8Bit() and toLocal8Bit() behave
with different code-pages.

Pick-to: 6.6 6.5
Task-number: QTBUG-118318
Task-number: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: Ib1cd3bccd27d598f4c80915557e332befcd96354
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-24 22:30:03 +02:00
Amir Masoud Abdol
66b7cb2a88 Suppress "duplicate libraries" warning for Xcode 15
A bug in Xcode 15 adds duplicate flags to the linker. In addition, the
`-warn_duplicate_libraries` is now enabled by default which may result
in several 'duplicate libraries warning', and build failure if
`-Wl,-fatal_warnings` is passed. By adding the newly introduced
flag, `-no_warn_duplicate_libraries`, to the linker we can suppress the
warnings, and possible fatal error caused by this bug.

Change-Id: I65e06ea039a6e98b02ed1f9112c622ecc6a142b5
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-24 22:10:43 +02:00
Timur Pocheptsov
2d59f2e8ca QMessageBox: Fall back to non-native dialog if button has menu
There's no plumbing in QMessageDialogOptions for supporting
native dialog buttons with menus, and even if there was such
plumbing, we don't know if our native dialogs could support
them.

As a workaround, detect the situation and automatically fall
back to the non-native dialog, so the user doesn't need to
set Qt::AA_DontUseNativeDialogs explicitly.

Fixes: QTBUG-118419
Change-Id: Iece7012909261b8869ce0ca23e45e8daaf4babc7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-24 22:10:43 +02:00
Bartlomiej Moskal
9c8651478b Android: Fix for hiding cursor handles
After c80f262258 commit (which fixed
selection for read-only texts), checking if m_handleMode is Hidden was
removed. Because of that hidding cursor handle stopped work correctly.

This commit brings back check if m_handleMode is Hidden.

Also when only one handle is visible, it should be hidden within the
next 5 seconds regardless for keyboard visibility. That is how it is
handled in pure Android apps.

Pick-to: 6.6 6.5
Fixes: QTBUG-117367
Change-Id: I0400f9604234bfad7fe17d74673ae9a93088bab4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2023-10-24 17:52:06 +00:00
Alexey Edelev
e5c7bb62ee Fix the dependency list naming when collecting repo dependencies
The 'dependencies.yaml' file contains entries that aligned with the
repository naming but not the Qt projects naming. When parsing
it to collect the dependencies for the standalone repo we should
cut the 'tqtc-' repo prefix to avoid malformed names in
QT_REPO_DEPENDENCIES variable.

Pick-to: 6.5 6.6
Change-Id: If80e61394f245f09b620a9210246053d4e475f86
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-10-24 17:18:12 +00:00
Thiago Macieira
a61d752951 tst_QHashFunctions: suppress warning about casting from float to _Float16
Amends c86cf385d6.

tst_qhashfunctions.cpp:109:59: warning: converting to ‘qfloat16::NativeType’ {aka ‘_Float16’} from ‘float’ with greater conversion rank

Pick-to: 6.6 6.5
Change-Id: I79e700614d034281bf55fffd178f91775966658f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-24 08:44:36 -07:00
Ahmad Samir
ceee7acf43 qcore_unix: port qt_safe_poll to QDeadlineTimer
Remove qt_poll_msecs() since the "forever" state can be simply expressed
with a QDeadlineTimer::Forever arg, instead of passing a nullptr
timespec, and the negative timeouts treated as "run forever" is also
encapsulated by QDealineTimer.

Use the QDealineTimer(qint64) constructor in the call sites where
the timeout could be negative, so that it creates a Forever timer (the
QDeadlineTimer(chrono::duration) constructor uses
setRemainingTime(duration) which handles negative timeouts by creating
expired timers).

Remove qt_gettime() (and do_gettime()).

Drive-by changes:
- Fix a narrowing conversion warning, qt_make_pollfd() takes an int
- Remove an unused include

Change-Id: I096319af5e191e28c3d39295fb1aafe9d69841e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-24 18:29:45 +03:00
Thiago Macieira
df2e07549e QLogging: disable the message pattern functionality for bootstrap
We only have two tools that use the Bootstrap lib and neither of them
need nor want the message pattern functionality.

Change-Id: Ifa1111900d6945ea8e05fffd177e191ebb6afc4f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-24 04:04:19 -07:00
Thiago Macieira
36805fc3c4 QLogging: call a non-exported message-formatting function
Instead of the exported qFormatLogMessage() that users can use. Because
it's a local symbol (static function), neither dladdr() nor
backtrace_symbols() functions should be able to see them, making their
exclusion from the list a simpler check.

This doesn't apply when the user calls qFormatLogMessage() in their own
handler, unless the compiler either inlines or tail-calls the new,
internal function. The latter case is very likely.

Change-Id: Ifa1111900d6945ea8e05fffd177e187f55512725
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-10-24 04:04:19 -07:00
Thiago Macieira
232f4f14be QMessagePattern: use the system message sinks for parsing errors
Instead of only printing to stderr or the Windows debug buffer. I guess
this wasn't done before because the code could recurse back and cause
stack overflows. We can do it now without recursion problems.

Change-Id: Ifa1111900d6945ea8e05fffd177e14e2f86ae482
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-10-24 04:04:19 -07:00
Thiago Macieira
e85c64bb6d QLogging: use stderr_message_handler() if we fail to grab the handler
Instead of duplicating its stderr handling.

Change-Id: Ifa1111900d6945ea8e05fffd177e149dfa9afff9
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2023-10-24 04:04:19 -07:00
Thiago Macieira
d614067ea0 QLogging: deduplicate the calls to qFormatLogMessage()
Lift it up from inside of each of the message sinks and instead perform
the formatting in qDefaultMessageHandler(). This necessitated having a
trait indicating whether the sink takes formatted output or not
(currently, only the Apple backend is unformatted).

Change-Id: Ifa1111900d6945ea8e05fffd177e155db9a599cc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-24 04:04:19 -07:00
Thiago Macieira
039ea9b40f QLogging: simplify qDefaultMessageHandler() with a global constant
Namely, a function pointer to the actual sink function.

This doesn't remove the future ability to iterate over multiple sinks,
but I removed the comment anyway because it doesn't look like we'll ever
implement that.

Change-Id: Ifa1111900d6945ea8e05fffd177de7fa46230259
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2023-10-24 04:04:19 -07:00
Kai Uwe Broulik
a668ed44dc QtDBus: Use explicitly meta type name instead of method type
In Qt 6, QMetaType sees the underlying type the compiler knows,
so a "using VariantMapMap = QMap<QString, QVariantMap>" typedef
will fail to match a signature of VariantMapMap to QMap<...>
because qDBusParametersForMethod looks for the method type name
whose QMetaType::fromName lookup will fail later.

Pick-to: 6.6 6.5
Change-Id: I142dc42ca86aa8a96f73424ec5da5780f2c1e6a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-23 21:58:23 +02:00
Amir Masoud Abdol
d7d144b530 Revert "Make sure that pkgconf can find HarfBuzz"
This reverts commit 885d87488a.

Reason for revert: Issue was caused by a faulty `.pc` file which was reported to upstream, in addition, the patch might not be effective in certain cases as tested by the reporter. See the bug report for further information.

Change-Id: I2b75a79f47b77a660bd23cd41df40df9ea4baef2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-10-23 19:41:20 +00:00
Tor Arne Vestbø
92194ac571 Unify QDialog WA_WState_ExplicitShowHide handling
Instead of checking it inside QDialogPrivate::setVisible and its
overrides, we can check it in QDialog::setVisible, up front.

The logic in QDialogPrivate::setVisible related to modality that
was executed prior to the WA_WState_ExplicitShowHide is now skipped
in the case the WA_WState_ExplicitShowHide condition hits, but this
makes sense as the modality logic has a second part at the end
of the function, restoring the modality, and this part was never
executed as the code was prior to this change.

Change-Id: I9580e91dbc5a981c83538d765b86138afee44f14
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-10-23 19:42:46 +02:00