Before a recent fix it would happen occasionally that
lastNormalizedPositions.at(0) would segfault because the list was
empty. The cause of the flakiness was fixed, but make the test more
resilient anyway by checking first the list is correctly populated.
Furthermore on some platforms this check fails:
qAbs(leftWidget.lastNormalizedPositions.at(1).x() - 0.8) < 0.05
So instead of QVERIFY use QCOMPARE_LT to print the values when it fails.
Task-number: QTBUG-104268
Change-Id: Id5430eb53c133cf5d23647cfd9749f01f266efce
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Sometimes XCB_EXPOSE event is being propagated twice, once before and
once after qWaitForWindowExposed(). But the window has focus only after
the second expose event. Changing it to qWaitForWindowActive() fixes the
issue.
Fixes: QTBUG-104268
Pick-to: 6.2 6.3 6.4
Change-Id: Ibc78dd4958ed1a4a8d0967b29d2a53457ab9ae8b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The QTextFormat::FontFamily enum is deprecated since Qt 6.0, however it
is still used in the code.
To retain backward compatibility with the old data stream formats, we
introduce a new internal QTextFormat::OldFontFamily enum value, which
has exactly the same value as QTextFormat::FontFamily, and use it
instead.
Task-number: QTBUG-104857
Pick-to: 6.4 6.3 6.2
Change-Id: Ibf5258b621c2b0aa507005dfe2c1e80c26ddb0d4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
... when QT_DISABLE_DEPRECATED_BEFORE is past the deprecation version.
This commit actually stops using the deprecated signals when we build
Qt with QT_DISABLE_DEPRECATED_BEFORE >= 0x060000. Otherwise we will
get a compilation error because the signals will be removed.
Task-number: QTBUG-104857
Pick-to: 6.4 6.3 6.2
Change-Id: Ie513ecc9451bf2d88f80857cf19f3d2b4958d022
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
- add move special member functions (docs copied from QHostInfo)
- add member swap
- use move-and-swap, not pure-swap, because these objects hold
resources (handles) other than just memory
- Q_DECLARE_SHARED (it's not implicitly shared, but explicitly)
- adds ADL swap and Q_DECLARE_TYPEINFO
[ChangeLog][QtOpenGL][QOpenGLBuffer] Added member-swap(), move
constructor, move assignment operator.
Change-Id: I22dc92108bdd393fff4361db23e94eaf3d7ea9cc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Amends 1d961491d8. We modify the resolve
mask after making a shared copy of 'other', so we must detach. Call the
setter designed for that purpose.
Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-98762
Change-Id: I4f45223e74764a341378992172787fae73efb8b7
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
If the cached font has a different DPI than the one used in
QPainter, we need to treat this the same as if other font
properties have changed and redo the layout.
This happened when running the QStaticText test on Wayland,
because the default dpi was 100 and the QPixmap we ended up
drawing to was 96. This caused the pixel size of the font to
be calculated differently when doing drawText() (using 96 dpi)
and drawStaticText() (using the cached 100 dpi).
Pick-to: 6.4
Fixes: QTBUG-100982
Change-Id: Ie4270341bb8a64b6458eb67ba460a282c65dc26b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Some of the offsets are already quint32 in the API (vertex input
attributes, dynamic offsets, offsets in draw calls), matching the
reality of the underlying 3D APIs, but many buffer-related functions
use int as of now, simply because that used to be the default choice,
and the same goes for sizes (such as buffer or range sizes). This is
not quite consistent and should be cleaned up if for nothing else then
just to make the classes consistent, but also because no 3D API use a
signed type for offsets, sizes, and strides. (except OpenGL for some)
When it comes to strides (for vertex inputs and raw image texture
uploads), those are already all quint32s. This is straightforward
because most of the 3D APIs use 32-bit uints for these regardless of
the architecture.
Sizes and offsets are often architecture-dependent (Vulkan, Metal),
but there is at least one API where they are always 32-bit even on
64-bit Windows (UINT == unsigned int, D3D11). In addition, we do not
really care about buffer or texture data larger than 4 GB, at least
not without realistic use cases and real world testing, which are
quite unlikely to materialize for now (esp. since we still have the
width/height of 2D textures limited to 16 or 32K in many cases even on
desktops, whereas 2GB+ buffers are not guaranteed in practice even
when an API seemingly allows it).
In any case, the important change here is the signed->unsigned
switch. A number of casts can now be removed here and there in the
backends, because the offsets and sizes are now unsigned as well,
matching the underlying API reality. The size can be potentially
increased later on with minimal effort, if that becomes necessary for
some reason.
Change-Id: I404dbc365ac397eaeeb3bd2da9ce7eb98916da5f
Reviewed-by: Inho Lee <inho.lee@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
56bd1b76d2 changed the update
resolve mask behavior in QPalette to avoid detaching brush data
when modifying the resolve mask if the brush value is not changed.
But this behavior broke compatibility, it introduced unknown risks, and
we cannot ensure that other code in Qt does not depend on the old
behavior.
We both need to ensure that we don't detach when the value is not
changed, and ensure that the resolveMask is always updated regardless
of whether the value changes, so we need to split them up and
independently share the brush data.
QFont will update its corresponding resolveMask even if the value has
not changed, so it is better to correct this behavior so that QPalette
and QFont are consistent.
[ChangeLog][QtGui][QPalette] Always update resolve mask in
QPalette::setBrush, even if the value of brush has not changed.
Fixes: QTBUG-98762
Pick-to: 6.4 6.3 6.2
Change-Id: Ib845361b30f21c3d78c16ced923c1678b12e05ac
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Unblock the qtdeclarative dependency update.
This behavior change is causing a regression for QQmlPreviewHandler's
zoom feature. Back out of the change for now, until we can find a way
to make both use cases work.
This reverts commit 1c0a56a2f3.
Change-Id: I1b3d84504bbcb4f2b2250a20194fdaf4ab4fd97f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
QFutureCallOutEvent is used externally, so it needs to be exported.
This reverts commit 3141a13b2a.
Fixes: QTBUG-104732
Pick-to: 6.4
Change-Id: I82c9e7414192ee948f78259bd74a404691a7805a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
QT_SCREEN_SCALE_FACTORS in many cases set on behalf of the user,
instead of by the user, so we should make it less sharp and more
in line with standard high-dpi configuration.
Specifically, make it subject to the rounding policy set by
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(). This
means that applications which support integer scale factors
only will see integers only, also when QT_SCREEN_SCALE_FACTORS
specifies a fractional factor.
Users who want to override can set
QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough
to restore the default Qt rounding behavior.
[ChangeLog][QtGui] The high-DPI scale factor rounding policy (settable with
QGuiApplication::setHighDpiScaleFactorRoundingPolicy() or
QT_SCALE_FACTOR_ROUNDING_POLICY) now applies to scale factors set
with QT_SCREEN_SCALE_FACTORS.
Pick-to: 6.4
Fixes: QTBUG-95930
Fixes: QTBUG-99546
Change-Id: Ibb0aa5cb9d3a356d33429d0efe69d984b2530728
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Test setting both via QGuiApplication property and environment.
Change-Id: Iaccc920adb6294d610b02d4c844aa5b15eb7eecd
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Under normal circumstances, when the second point is touched, the
first point has not been released, and the message at this time
should contain two touch points. We are simulating the case where
the message is lost when the popup is closed by touch. Amends
efc02f9cc3
Pick-to: 6.4 6.3 6.2
Change-Id: Ic722e3dbd615c46076ede26611d0107501c5e274
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Make our QRhiMemAllocStats struct a bit more generic, drop the memory
allocation part in the naming, and use the same getter and struct for
reporting some important timings. (we are free to rename for now, there
are no users in other modules yet)
The time spent in graphics (or compute) pipeline creation has a special
relevance in particular with the modern APIs (as it is the single
biggest potentially time consuming blocking operation), but also highly
interesting with others like D3D11 simply because that's where we do the
expensive source-to-intermediate compilation is HLSL source is provided.
In order to see the effects of the various caching mechanisms (of which
there can be confusingly many, on multiple levels), the ability to see
how much time we spent on pipeline creation e.g. until we render the
first view of an application can be pretty essential.
Task-number: QTBUG-103802
Change-Id: I85dd056a39db7e6b25fb1f9d02e4c94298d22b41
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
The goal is to make it possible to implement QSGRhiSupport::backendName()
in Qt Quick with just a single line:
return QString::fromUtf8(QRhi::backendName(m_rhiBackend));
instead of duplicating the strings and the logic.
Similarly, QBackingStoreRhiSupport can now drop its apiName() helper
entirely.
Change-Id: Ia8cbb1f1243539ed4d7a98e71dcc2ed56b017e40
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
When a markdown document contains a "naked" URL, or an angle-bracketed
<URL>, md4c recognizes it, and we set the AnchorHref charfmt property.
There's no need to expand it into the [text](url) form if the text is
the same as the url, there is no tooltip, and the url is valid.
QTextMarkdownWriter now writes a CommonMark "autolink" in that case:
https://spec.commonmark.org/0.30/#autolinks
[ChangeLog][QtGui][Text] QTextMarkdownWriter now writes an autolink
whenever a hyperlink has no custom text and no tooltip, including
when the document was parsed from Markdown containing a naked URL.
Pick-to: 6.4
Fixes: QTBUG-94713
Change-Id: I432db8499c62e1e0b1e913bfd8ef2147e3c2bb2a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Work around https://gitlab.freedesktop.org/mesa/mesa/-/issues/5875 by
treating the driver as broken when both the driver and device UUIDs
are all zeroes.
Fixes: QTBUG-104231
Pick-to: 6.4 6.3 6.2
Change-Id: Ibf7973361d472ebb1cb433bc61b50b2828f75c6b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Found by codespell
Pick-to: 6.4
Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
More specifically, if either minimum or maximum size are updated, make
sure that the current window geometry is updated so that it is within
the minimum and maximum sizes.
Previously, these constraints was only respected by the window manager
when the user resized the window.
For widgets this already worked, because a top-level widget will take
care of respecting these constraints if they are changed.
Since QWindow::setMinimumSize and QWindow::setMaximumSize started to
share so many common things, a new function (setMinOrMaxSize_helper())
is added.
Task-number: QTBUG-102771
Change-Id: Ia4b2680dcf865f84a3cf6424187f9a6036b76386
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
If we replace the bullet character with a UC checkbox character, it
looks ok in a browser, and the HTML parser can recover the BlockMarker
attribute from the css class.
[ChangeLog][QtGui][Text] Checkbox list items can now be read and written
in both HTML and Markdown, including conversions.
Task-number: QTBUG-103714
Change-Id: Ic6b74512075cd4ac16d6f80fdf55b221447491a9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Avoid a full data detach when only metadata changes. This paradigm was
already used one place, and made generic.
Fixes: QTBUG-81674
Change-Id: I605253babc6ad9fc130e19e8cef3812690933ac5
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Add test of explicitly prepared qcolortransform, this is a state
a transform can get into if used for an image transform.
Also cleans up the test code.
Change-Id: I9445ed114bed0edc790e14024aaae6a42989220b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This allows to set up everything first - without paying for the layout
calculation at every step - and only then trigger the layout once.
Results:
0.065 msecs to create a QGraphicsTextItem with some text (layouted)
0.036 msecs to set everything up in a QGraphicsTextItem with 0 width
Change-Id: I138bd1d58941d029bc0a36d2730216778f1fbd97
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Before it was only tested indirectly as part of the qcolorspace
tests. This also fixes a rounding for maximum RGB64 values.
Pick-to: 6.3
Change-Id: I6106e662c0f9d00c0b3a0c13213cb051ea39e14e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The issue is that when someone is trying to use the following code:
QKeySequence keySequence(Qt::Key_Shift);
qDebug() << keySequence.toString();
This will print seemingly gibberish output. It is unicode in practice. For
Qt::Key_Shift, this would be: "�_@\uDC20"
The reason why this is happening is because we have platform-specific ways to
handle this due to Mac glyphs which are not available on Linux or Windows. This
works fine on Mac.
But for the Linux and Windows codepaths, there is not really any mapping like
for other keys. It seems that modifiers were left out.
The solution is to simply amend the list of mapping from these modifier key
codes to raw strings for Linux and Windows like it is done for other key codes.
So, now, modifiers will also be included in the list.
So, the expected output will be generated for the above code, as: "Shift".
[ChangeLog][QtGui][QKeySequence] Added missing modifier names
Fixes: QTBUG-69715
Fixes: QTBUG-40030
Change-Id: I460d54bc8e593b350ff95894f23c5b4a7c819a44
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
We should prefer to test this unless we know it won't work, but this is
very hardware and implementation-dependent anyway. So I declare that
we'll only guarantee FP exception cleanliness on a best-effort basis for
a few platforms.
The notable difference in this commit is the removal of QNX. I don't
know why it began producing an FP exception with one of my changes, but
since the toolchain isn't public, I can't debug and will not devote any
time to figuring it out. If users of QNX require this, then someone with
interest in that OS will need to spend time after my changes integrate.
Change-Id: Ibcde9b9795ad42ac9978fffd16f1cb9c03a0ff66
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
When XCB_INPUT_TOUCH_BEGIN closes a popup, we then receive
XCB_INPUT_TOUCH_END, and cannot find a target window (because it's
destroyed). If we don't deliver it, we need to at least clear the
stored point from QPointingDevicePrivate::activePoints. Then when
we deliver the next touch press, m_fakeMouseSourcePointId also
needs to be reset.
It's now even more paramount that autotests (and real-world
touchscreens) must never omit any active touchpoint from a touch event.
If a point doesn't move, it must be included in the QTouchEvent, with
Stationary state. If not, QGuiApp::processTouchEvent() could generate
multiple TouchBegin events in a row, which gets other bits of logic
confused, here and there.
Fixes: QTBUG-94557
Fixes: QTBUG-98519
Fixes: QTBUG-102751
Fixes: QTBUG-103706
Pick-to: 6.2 6.3 5.15
Change-Id: Ia95e410a2bb8bc7784aa5d296fac2b89e53a9f55
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This caused unnecessary empty <pre> blocks when converting markdown to
HTML, made code blocks too large using QSyntaxHighlighter to highlight
the whole block, and caused assymmetry when rewriting markdown.
Pick-to: 6.3
Fixes: QTBUG-101031
Change-Id: I08016577ccb92edb4afae31d7df3259cb011d5c8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
The HTML parser calls QTextBlockFormat::setNonBreakableLines(true) when
it sees a <pre> tag; so for symmetry, the markdown reader now does the
same when it sees a fenced code block, and the markdown writer honors
the nonBreakableLines property by writing a fenced code block. This
preserves the meaning better when reading HTML and writing markdown or
vice-versa, without modifying HTML reading or writing code.
Added a test tst_QTextMarkdownImporter::fencedCodeBlocks() which
unfortunately also highlights a known bug in the markdown reader: each
fenced code block ends with an extra empty block. That can be fixed
separately.
tst_QTextMarkdownWriter::fromHtml(preformats with embedded backticks)
that we re-enabled in 1abaf9d5d6 was not a
very useful test: ``` with a space and some words but no newline is not
a fence: it's just like a `monospace` span. We have had trouble with
those in CI because of missing monospace fonts, or inconsistency when
a supposedly mono font's QFontInfo::fixedPitch() returns false.
So just test proper <pre>/fence conversion for now.
Pick-to: 6.3
Fixes: QTBUG-100515
Fixes: QTBUG-100981
Task-number: QTBUG-101031
Change-Id: I88f0ede0810d8a9480b30eb0cd780e1af67cc5f2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
On QNX in CI we see
system fonts: fixed: monospace 9; general: Sans Serif 9
and "monospace" isn't really a fixed pitch font.
On B2Qt arm7 in CI we see
system fonts: fixed: monospace 9; general Sans Serif 9
and Sans Serif is actually fixed pitch.
So these tests can go wrong both ways; we need to skip them whenever
the fonts would lead QTextMarkdownWriter astray.
Pick-to: 6.3 6.2
Task-number: QTBUG-89819
Task-number: QTBUG-99676
Task-number: QTBUG-100515
Task-number: QTBUG-103484
Change-Id: I7b9adca967eaf9b8d33d1e03ef2627f70f375196
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This patch enables usage of QAbstractItemModelTester on
QFileSystemModel. QAbstractItemModelTester called fetchMore()
on all items. QFileSystemModel represents the whole file system.
This led to very long test runs. To avoid this, this patch
introduces a new feature in QAbstractItemModelTester, namely
to disable calling of fetchMore().
Change-Id: Ie5d2e22fa4c143be7c080d9f79632cd2cbe07aac
Reviewed-by: David Faure <david.faure@kdab.com>
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.
Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Also add the beginnings of an autotest for QTextCursor::insertHtml(),
for comparison purposes.
We can see that the block to be inserted is merged with an existing
block by default rather than being inserted as a new one, with both HTML and
Markdown insertions. So now we test for leading and trailing newlines
in the markdown to be inserted, to determine whether we need a new block
into which to insert, and to "hit enter" at the end of the insertion.
QSKIP the toMarkdown() comparisons if GeneralFont is mono. This happens
on Boot2Qt systems in CI.
Task-number: QTBUG-76105
Task-number: QTBUG-94462
Task-number: QTBUG-100515
Task-number: QTBUG-103484
Change-Id: I51a05c6a7cd0be4f2817f4a922f45fa663982293
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This allows color space conversions that produces values outside the
0.0->1.0 range, which is one of the intended functions of the floating
point image formats.
Change-Id: I63b37b0f6934d4382edafb4709486c785a637c67
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This was forgotten when implementing QTBUG-73160, but suggested in
passing in QTBUG-64.
[ChangeLog][QtGui][QPolygon] Added toPolygonF().
Task-number: QTBUG-73160
Task-number: QTBUG-64
Change-Id: I9b33cf47a0d432aa842ab0f8337001c66e4ca41c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
If all the palette's colors are resolved, nothing needs to be done in
QPalette::resolve(const QPalette &other).
Change-Id: I1573cfa5b5cd1e7eb15f3242aff6ab92e9f8c84b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
swapchain->currentFrameRenderTarget()->renderPassDescriptor() is not
functional at the moment, it returns null. This is because no backend
ensures that the internal renderpass descriptor object is exposed via
that getter in a QRhiSwapChainRenderTarget. Whereas in a
QRhiTextureRenderTarget this would work by design because there the
setter must be called by the user.
Fix this up, providing better API symmetry, and also reducing the need
to pass along QRhiRenderPassDescriptor objects seprately alongside a
QRhiRenderTarget in some places, e.g. in Qt Quick.
Change-Id: I42c4e9aaee3202c1d23bd093d840af80c5f8cd0f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
It's one thing that this is not part of OpenGL ES, but it is optional
even with Vulkan, with some mobile GPUs not offering the feature at all.
Change-Id: I4e2c6642eccb0793e69074b4b6eeb2b7cef3516e
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
A previous commit Q_CORE_EXPORTed this class so it could be used in
tst_qevent. But we can also keep it Q_AUTOTEST_EXPORTed and make the
testing of the class subject to QT_BUILD_INTERNAL on the test side.
That's what this patch does.
Change-Id: I9bd5f80ada856b7db4b39dfb59b32bd825416c13
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>