Commit Graph

2519 Commits (08fb81fb170392d5d6384d4abb4de251f8728362)

Author SHA1 Message Date
Hatem ElKharashy 28b9a653ea QTextHtmlParser: parse border color correctly
Use QCss::Declaration::brushValues to parse the values into a list. This
will not only lead to correctly parsing the values, but also prevent an
an assertion from firing when ValueExtractor::extractBorder is called.

Fixes: QTBUG-126381
Pick-to: 6.7 6.5 6.2
Change-Id: Ic6f3d722ffe0d72dcb5faa9916a23c804211ce49
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit a37ca7c85933979351d99f1bb22191763a78de46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 22:59:08 +00:00
Marc Mutz 2ec36e7ebe tst_QEventDispatcher: port to QTEST_THROW_ON_FAIL
Dogfooding the new QtTest 6.8 feature.

Change-Id: I4ded1fabac25fb283eb26b5eef341892b4459e96
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 7a93e815d2489b97510a1ab7aaf6a140e2e2c587)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-18 08:09:13 +00:00
Liang Qi f9d33433f3 tests: skip most functions in tst_qx11info on offscreen
Task-number: QTBUG-125446
Change-Id: I6749357df8ac9cd8798fafe2cb5df4f5d40d1633
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7407161212c56378529427adfe95627677a95cf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-14 11:02:50 +00:00
Allan Sandfeld Jensen 19ca1284c8 Fix HDR transfer function image conversions
Handle TRC LUTs that overflow the 0-1 range.

Change-Id: I336ef9dd56d8cb8c0caa62bff468c9b536550f57
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 60bb057990657ff285ef0d73fa774eea907a0cbb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-14 00:41:03 +00:00
Allan Sandfeld Jensen dce5164375 Fix BT.2100PQ
From and to algorithms were accidentally reversed before submitting
final patch.

Change-Id: I16e0afda26b77047facf4f65065224c8f3dce6c6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 1b1f613b56fce643a7565e9280acc90e171caf7c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-13 08:46:16 +00:00
Ahmad Samir 741c1d0f11 QFileSystemModel: fix leak in unittest detected by ASAN
Amends e524724f9d.

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f73b50fc1d8 in operator new(unsigned long) (/lib64/libasan.so.8+0xfc1d8) (BuildId: 1827a4c72065a9f25ba519b25166029eebbf519f)
    #1 0x7f73b4cc18d4 in std::__detail::_MakeUniq<QSignalSpyPrivate>::__single_object std::make_unique<QSignalSpyPrivate, QSignalSpy*>(QSignalSpy*&&) /usr/include/c++/13/bits/unique_ptr.h:1070
    #2 0x7f73b4cbf0a4 in QSignalSpy::QSignalSpy(QSignalSpy::ObjectSignal) src/testlib/qsignalspy.cpp:259
    #3 0x55c0e313cd7d in QSignalSpy::QSignalSpy<void (QAbstractItemModel::*)(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal)>(QtPrivate::FunctionPointer<void (QAbstractItemModel::*)(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal)>::Object const*, void (QAbstractItemModel::*)(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal)) (build/tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel+0x83d7d) (BuildId: b2e416794e25fdb925a191cc4a5efe3cb04efb0e)
    #4 0x55c0e30eccac in tst_QFileSystemModel::prepareTestModelRoot(QFileSystemModel*, QString const&, QSignalSpy**, QSignalSpy**) tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel.cpp:392
    #5 0x55c0e30edacf in tst_QFileSystemModel::rowCount() tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel.cpp:420

Pick-to: 6.7 6.5 6.2
Change-Id: Ia085f9235f3bec252290f4fbe5ea0958f91a5e5a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5686af295c98a5ed4b0793ad0098cef76f39a2d7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-09 14:25:14 +00:00
Allan Sandfeld Jensen e673e5a257 Merge applyGray, applyReturnGray, and apply methods
Combine all into a single flexible apply method.

Also fixes a few issues with RGB colorspace on gray input. Blocking CMYK colorspace on Grayscale and ElementListProcessing RGB on grayscale out.

Fixes: QTBUG-125303
Change-Id: I3987010062fbb5aa708aeb1cc239f3ce9413e34f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-06-01 16:27:05 +02:00
Shawn Rutledge e4ef0f03e6 Move popup management from QApplication to QGuiApplication
We need to be able to have true popup windows in Qt Quick and Controls,
including handling the press-drag-release sequence to select one entry
from a menu or combobox. After the mouse press, a new window is created.
On some platforms (such as xcb), the new window gets window system grabs
of both keyboard and mouse (QApplicationPrivate::openPopup() calls
grabForPopup() and it actually works); while on others, the pre-existing
window continues to get the whole sequence of mouse events until the
release. In the latter case, Qt needs to forward events from the
original window to the popup. Until now, the list of popups was
QApplicationPrivate::popupWidgets.

Now we track the open popups as a list of QWindows rather than QWidgets,
in QGuiApplicationPrivate::popup_list, and add a set of static functions
to manage that list. Functions such as QApplication::activePopupWidget()
QApplicationPrivate::openPopup() and closePopup() are rewritten to make
requests to QGuiApplicationPrivate.

276943c8b7 made
QGuiApplicationPrivate::closeAllPopups() virtual. That is now reverted,
because we're putting QGuiApplication in charge of popup management
and trying to minimize widget-specific behavior. So far,
QApplicationPrivate::closePopup() is still overridden to take care
of focus changes.

So far, QtGui does not take care of closing popups when the user
clicks outside: the active popup window gets those events, and needs
to close itself if the click occurs outside. An attempt to move this
logic raised some issues with legacy widget test cases.

Using a touchscreen to press on QMenuBar and open a QMenu, drag to
a menu item and release, is temporarily broken for now. The plan is
to fix it in a subsequent patch.

Task-number: QTBUG-68080
Task-number: QTBUG-69777
Change-Id: I02b5034987b5ee8909917d305f414c8b0db9c7f5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-05-31 10:40:31 -07:00
Eskil Abrahamsen Blomfeldt 1bc78f7739 Introduce flag to use typographical line metrics for fonts
For backwards compatibility reasons, font files have multiple different
ways to specify vertical metrics (ascent, descent, etc.).

For OpenType, the main two are the usWin* and sTypo* metrics in the OS/2
font table. The usWin* metrics are typically used as the clipping bounds
of the font (so no character will ever draw outside these bounds). The
sTypo* metrics thus make it possible to specify a different set of
metrics for use in text layouts which is smaller than the clipping
bounds (or bigger), so that you can have fonts where some characters
overlap with preceding or subsequent lines.

However, GDI (and thus many applications) use usWin* also for line
spacing, which lead to the sTypo* metrics being untrustworthy in some
fonts and later to the introduction of the USE_TYPO_METRICS in the OS/2
table version 4. The idea of this flag is to tell the font system that
the sTypo* metrics can be trusted and should be preferred over the usWin*
metrics.

But the OpenType specification states that sTypo* metrics should *always*
be preferred and modern font systems such as FreeType and DirectWrite
will respect this. This in turn has lead to fonts where the
USE_TYPO_METRICS flag is untrustworthy instead, i.e. the sTypo* metrics
are preferable, but the USE_TYPO_METRICS has accidentally not been set.

Qt trusts the USE_TYPO_METRICS flag and uses the usWin* metrics whenever
this is unset. Since QFontMetricsF::height() (ascent+descent) in this
case includes the line gap metric, a lot of components have been written
to use it for size without adding any margins over the text. So changing
the default now would break a large amount of components, including the
ones in our own Windows style.

Most fonts should work correctly, by setting the USE_TYPO_METRICS flag
if the typo metrics are intended to be used. For those that do not, we
introduce a PreferTypoLineMetrics style strategy.

[ChangeLog][QtGui][Fonts] Added QFont::PreferTypoLineMetrics for using
the recommended line spacing metrics of the font, even if the font has
not explicitly set its USE_TYPO_METRICS flag.

Fixes: QTBUG-125585
Change-Id: Ib2f7df404fe719186d78733bda26da712f1ab85a
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2024-05-31 19:30:53 +02:00
Allan Sandfeld Jensen ce33e47667 Add Bt2020 and Bt2100 color spaces
[ChangeLog][QtGui][QColorSpace] Bt.2020 and Bt.2100 (aka HDR10) formats
have been added.

Task-number: QTBUG-114722
Change-Id: I4ffce460202837e1077e34f48a9286981ee444bb
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2024-05-31 16:24:52 +02:00
Allan Sandfeld Jensen 53ad7b2d9b Complete color space toICC write
Also write gray, CMYK and mAB RGB color space profiles.

Fixes: QTBUG-125302
Change-Id: Id3b3b64537b9c08f1d40b8243c228ad111d08289
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2024-05-31 16:24:50 +02:00
Volker Hilsheimer 626831db34 Android: enable QIcon test case
The test passes locally, and if individual functions should fail, then
skip those.

Change-Id: Ib9123bacaff2a83c2bc378b37201fd1d75dfdb45
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-05-30 22:23:35 +02:00
Volker Hilsheimer 87896c03c1 QIcon: enable icon engine plugins to implement themes
So far, the keys of icon engine plugins were only interpreted as the
suffix of icon files, loaded via QIcon(filename). However, an icon
engine could provide a lot more flexibility if it could implement an
entire theme.

Match the list of keys a plugin can register itself with also against
the current theme name. If a matching plugin is found, use that plugin
to create the icon engine. Store the factory from the plugin to avoid
costly lookups for each icon.

Extend the QIcon test case by adding a custom plugin that supports two
themes. Since the plugin and icon engine creation infrastructure
doesn't communicate which theme the plugin was created for, use
QIcon::themeName to record the current theme when the engine gets
created.

[ChangeLog][QtGui][QIconEnginePlugin] The keys registered by an
QIconEnginePlugin implementation are now also matched against the
current theme (system or user theme), allowing engine providers
to implement entire themes through a plugin.

Change-Id: I8a5e30ff8b5bb7c78b5204e82760e4328671e4c1
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-05-30 02:36:04 +02:00
Robert Löhning 257bbd84e8 tst_qmatrixnxn: Mark variable as unused to avoid compiler warning
Change-Id: Ieae8716683530769a22473dfac616776cc96a359
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-05-29 20:27:18 +02:00
Allan Sandfeld Jensen 5a2b222619 Fix alpha scaling in format changing qcolortransform
Fixes: QTBUG-125306
Change-Id: I5da11df7a27d1947772f5b90a717df1e258fde45
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2024-05-28 15:22:52 +02:00
Giuseppe D'Angelo 19e3ec4e2f QImage: allow for scaling CMYK images
The codepaths for image scaling are a bit convoluted, so some "surgery"
is needed. QImage::scaled() delegates to transformed(), building a
suitable scaling matrix.

transformed() checks if the matrix is a scaling matrix, and then
has several dispatches.

If smooth scaling was requested:

* if the image format is supported by smoothScaled() without needing a
  conversion, delegate to that;

* otherwise, if the transform is "non paintable" or the source image is
  big enough, then again call smoothScale. "non paintable" here means
  that we're scaling more than 2x down, and QPainter wouldn't do a good
  job.

Otherwise, images in color formats (>= RGB32) are converted by applying
the needed transformation on a QPainter and draw the source image with
that transformation.

Otherwise, if the matrix is invertible (a scaling matrix with non-zero
scaling always is, it's a diagonal matrix), then dispatch to
qt_xForm_helper.

--

Amend this reasoning to support CMYK images:

* Make smoothScaled support CMYK without conversions. To do so,
  make qSmoothScaleImage scale CMYK as if it was a ARGB image.

* Make transformed() call smoothScaled() for CMYK images

* In transformed(), consider CMYK as nonpaintable, because we can't
  paint over a CMYK image.

* In the non-smooth codepath, also check that we don't try to paint over
  CMYK, and always go through qt_xForm_helper instead.

Note that we still don't support any other transformation for CMYK.

Add a test, adapting the exiting one for RGB.

Change-Id: Ic72d78923a17fb3963aa22c57265904c716792b0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-05-28 10:06:08 +02:00
Marc Mutz 0076999031 QRegion: re-add rects() and port setRects() to QSpan
In Qt 5, we had QVector<QRect> QRegion::rects(), but it was
deprecated, because just iterating over the QRegion as a container of
QRects was more efficient (QRegion has a SSO for the case of one
rectangle). With QSpan, we can now bring it back with the same
efficiency as iteration, supporting Qt 5 code that never made the move
away from rects() and new code that wishes to make the conversion into
rectangles more explicit. Re-add the Qt 5 tests, which show that the
function is nearly a drop-in replacement for the Qt 5 rects() (QSpan,
at the time of this commit, doesn't have relational operators, yet).

Also add a QSpan overload of setRects(). The old (ptr, n) function
(now obsoleted, but not deprecated) allowed nullptr + n != 0, which
QSpan doesn't accept, so print a warning in that case. Also, QSpan can
hold more than INT_MAX elements on 64-bit platforms, but QRegion's API
was never ported from int to qsizetype, so we need to catch oversized
spans used as inputs, too.

[ChangeLog][QtGui][QRegion] Added QSpan overload of setRects();
re-added Qt5's rects(), but returning QSpan instead of QVector now.

Fixes: QTBUG-124712
Change-Id: I24570c886cbf77abd8d1f4a3f42ae53c892cd9ff
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-05-24 04:38:21 +00:00
Eskil Abrahamsen Blomfeldt 99e94f1035 Support application fallbacks for common script
While common script typically adapts the surrounding script, it is
possible for strings of only punctuation (for instance) to remain
undetermined. In addition, Qt considers Latin and Common the same in
font matching, so in order to get merging for latin, we need to
conflate them in the application fallback API as well.

This also adds a couple of missing clears of caches (clearing
the font cache itself when adding a new fallback, since the
fallbacks are kept as part of the cached font engine + clearing
the fallback cache when adding a new application font, since the
new application font may be a fallback candidate).

Note: This also adds some missing removeApplicationFont() calls
from other tests, since these were causing issues with the
new test.

Task-number: QTBUG-124914
Change-Id: Idbfa0f6b492a9194eca67b57101e674f7b8a4ec4
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2024-05-21 07:24:03 +02:00
Kai Köhne 5e699c2a8b Replace 'Qt Designer' and 'Qt Widgets Designer' in code
Use new term in examples, code comments, error messages and and mime types.

Task-number: QTBUG-122253
Change-Id: I355452d6eb02a7a0ffbb20acf82ddb8ebbfa4837
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-05-16 13:04:41 +01:00
Marc Mutz bf96c45f94 QDesktopServices: clean up pre-Qt-6.6 code
Remove the code that was already commented out by
37a25fce94 for Qt versions ≥ 6.6.

Pick-to: 6.7
Change-Id: I40a3e974430add17b52307781d092bd4f58c0c35
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-05-15 18:22:39 +02:00
Hatem ElKharashy 20521c3163 Support SVG specific stroke styling properties
SVG has special properties for stroke styling. Those are usually
supported by different browsers, because SVG documents can be
used inside HTML files. This kind of styling is already supported
by QPen and all need to be done is some plumbing to save and
retrieve those values in QTextDocument when it is stored as HTML.

Change-Id: I291efab5483ac5e852d117e762e203257c64b47f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2024-05-14 21:48:12 +03:00
Tor Arne Vestbø 6c36e21bec iOS: Always call setParent during QIOSWindow construction
We rely on setParent for parenting top level windows into our desktop
manager view, so we can't condition the call on having a parent window,
like we do on other platforms.

This was a regression from 988039729f.

Fixes: QTBUG-125142
Pick-to: 6.7
Change-Id: I2884d77db09cba5371ccd77eabda7ce38c0292de
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2024-05-08 19:51:25 +02:00
Carl Schwan ab2f4ef8fa QTextDocument: Add support for responsive images
Add support for the max-width css attribute in image. This allows images
to be responsive: it adapts their size to the size of the QTextDocument
so that they never grow bigger than the QTextDocument pageSize.

This is implemented for the image handler used in QTextEdit and other
QtWidget text related classes.

[ChangeLog][QtGui][CSS] The max-width style can now be applied to
<img/> to set the maximum width in pixels or percentage.

Task-number: QTBUG-12283
Change-Id: Ic94e16279a1240ab4a509823de59dc0bfc920bb9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2024-05-07 12:28:59 -07:00
Jari Helaakoski 30cc8a28de Fix test compilation issues with QtLite configuration
Now developer build tests compile, but some are not working.
Functional fix will come later via separate tasks.

Task-number: QTBUG-122999
Change-Id: I70487b46c1b32ba4279cb02a4978e4f55ac0d310
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-06 14:29:02 +00:00
Carl Schwan 09ea47f811 Improve default style of QTextTable
Collapse the border and add some padding for the table cells.

[ChangeLog][QtGui][Text] QTextTableFormat now defaults to
collapsed tables with no spacing between cells.

Change-Id: Ibebc92820447bd5fd9c0b905261dc4426b74358c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2024-04-30 22:57:26 +02:00
Tor Arne Vestbø 0b494c47d3 Don't quit automatically via QEventLoopLocker if there are open windows
As part of df359bcb70 the semantics and
interaction between QEventLoopLocker and QGuiApplication was changed,
based on the assumption that these two mechanisms were independent
and should not affect each other.

This had a surprising regression where the use of QEventLoopLocker in
combination with the QCoreApplication::isQuitLockEnabled() automatic
quit would end up quitting the app, even if it had open windows, for
example when the last job of some internal job queue finished.

It could be argued that if the app has open windows that should not
be closed, they should ignore the Close event, and that an application
with running QEventLoopLocker jobs should maintain an active window
showing the progress of those jobs, but still, this is regression
that we want to fix.

We now bail out if !lastWindowClosed() in QGuiApplication's
canQuitAutomatically, which is triggered from QEventLoopLocker's
isQuitLockEnabled() behavior. And we do so regardless of whether
quitOnLastWindowClosed is set or not, as the latter property
determines the behavior when closing a window, not the behavior
when a QEventLoopLocker goes out of scope.

Similarly, we now block quitting of the application when triggered
by quitOnLastWindowClosed() if a QEventLoop is active, regardless of
the isQuitLockEnabled(), as the latter property is determining
whether we should trigger a quit, not whether we should block them.

[ChangeLog][Important behavior changes] Fixed a regression where
the last QEventLoopLocker going out of scope would quit the app,
even if there were open windows, if quitOnLastWindowClosed was
false.

[ChangeLog][Important behavior changes] Fixed a regression where
closing the last window would quit the app, even if there were
active QEventLoopLockers, if isQuitLockEnabled was false.

Fixes: QTBUG-124386
Pick-to: 6.7 6.5
Change-Id: I84fd0ddea78a2f417f3a17b326113c880079cf85
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-04-29 14:26:38 +00:00
Eskil Abrahamsen Blomfeldt 1593b1f6d6 Introduce optional smarter font merging with ContextFontMerging
This introduces an optional, slightly more expensive approach
to font merging which takes the full string into account,
instead of just going character by character.

This addresses the issue that you may sometimes get multiple fonts
to cover one string of text in a single language. With Chinese,
this is especially an issue because many fonts will only support
parts of the very large character set.

The new algorithm detects if the string was incompletely covered
by the font and tries the fallback fonts in order to find the best
match. This is obviously more expensive, especially if no perfect
match is found and we have to check all the fallbacks in the list,
but it is opt-in and only enabled if the ContextFontMerging flag
is set.

Task-number: QTBUG-121131
Change-Id: I8c7874d0918640bd83418e3c4726c89f43a220a3
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2024-04-26 12:30:53 +02:00
Jarkko Koivikko 6c72080f26 print: Clamp margins entered by the user in the page setup dialog
The current functionality discards all margins if any values fall
outside the minimum or maximum limits. This can confuse and
frustrate users since the Windows native page setup dialog doesn't
enforce minimum values.

Introduce a new parameter outOfBoundsPolicy for the set margins
functions in the QPageLayout:
- OutOfBoundsPolicy::Reject The old behavior rejecting out of
  bounds values.
- OutOfBoundsPolicy::Clamp The new behavior for clamping the values.

The OutOfBoundsPolicy is applied only in StandardMode to maintain
backwards compatibility in FullPageMode, where all margins are
accepted.

Use the new Clamp policy in the printsupport where the clamping is
necessary.

Maintain binary compatibility by putting the declaration of the old
symbols without policy parameter behind QT_GUI_REMOVED_SINCE, and
implement them in removed_api.cpp to call the new versions.

Task-number: QTBUG-122410
Change-Id: I06aee292c1daff2863502f471b03798dafbcd81b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-04-25 14:22:30 +03:00
Eirik Aavitsland 5f0ed0ac0d QMovie: fix regression in frame delays
The recent addition of support for multi-frame (non-animation) formats
had an unwanted side effect of sometimes calling
QImageReader::nextImageDelay() when the reader is at a different
frame than intended. Fix by effectively reverting to the previous call
pattern.

Fixes: QTBUG-124227
Pick-to: 6.7 6.5
Change-Id: I735f8d67afb17bd4c77f9b4507a71796b7d66958
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2024-04-24 15:13:12 +00:00
Allan Sandfeld Jensen 3a36f14157 Use QCOMPARE_GE/QCOMPARE_LE
It gives us more information on failures

Change-Id: I1e8e32e7f6ab3bd55201f6d15efc6b60ad7db4f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-04-19 21:09:14 +02:00
Tor Arne Vestbø 409dd9688d tst_QColorSpace::imageConversion(Adobe RGB -> Display-P3): increase tolerance
The tolerance is too low, and fails with Xcode 15 builds of Qt.

Pick-to: 6.7
Change-Id: I5755d33b052a43eb4af7ea29ec54746f73e3c42c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-04-19 17:04:25 +02:00
Tor Arne Vestbø 988039729f QWindow: Persist foreign winId to support destroy/create cycles
We used to set a private _q_foreignWinId property on QWindow when
creating foreign windows, and this was the mechanism which we then
passed the foreign winId to the platform plugin.

With c585802e94 this was removed,
since we now were passing the winId through via explicit QPA
APIs, and since 0c6911e5cd removed
the ability to explicitly destroy() a foreign window.

But when closing a QWindow, we destroy both the window itself,
and all its children, including foreign windows. In this case
we still want to support recreating the foreign window, for
example when the parent window is shown again. To enable this
we restore the _q_foreignWinId private property, but keep
the limitation of not being able to explicitly destroy a
foreign window.

Pick-to: 6.7 6.5
Fixes: QTBUG-124160
Change-Id: Ia885ba9f043e64fb21eedd2b4c344679726f1b5c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2024-04-19 14:54:17 +02:00
Eskil Abrahamsen Blomfeldt cba15d99f0 Add API to provide user-defined fallback fonts
When depending on Qt's font merging for providing glyphs for certain
languages, there are currently some drawbacks. For one, you will
typically get a system font which might not fit together with the
main font of the application.

In addition, you might get some glyphs from one font and other from
another (typically for Chinese where the character sets are so large
that fonts will often only implement parts).

And finally, you may get the wrong glyphs for writing systems with
regional differences, if your application is e.g. written in Japanese
and then run on a Chinese system, you might get Chinese versions of
characters which are shared between the languages.

Without language-based font matching in Qt, there's no silver bullet
for fixing this. This patch introduces API which makes it possible for
users to provide the solution themselves, either by selecting
application-provided fonts as fallbacks for certain scripts or by
hardcoding system fonts for a specific language.

[ChangeLog][Fonts] Added API to override default fallback font
families for specific scripts.

Task-number: QTBUG-121131
Change-Id: I23ee17b7dfe1c1e481c87cc67a05a0522841b598
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2024-04-18 15:25:23 +02:00
Santhosh Kumar 26e75d452e Support rendering CSS 'border' property for html table
We supported CSS 'border-width', 'border-style' and 'border-color'
for HTML tables since 8a9bec35fb0c60a0e5990c1a12ffe6f39fdbf2d.
Now we also support the 'border' property, which is shorthand to
set all four borders' width, style and color.

Fixes: QTBUG-123167
Pick-to: 6.7 6.6
Change-Id: I5f29b94ab9facf412a9c230d554efb5c69368b6b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2024-04-18 10:57:50 +02:00
Giuseppe D'Angelo c68f8db62b Tests: make some QFile::open calls fail
In some cases calls to QFile::open are made outside of a testfunction
(so we can't use QVERIFY), or even in standalone executables that are
executed by tests. Make them fail "visibly".

Change-Id: Iec4d56f6d874be16aa2e9ad6974eeec2a98caa3f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-13 01:36:06 +02:00
Allan Sandfeld Jensen 25c96d547b Add CMYK support to QColorSpace
[ChangeLog][QtGui][QColorSpace] Support for CMYK color spaces has been
added.

Change-Id: I2c684dbeee8b97fc90ca4e2a892349a7fa465d06
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2024-04-12 21:53:54 +02:00
Sune Vuorela 19258608e9 QFileSystemModel: Add role for fileinfo
Instead of having users traverse a ProxyModel hierarchy to
get to a QFileSystemModel to use the fileInfo(QModelIndex)
function, just let it be available with the roles.

Change-Id: I285347d1d85b4c6253fcb893737aa629a56e27fd
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-04-11 23:12:42 +01:00
Assam Boudjelthia 772fd609c6 Revert "Android: SKIP cases failing on Android 12 CI with 16GB RAM"
This partially reverts commit eb0d7b5dcf.
Leaving tst_QRhi::tessellation() skipped because it still fails.

Reason for revert: The latest emulator fixed the issue.

Fixes: QTBUG-111235
Fixes: QTBUG-111236
Task-number: QTQAINFRA-5971
Pick-to: 6.7 6.6 6.5
Change-Id: I9a624be6ba219a4175c0e84ba68d882953422cba
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2024-04-05 20:31:07 +00:00
Assam Boudjelthia 471098918d Revert "Skip Vulkan on Android in QRhi autotest"
This reverts commit 0d413506a1.

Reason for revert: Latest emulator fixed the issue.

Task-number: QTBUG-118220
Task-number: QTQAINFRA-5971
Pick-to: 6.7
Change-Id: I0d4792ef68a3ad840c8c353f55cb96d0be7cd66e
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2024-04-05 20:31:07 +00:00
Assam Boudjelthia 4244b4194c Revert "Skip QVulkan autotests on Android"
This reverts commit c6138bf9de.

Reason for revert: latest emulator version fixed the issue.

Task-number: QTBUG-118234
Task-number: QTQAINFRA-5971
Pick-to: 6.7
Change-Id: I7137851baf2b71e760af4bfab7726d761b7f59ff
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2024-04-05 20:31:06 +00:00
Allan Sandfeld Jensen 04e5b86f9e Make QColorTrcLut more flexible
Make it possible to generate one way QColorTrcLut tables, and make it
easier test out different table size,

Change-Id: I953c68d772699de87fdddbf15ce196e6ba8b9898
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2024-04-05 18:40:47 +02:00
Allan Sandfeld Jensen 05b8467304 Add color space model, making gray color spaces explicit
This also adds image conversion of both format and color space, which
will also  be required later for conversions to CMYK formats and color
spaces.

Change-Id: I578c0a010ffcdb4df4cf9080c0621fac8bc342bf
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2024-04-05 18:40:47 +02:00
Giuseppe D'Angelo 7f72a93e87 Port QImage::Format_CMYK32 to CMYK8888
Follow the established convention that byte-oriented image formats
have the "8888" suffix, not "32". The old enum name is temporarily
left to help port other submodules.

This work has been kindly sponsored by the QGIS project
(https://qgis.org/).

Change-Id: I4b6f10cb22312b614cb9cf4b0ac439907276c538
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-04-04 16:08:22 +01:00
Giuseppe D'Angelo 3fb3d95c33 Add support for CMYK file I/O in JPEG
JPEG part 6 defines CMYK support. This commit adds such support to the
JPEG plugin.

A *very* interesting discovery is the fact that Photoshop inverts the
meaning of the CMYK color channels when saving into JPEG: 0 means "full
ink", and 255 means "no ink". Most other image viewers/editors follow
the same interpretation, I imagine for compatibility.

But others, like Adobe Reader, don't (???) -- a PDF expects a DCT
encoding with 0 meaning "no ink". I am adding a SubType to the image I/O
handler to let the user choose what they want, defaulting to Photoshop
behavior.

Also, turns out that Qt was already loading CMYK files and converting
them to RGB. I don't think we should do automatic, lossy conversions (we
were not taking into account an eventual colorspace...), so I'm changing
that loading to yield a CMYK QImage.

Finally: save the colorspace, even if it's a CMYK image.

QColorSpace doesn't support anything but RGB matrix-based colorspaces.
Yet, it can load an arbitrary ICC profile, and will store it even if
it's unable to use it. We can use this fact to preserve the colorspace
embedded in CMYK images, or let users set an arbitrary ICC profile on
them through Qt APIs, and then saving the result in JPEG.
[ChangeLog][QtGui][JPEG] Added support for loading and saving of JPEG
files in 8-bit CMYK format. When loading a CMYK JPEG file, Qt used to
convert it automatically to a RGB image; now instead it's kept as-is.

This work has been kindly sponsored by the QGIS project
(https://qgis.org/).

Change-Id: Ibdbfa16aa35814f5dba28c2df89577175162b731
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-04-03 22:15:42 +01:00
Laszlo Agocs e36c1a8d84 rhi: Add support for resolving depth-stencil
Add setDepthResolveTexture(). Should work similarly to the color
attachments' resolveTexture, but for depth or depth-stencil.

However, this is another fragmented feature.

- D3D11/12:

Not supported. AFAICS multisample resolve (ResolveSubresource) is just
not supported for depth or depth-stencil formats.

- Vulkan:

Not supported with Vulkan 1.0.

Supported with Vulkan 1.1 and the two extensions.
(VK_KHR_depth_stencil_resolve which in turn requires
VK_KHR_create_renderpass2 since the 1.0 structs are not extensible, so
now need to use VkRenderPassCreateInfo2 and all the '2' structs)

In Vulkan 1.2 the above are in core, without the KHR suffix, but we
cannot just use that because our main target, the Quest 3 (Android) is
Vulkan 1.1.  So 1.2 and up is ignored for now and we always look for
the 1.1 KHR extensions.

The depth resolve filter is forced for SAMPLE_0. AVG seems to be
supported on desktop (NVIDIA) at least, but that's not guaranteed, so
would need physical device support checks. On the Quest 3 it does not
seem to be supported. And in any case, other APIs such as Metal do not
have an AVG filter mode at all, so just use SAMPLE_0 always.

- OpenGL (not ES):

Should work, both when the multisample data is a renderbuffer and a
texture. Relies on glBlitFramebuffer with filter NEAREST. What it does
internally, with regards to the depth/stencil resolve mode, is not under
our control.

- OpenGL ES:

Should work when the multisample buffer is a texture. But it will not
work when a multisample renderbuffer (setDepthStencilBuffer, not
setDepthTexture) is used because the GLES-only multisample extensions
(GL_EXT_multisampled_render_to_texture,
GL_OVR_multiview_multisampled_render_to_texture, which we prefer over
the explicit resolve-based approach) work with textures only.

- Metal:

Should work.

Task-number: QTBUG-122292
Change-Id: Ifa7ca5e1be78227bd6bd7546dde3a62f7fdbc95e
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2024-04-03 22:14:21 +02:00
Giuseppe D'Angelo 2a54229f90 GUI: add CMYK painting support
This commit adds a CMYK 8bpp format to QImage. The idea is to enable the
transport of CMYK images inside Qt, for instance to be loaded/saved from
files or painted on CMYK capable paint devices (e.g. PDF).

Also, rasterization support *from* a CMYK image is added (on top of a
RGB surface), as well as CMYK image scaling/conversion.

Conversion and rasterization between CMYK and RGB isn't particularly
optimized nor it honors any colorspaces yet. The overall idea is to
match 1:1 the existing behavior of CMYK QColor (which get naively
changed to RGB; there isn't colorspace support in QPainter yet).

There are no plans to add rasterization *towards* CMYK.

Image save/load in native CMYK formats will be added in future commits.

This work has been kindly sponsored by the QGIS project
(https://qgis.org/).

[ChangeLog][QtGui] Support for 8-bit CMYK images has been added.

Change-Id: I4b024cd4c15119c669b6ddd450418a9e425587f8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-04-03 18:31:36 +01:00
Giuseppe D'Angelo 8414a0aa2c Tests: check the output of QFile::open
Wrap the call in QVERIFY.

tst_QTextStream::read0d0d0a was also faulty as it *never* opened
the file because of a broken path. Fix it with QFINDTESTDATA.

Change-Id: I61a8f83beddf098d37fda13cb3bfb4aaa4913fc5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-27 04:24:11 +01:00
Allan Sandfeld Jensen d89063646e Add QColorSpace::isValidTarget
To indicate color spaces that can not be used as a target,
but only as a source.

Change-Id: Iae79e3533599c112872d171a2f45178029be89dc
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2024-03-27 02:13:27 +01:00
Shawn Rutledge 0281005a71 QTextMarkdownWriter: escape all backslashes
A literal backslash needs to be doubled so that the parser doesn't treat
it as escaping the following character when the markdown is read back.
In ca4774131b we tried to limit it to
backslashes that were not already escaped. In case someone really needs
a longer series of backslashes, it's more correct to escape them all;
but this comes with the risk that if they do not get un-escaped by the
markdown parser in some scenario, repeated round-trip saving and loading
could multiply them excessively. So we also add a lot of tests to try
to verify that this is safe.

Task-number: QTBUG-96051
Fixes: QTBUG-122083
Pick-to: 6.7
Change-Id: I64f610d24e99f67ebdc30d5ab5c6cf3985aec5ec
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-03-26 00:47:37 -07:00
Vladimir Belyavsky 3924c945d1 QMovie: allow only one dimension to be used for scaledSize
In 4c21f72837 we did this for
QImageReader. So, to support the same for QMovie, we just need
to remove the custom (and very inefficient) scaling for frames.
This should be safe since the underlying QImageReader must ensure
that the returned image matches the scaled size.

[ChangeLog][QtGui][QMovie] Allow only one dimension (width
or height) to be set for the scaled size. In this case, the other
will be calculated automatically based on the original movie size
and maintaining the aspect ratio.

Fixes: QTBUG-115039
Change-Id: I50979a75970c79647dbb8c8b4b121266ba033a63
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2024-03-20 00:37:24 +00:00