QTabBar lays out the tabs when the bar's size or content changes,
often lazily. This should not change the scroll offset of the tabbar,
which is controlled by the user, or at most when a tab needs to be made
visible (e.g. when it becomes the current tab).
Move the logic of updating the scoll offset into the makeVisible
function, so that the scroll is only adjusted to either leave no gap
between the last tab and the right edge of the widget of there is still
a scroll; or to reset it to 0 if there is enough space for the entire
tab bar. Since layoutTabs does show and hide the scroll buttons, we
cannot skip this when the buttons are invisible. However, the
normalizedScrollRect helper now needs to return the entire widget rect
if there are no visible scroll buttons.
Add a test case that simulates the previously broken behavior where
the scroll got unnecessarily reset to 0 when resizing.
Fixes: QTBUG-113140
Pick-to: 6.5
Change-Id: Ic19fbb82821ea09cc5e7646dcbce3aa7607909c2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit introduces fine-grained Bluetooth permissions control to
the QBluetoothPermission class.
For now the fine-tuning of the permissions is only supported on
Android. On Apple enabling any of the permissions is equivalent to
requesting full Bluetooth control.
Task-number: QTBUG-109964
Change-Id: Ie7ac6577cf6a21419b73b33f8cf7e87bc3f8cf43
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The crash is caused by the cleanup sending trace messages when the
plugin has already been destroyed. Add shutdown callback to the plugin
to indicate this has happened. We can't use signals since that also
generetes trace event.
Pick-to: 6.5
Change-Id: I2e490fc51c2aaa97c240c1496a528a6ff6077bd0
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Add common prologue and add error message when tracing is used in a
module that doesn't have Q_TRACEPOINT enabled, but tracing is enabled.
Pick-to: 6.5
Change-Id: I64ca074942f6e89b4f5b5e3b6048b2b713c06df8
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
This patch implements a public getter for the hasStandalone attribute.
It returns true, if standalone has been explicitly declared in an XML
header and false otherwise.
As this is no longer necessary it removes accessing QXmlStreamPrivate
from QDomParser.
[ChangeLog][QtCore][QXmlStreamReader] added hasStandaloneDeclaration()
Change-Id: Iaaa0a728a6f7186e40637186077f7b49c112f7a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
These classes depend only on Core, not Gui.
This allows dropping the dependency of tst_qxmlstream and tst_qzip on
QtGui, and prevents a tst_qxmlstream FTBFS when building with
QT_NO_TEXTODFWRITER.
Symbols move from QtGui to QtCore, but the classes are private API, so
not under BC constraints.
The classes are not used outside qtbase, so no other in-tree users
need porting.
Task-number: QTBUG-3897
Change-Id: Ifa148f43ec139d7f9ac1f3893e2fcf4640e3c60c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Just call itself after copying the buffer, thus avoiding instantiating
insert_helper() for QVarLengthArray.
The other two cases of QtPrivate::q_points_into_range + QVLA in
qstring.cpp are not worth changing.
Change-Id: I9671dee8ceb64aa9b9cafffd1742fa7bb4cbebd8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The expected states are:
- nothing sets theMainThread before main()
- theMainThread is reset when the last QObject (the QCoreApplication in
the test) is destroyed
The GUI version of this test appears to leak a lot of QObjects. By the
time this function runs, theMainThread's QThreadData still has a
refcount of 66 on Linux/XCB. The Windows non-GUI version also
failed. Neither situation was investigated to see why objects are
getting leaked.
Pick-to: 6.5
Change-Id: Idd5e1bb52be047d7b4fffffd17507d9e6ef08743
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
MSVC binaries can also be stripped and according to my
experiments they still work normally. So we should not
limit this check to MinGW only.
Change-Id: I026d75a38b94f309ad695cf8f700ed3ac160dd87
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
For our purposes, the sem_t code is better, so we've preferred it since
commit c7ab816af1 (5.7). Olivier wrote in
that commit's message, "It makes tst_QMutex::contendedQMutex with no
msleep 8 times faster".
That's true because QMutex didn't lock the underlying pthread_mutex_t in
QMutex::lock(), as we used the inlined atomic code for the uncontended
case.
It is probably possible to merge the qmutex_mac.cpp and qmutex_unix.cpp
code now (both are based on semaphores), but I won't do that for two
reasons:
1) At best, the PThread functions are going to be thin-wrappers around
the code we already have, like FreeBSD's are around usem (see [1])
2) Darwin has a private API that resembles futexes so we may want to
go that way eventually (see [2])
[1] https://github.com/freebsd/freebsd-src/blob/main/lib/libc/gen/sem_new.c
[2] https://codereview.qt-project.org/335849
Change-Id: Idd5e1bb52be047d7b4fffffd175369b13ba47bed
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Instead of having one member signaling !openssl
let's just add booleans for openssl, schannel and securetransport.
The latter two of which are not currently used but may be in the future.
As a drive-by, make a compile-time check into a runtime one.
Change-Id: Id2f51f5396383a3f5836ac708996bfce8ae35c91
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Populate a subset of the font families at startup if the local fonts
access API is supported, and the access permission has been given.
Since this code runs at app startup there is no opportunity to request
font access. That should be done in response to user action, for
example by having a "load local fonts" button in the application.
Pick-to: 6.5
Change-Id: Ib6826deeec06ee3def0e793dd1462977710462be
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
lttng ctf_array does not support float types which
causes compilation error when a float type is passed
to the function. A solution is to pass the array
elements one by one to TP_FIELDS.
Fixes: QTBUG-112761
Pick-to: 6.5
Change-Id: I30e7049d9eda1141298145897df372213145c1b4
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Start tracking the window geometry before a mouse drag, so that we can
revert back to that geometry when we restore from maximised. Previously,
when dragging from maximised to maximised, the restore geometry would
end up being the final drag place before snapping to maximised, instead
of where the window was before the first maximised.
Fixes: QTBUG-112814
Pick-to: 6.5 6.2
Change-Id: Ic2ddf29d6c4abdc9e8b0c5161b17aa6ee9474ea3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
We should be able to just pass `0L` and avoid defining a None macro.
Pick-to: 6.5
Change-Id: I513d726120454523627a1e66515a5a533c0238b1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This fixes the assert raised on overwriting event handlers
Fixes: QTBUG-113041
Change-Id: Ie2afe09f4111ea542297b82a51382f1eb04ec960
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
This reverts commit e0cec08480.
Reason for revert: this can't possibly be the correct solution. It
set properties in headers (not .cpp sources) and headers can't cause
a build issue because they aren't built. Moreover, the problems
were seen in another module, so the properties set in those files
shouldn't even be visible to CMake.
Change-Id: I8473bb819e768bd203f89034d18132186da0371c
Pick-to: 6.5
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
wasm heap uses a shared array buffer, which cannot be fed to
FileSystemWritableFileStream.write due to security limitations.
Heap memory has to be copied to a temporary buffer for the operation to
succeed.
This is only done if __EMSCRIPTEN_SHARED_MEMORY__ is on to optimize the
non-threading path.
Fixes: QTBUG-112881
Pick-to: 6.5
Change-Id: I0d117a8703caf4c17abc67b30df5248a53406d5f
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Old examples inherited from Qt 4 tend to set some state, such as
enabling the depth test or culling, in initializeGL(). Newer examples
tend not to do this; they rather set the necessary state in paintGL().
This mattered little (or not at all) in the past, but with WebAssembly
and WebGL there are limitations in the GL context management in the
wasm platform plugin. Under certain conditions, esp. when
QOffscreenSurface is involved, it looks like the same native context
gets reused, which means there is a chance of unexpected changes to
the current state between calls to initializeGL() and paintGL(). (and
also between paintGL() calls) See QWasmOpenGLContext for details.
Update the textures example the same way we did for the cube one.
Add a note to the QOpenGLWidget docs about this problem.
Task-number: QTBUG-111304
Pick-to: 6.5 6.4
Change-Id: I29d2b2cdeb07bcecc5dc915d79c12b4323ca9ab3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Inho Lee <inho.lee@qt.io>
- qt_finalize_target missed a reference to qt_add_plugin()
- qt_generate_deploy_app_script is also supported on Linux
- Use simplers examples for QT_DEPLOY_SUPPORT and
qt_standard_project_setup()
Task-number: QTBUG-113116
Pick-to: 6.5
Change-Id: If6bfd01b9615a73ab1bafddee350e49f6902a6c0
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Make a manual call to the geometry change handling function after a
WM_DPICHANGED event if the window is frameless, since WM_SIZE and
WM_MOVE will not be called.
Fixes: QTBUG-109429
Pick-to: 6.5
Change-Id: I79b9f386fe120ee3d06d6490d3f31a7a5d7121b0
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
QtXml is only DOM and SAX, not QXmlStreamReader/Writer (those are in
QtCore).
Pick-to: 6.5 6.2
Change-Id: I8454d7db90303d347d5b4be94c9f21401d1e273f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
The \include command includes the source in its entirety when the
second parameter is omitted. This pulled in also the license header
which was visible in the generated documentation.
Add snippet tags and use them to extract only the content we need.
Pick-to: 6.5
Fixes: QTBUG-113138
Change-Id: Ie3fe2fede1e81d08201ec4353352ef069aebc388
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Rounding distances up can result in coordinates outside of
the clip rect. So stick to always round distances down when we multiply
a scaling.
Fixes: QTBUG-109640
Pick-to: 6.5
Change-Id: I784b7c90da9b6e7f5a925d4275eb67497616001d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
By using an iterator-based for loop.
Change-Id: I9ae12f16bc2a5c2d74c8557a0324438102fec5b1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Drive-by change: use QByteArrayView instead of allocating a QByteArray.
Change-Id: Iaf7acbbdb4efbb101b73b30061ce38dd1fa99ca3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
"notifier->socket()" returns qint64, but sockfd should be int, because
pollfd.fd is a gint (aka int).
Change-Id: If6618aa5e652d4284b989352d61a28b605106d09
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
b1802a164b added handling for a parent to
become focus proxy of a child. The respective 'else if' branch didn't
check whether setFocusProxy() was called with a nullptr argument.
This patch adds the missing nullptr check.
It also adds functionality to tst_QWidget::tabOrderComboBox() to test
the removal of a focus proxy, as well as the complete removal of an
element from the focus chain.
Change-Id: I4cb865b9ac4497fc5e2595910738fb77694f5837
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
In some rare situations the display link may fail to create, or will
be created in an uninitialized state:
https://bugzilla.mozilla.org/show_bug.cgi?id=1201401#c123
When the latter happens the display link thread will crash in
CVCGDisplayLink::getDisplayTimes(). Based on the Mozilla bug
report, and subsequent patch, we can detect this situation via
CVDisplayLinkGetCurrentCGDisplay(), so we follow the same
approach, and then bail out:
https://bugzilla.mozilla.org/show_bug.cgi?id=1201401#c158
Once we bail out we fall back to the timer based approach
to delivering the update request. The next requestUpdate()
will try to use the display link again, which will likely
work this time around, as the display has had time to fully
initialize.
Pick-to: 6.5
Change-Id: Ib80fd792516d1e4e7f863a82755cbf00d1eb6c34
Reviewed-by: Robert Griebl <robert.griebl@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
- Definition of 'standalone' attribute:
An XML declaration containing the attribute 'standalone' with its
value set to 'yes', tells the parser to ignore markup declarations
in the DTD and to use them only for validation.
The declaration attribute is optional and defaults to 'no'.
- Behavior Qt5
In qt5, DOM documents contained the standalone attribute,
regardless of whether or not it was explicitly specified.
- Behavior Qt6
In Qt6, the standalone attribute was only contained in a DOM document,
if its value was 'yes'. If it was explicitly declared with the value
being 'no', it was dropped in the DOM document.
- Expected behavior
If the source specified it overtly, then the generated XML should
contain the attribute, even when it takes its default value.
- Code base
QXmlStreamReader provides a public bool getter isStandaloneDocument().
This says whether the document is standalone or not.
The information whether the attribute was actually specified gets lost.
In consequence, the attribute was always dropped on non-standalone
documents.
- Fix
This patch makes hasStandalone a member of QXmlStreamReaderPrivate, to
record whether the attribute has been explicitly specified.
QDomParser is modified to retain the standalone attribute, if
QXmlStreamReaderPrivate::hasStandalone is true.
- Test
The patch adds a test function in tst_QDom.
Fixes: QTBUG-111200
Pick-to: 6.5 6.2
Change-Id: I06a0f230a2d69597dd6453f8fd3b036943d08735
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
MSVC complains because we call Data::allocate(args.size()) and, of
course, initializer_list::size() returns unsigned std::size_type,
while the relevant Data::allocate() overload takes a signed qsizetype.
The constructor from iterators potentially has the same problem, if
the iterator type's difference_type is unsigned, so make the
type-conversion overt there, too.
Pick-to: 6.2 6.5
Change-Id: I521eca26a48aed570855b13242bf2df8bfa38f96
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If not excluded, some of the macros in X11.h and Xlib.h conflicts with
symbols defined in `UrlFormattingOption` and `Type` in `qurl.h` and
`qjsonvalue.h`.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ic1b056f0bcd6643394401bca464f751b3489202d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The macro sets the required CMake variables and policies and
should be called right after the
find_package(Qt6 COMPONENTS BuildInternals... call to make sure that
the subsequent code adopt all the required policies.
Pick-to: 6.5
Task-number: QTBUG-112685
Change-Id: I9f93f728ee4d8ae7743db9fffafa26025c76dcf2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In 939b7bfe66 we synced up the NSMenuItem's
title to that of the corresponding NSMenu, as AppKit was observed to use
the NSMenuItem title for its heuristics of when to add dictation and
emoji entries to the menu.
But AppKit's heuristics are based on the localized name of the edit menu,
so we need to follow suit and look up AppKit's own localizations. This
is of course fragile, as we're relying on this localization continuing
to live in the InputManager table, but if that changes we'll just fall
back to using the title from the NSMenu, as we did before.
In addition, AppKit's heuristics also look for menu items in the menu
that match selectors such as copy:, paste:, etc, so even if our lookup
of the localized title fails, the additional heuristics would in most
cases still succeed in detecting the edit menu.
Task-number: QTBUG-53085
Task-number: QTBUG-79565
Pick-to: 6.5
Change-Id: I5e12973b86ab35f10a8f7434bcae8a4cf134ecfd
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
There seems to be a Value already defined in Integrity, and we `#undef`
it here: `text/qcssparser_p.h:39` to avoid symbol confusion. However,
this is not robust during the unity build where we might not necessary
end up with the preferred ordered of things.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ide37ab2035f0aa482a1d53d8e1511e0ab0109b3a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Not using structured bindings because those functions will be changed to
return QSimpleParsedNumber directly.
Change-Id: Ic52b6754da14b86d8ddc5f399262f227e05527ce
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In commit 482a75fef9 the code was changed to return early, but that
missed appending the organization and app names while test mode is
enabled.
Issue spotted by Edward.
Pick-to: 6.5
Change-Id: Ifd220f8990874a173413dcf71d105c04b605c800
Reviewed-by: David Faure <david.faure@kdab.com>
Some unittests set a custom Organization and Application names and then
clears them. Instead used init() method to "reset" those two names to
the original values before each unittest is run.
Pick-to: 6.5
Change-Id: I359f3911dd50a2aecfd8dde22e2d591adc6e224e
Reviewed-by: David Faure <david.faure@kdab.com>