We made qRandomCpu() call qCpuHasFeature(), which needs to test that
RDRND works and does so by calling qRandomCpu(). So disentangle that by
making sure we don't recurse.
And by making sure that we fill the buffer with RDRND data, not with
RDSEED.
Fixes: QTBUG-79162
Change-Id: Ib5d667bf77a740c28d2efffd15cc583a9afcb97a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A previous fix has caused a performance degradation while adding a
check for avoiding adding duplicated rectangles to the update list.
This patch fixes it by using a std::set instead of a QList, avoiding
duplication while using an O(log N) operation, instead of the O(N)
used before.
Fixes: QTBUG-77952
Change-Id: Ifa9fbf110e0bad60ee02a42d91281981fd98ceab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Only allow implicit conversions when the types involved are compatible.
That means, only allow construction and copy assignment when the type
X* is convertible to type T*. This is done using SFINAE and the
std::is_convertible type trait, which makes the previous
QSHAREDPOINTER_VERIFY_AUTO_CAST obsolete.
This patch fixes compilation when a function is overloaded with
Q{Shared,Weak}Pointer of different, incompatible types. Previously, this
resulted in a compilation error due to an ambiguous overload.
Change-Id: I069d22f3582e69842f14284d4f27827326597ca2
Fixes: QTBUG-75222
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When this was refactored in 3bc10fb9bb to use unique pointers, a move was
added before the connection, so it would essentially always try to connect a
nullptr.
Change-Id: Iab7fce88bc73afd78e6b63ffaef7358f3f4ce7e3
Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>
The childEvent handler sets the enabled property of children as they are
added to the groupbox, but applications might later enable children and
check/uncheck the groupbox's checkbox in undefined order. In that case,
we would end up with enabled children inside a conceptually disabled
groupbox (the groupbox's checkbox represents the logical "disabled"
state), which breaks documented QWidget::enabled rules.
To make sure that all children are disabled as per the state of the
groupbox, we need to run that logic once the UI has been set up, and
before it becomes visible. This is what polishing is for, so listen
for that event in addition and handle it the same way as adding (which
duplicates things, but keeps existing code that might depend on things
being updated as they are added working).
Adds the case to the existing enabledChildPropagation test case.
[ChangeLog][QWidget][QGroupBox] Always disable children of a checkable,
unchecked group box before showing.
Change-Id: I978bd27b6f1a3f54ec745faeea529a98d0d93619
Fixes: QTBUG-25938
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Pass the QWindow as context to QIcon::pixmap(), which
enables it to return high-dpi pixmaps when needed.
Fixes: QTBUG-74100
Change-Id: I4556f0a98df8b6ba65376778379a03eb8c470d00
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The evdev touch handler is thread based and calls
QWindowSystemInterface::handleTouchEvent. The global variable
in qwindowsysteminterface.cpp is used without being protected by mutexes
which causes data loss and crashes when multiple touch screens are used.
Fixes: QTBUG-63584
Change-Id: I8b5bb04cc517fab96ac428b2bd2bc128b2ca1a54
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Both the spline curves and (most of) the predefines curves are defined
as having start value 0.0 and end value 1.0. The spline and In/OutBack
functions would sometimes not produce that result precisely, so code
could not reliably depend on expressions like (easedValue < 1.0)
becoming false. Fix by explicitly handling endpoints.
Fixes: QTBUG-76781
Fixes: QTBUG-72630
Change-Id: I21be43af469a76c090154bffef8406a9baf2d0b1
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
When we're flushing the backingstore to sub-views with their own layers
we don't want to pay the cost of uploading the whole backingstore to the
GPU in the case where we're dealing with a discrete GPU.
To work around this we make a copy of the appropriate part of the surfcace.
This results in additional copies of the data, and will need further
investigation to limit these.
Task-number: QTBUG-77447
Change-Id: I318ae80e433dd7b0a55fd5a598b19f114d8bd28e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The implementation of the default handler, [NSApp _handleAEQuit],
does a lot more than just terminating the application, including
sending NSWorkspaceWillPowerOffNotification if appropriate, and
deals appropriately with state restoration.
Change-Id: If725838fc0f40d09a0b8885eb3e7239499d8fea0
Fixes: QTBUG-18624
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Sending a message to a nil object returns nil, so there's no reason to
check the delegate before calling respondsToSelector, and we can use
the implicit _cmd argument to pass along the selector for the method
we're in.
For applicationShouldTerminate, if there's a reflection delegate but
it doesn't answer to applicationShouldTerminate it makes no sense to
skip our own logic.
Change-Id: Iafcd883a5c8cec1b35d2f95238de55eff060d71f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
when it's in 'ON' state ("inverted" color in 'Dark' appearance).
Number are rather arbitrary and extracted with 'Digital Color Meter'
app to make it look similar to the native panel (to be honest,
this tool button on a toolbar not to be found in many native apps,
they use different buttons anyway).
Fixes: QTBUG-71526
Change-Id: Ie61e60b77f097f04550006612e4aab6f11bb954b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
A default-constructed QDateTime is invalid, but compared equal to a
valid one referencing the start of 1970. This lead to date properties
in QML being initialized invalid but not getting an onChange if the
first value they're set to is the start of 1970.
Fixing that then lead to some tests failing. Indeed, the original
equality check involved using toMSecsSinceEpoch(), whose value is
undefined unless the datetime is valid, without a prior check on its
validity: so ensure all uses of toMSecsSinceEpoch() are guarded with
isValid() checks.
Reworked tst_QDateTime::toSecsSinceEpoch() to use its bool column
(previously unused, after separating from toTime_t(), which uses this
column for "out of time_t's range") for validity of the datetime.
[ChangeLog][QtCore][QDateTime] Invalid datetimes are now treated as
equal and less than all valid ones. They could previously be found
equal to valid datetimes.
Fixes: QTBUG-79006
Change-Id: Ie72deb8af4350a5e808144d0f6e42dc8eb3ff5ef
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Avoid the massive code duplication in the two QObject constructors. The
only slight difference is the code path checking for isWidget; I'd say
that paying for that one is worth the price of de-duplicating.
Change-Id: I3af749738fe7d6b7adf287009d1815396a2f1407
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Cleanup QtWidgets examples:
- use nullptr (clang-tidy)
- use member-initialization
- adjust the style
- fix includes
Change-Id: Ic5448606aacc525ea60b615a69227017aa2b821a
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
QWidget::mousePressEvent is documented to implement the closing of
popups if the widget is a popup. QAbstractScrollArea is one of the
QWidget subclasses that might be used as a popup as well, so instead of
just ignoring mousePressEvents, pass the event on to the QWidget
implementation for regular popup handling.
Change-Id: I05f77a334945f3c167f729f30bc022599230379b
Fixes: QTBUG-60885
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
std::unordered_set only supports forward iteration for good
reasons. Align our API with this by deprecating reverse
iteration and the operator+/-() for iterators.
[ChangeLog][QtCore][QSet] Reverse iteration over QSet is now
deprecated.
Change-Id: Ia6e3346a6474c454c63010d855850ae4ff12e1a4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Users should not call any QList API with indices that are out of
bounds. Deprecate this behavior and make sure users get warnings
in debug mode and assertions if they disable deprecated functionality.
[ChangeLog][Important Behavior Changes] Calling QList::insert() or removeAt()
with an out of bounds index is deprecated and will not be supported in Qt 6
anymore.
Change-Id: I97adecc2e2aabd36ea2cc69e0895d625f78b32a0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Change-Id: I13431e45ef329921a8846c38047f704a299a1a94
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Cleanup QAbstractItemView autotest:
- use range-based for loops
- use nullptr
- use member initialization
- use new signal/slot syntax
- use static invocations
- use override
- replaced QCoreApplication::processEvents with
QTRY_VERIFY/QTRY_COMPARE
Change-Id: Iba91811db6fb925364fc88ec36357e758b937329
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
It seems like qmake is happy with the comment, followed by a
continuation and then another comment, but having the continuation at
the end of the line makes more sense.
This will make it easier to port to CMake.
Change-Id: I20c964e8c3b6fea4745095783503045b191b000b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The snippet uses the Unix touch command, not qmake's touch function.
Change-Id: I71d1460447249b8941ce4bdbb494bb419e13b119
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Since Qt 5.3.0 we recommend that Linux distributions place a
SSE2-enabled copy of QtCore in a $PREFIX/lib/sse2 subdirectory (see Qt
5.3.0 changelog for details). Same for other hardware capabilities like
AVX2 and AVX512.
This use case was broken with the introduction of the 'relocatable'
feature, because the prefix is determined from the location of
libQt5Core.so and the relative path from libdir to prefix, which is
baked in at configure time.
We now try to locate the libdir below the prefix, and if that fails try
again in the upper directories.
Fixes: QTBUG-78948
Change-Id: Ieec6e1484974e19335cf08ae0df3ee5c0e316d28
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Clipboard retrieval sometimes fails due to the other application
having the clipboard locked. Retry opening the clipboard.
The choice of parameters is empirical, they have been observed
to prevent failures for MS Office applications at least.
Fixes: QTBUG-53979
Change-Id: Icbcaee149f0d377f33b222cdafbb2a21a7f1cf9d
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Add a comment for fixme comment added in
f1268d137e.
Change-Id: I08cd104442b13925be2aa5a48e64e391c9903099
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Widgets might be destroyed when handling a dragMoveEvent, in which case
the following code will operate on dangling pointers or null pointers.
Use a QPointer to watch for the original event receiver to disappear,
and add the necessary checks for the objects we deliver events to being
null.
Change-Id: I4ca2f182540ae21113f4bea4e5c569e983cc58bf
Fixes: QTBUG-78907
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
A certain geometry adjustment was (practically) introduced in Qt 5.11,
and caused very surprising behavior, where item widgets will often
overwrite neighbouring cells. This has resulted in a number of bug
reports. Since the adjustment has such serious side effects, and does
not seem to be relevant any longer for the issue for which it was
intended, remove it here.
More details: From early Qt 4 times, QStyledItemDelegate would do some
automatic expansion of the geometry of editor widgets - but only if
the layout was RightToLeft. Hence, the effect of it was rarely
seen. QTBUG-37433 did, for Qt 5.10, and complained about it. However,
the resulting code change did not remove the adjustment, but instead
extended it to apply to the normal LeftToRight layout also. Hence,
more users experienced it, and reported it as a regression.
Also, now in Qt 5.13, it seems Qt has changed in other ways, and the
geometry adjustment no longer seems to help (or indeed make any
difference to) the original case in QTBUG-37433.
Fixes: QTBUG-78495
Fixes: QTBUG-76011
Fixes: QTBUG-68476
Change-Id: I4a4e873969eb1d89843f98fc63d90371207515d1
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
The xcb platform plugin uses this category for detailed input event
logging, so we might as well be consistent in evdevtouch. When hardware
supports pressure sensing, it's likely to need extra debugging.
Task-number: QTBUG-77142
Change-Id: I7682bb5d49e669054523f9cf556715e511bcd572
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
that was accidentally introduced this week.
Change-Id: I0731c7c64e51b40f230b42694603056d89a05712
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
There is no onscreen support for WinRT in the D3D11 backend yet.
However, offscreen operations (rendering into a texture) should work.
One catch is that there is no D3DCompile available for deployed WinRT
apps. So ship the intermediate format (DXBC output from fxc) in the
.qsb files.
Change-Id: Ic0aba4b817c27d13dcf3af41bf7612d799382655
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
When the source size is not explicitly specified, we take the entire
subresource. However, just using the texture's size is wrong: when the
source level in a copy or readback is not 0, the size for the corresponding
mip level has to be used instead.
This fixes occasional crashes with Metal in the autotest.
Change-Id: I99f689feef93ec86dffdc9e82d6bfdaf5c1eb041
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Also improve (docs and runtime checks) and test the minimum set
of required data to create a graphics pipeline.
Task-number: QTBUG-78971
Change-Id: If5c14f1ab1ff3cf70f168fde585f05fc9d28ec91
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
The joys of "level - Specifies the mipmap level of the texture
image to be attached, which must be 0." for glFramebufferTexture2D
in OpenGL ES 2.0.
Change-Id: Iaf19502f48d7ba73b26abb72535bfa6696a1e182
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Use only APIs that are in GLES 3.0.
glMapBuffer() is an old OES extension, stop bothering with that.
Not the least because ANGLE claims supporting it and then fails the
map. (not that we care much about ANGLE, but, for instance, the qrhi
autotest is run with ANGLE configurations as well in the CI, so have
to still take care of it for the duration of Qt 5.x)
Change-Id: I29140402cedffe0430f920ee0c061673257c3aa1
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
...and make the Null backend able to deal with these, for RGBA8 textures
at least. Naturally it is all QImage and QPainter under the hood.
Also fix a bug in the OpenGL backend, as discovered by the autotest:
the size from the readback did not reflect the mip level.
Task-number: QTBUG-78971
Change-Id: Ie424b268bf5feb09021099b67068f4418a9b583e
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
The interesting part here is that sending messages to a null
object is valid in Objective-C, so without an explicit check it
is not necessarily straightforward to discover that we do not
have working rendering. (because the application won't just
simply crash)
Do the right thing now and return false like other backends do.
Task-number: QTBUG-78994
Change-Id: I0d3c4a49a3fc78f9149f8af4fe67d581e74daae7
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This also marks the beginnings of significantly extending autotesting
of the resource and rendering functionality in QRhi.
Also involves fixing up the buffer operation lists like we did
for textures before. This is to ensure updates and reads on the
same batch execute in the correct order. So just have two lists:
one with buffer, one with texture operations.
Also simplify the struct layouts. No need for those inner structs
with many duplicate members. This reduces the size even, since using a
union was never an option here. Also switch to a VLA, the size is around
253 KB per batch.
The Null backend now keeps track of the QRhiBuffer data so it can return
valid results in readbacks.
Task-number: QTBUG-78984
Task-number: QTBUG-78986
Task-number: QTBUG-78971
Task-number: QTBUG-78883
Change-Id: I9694bd7fec523a4e71cf8a5c77c828123ebbb3bd
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>