A file specification in PDF is a string (§3.10.1 of the PDF 1.6 spec).
As such, it needs to be properly encoded. Right now the code was
doing a naive conversion to latin1 (which was lossy), and was not
considering things like round parenthesis which need to be properly
escaped. Just use printString instead.
This work has been kindly sponsored by the QGIS project
(https://qgis.org/).
Change-Id: Icdcf8b553955d31fe2bc430dea54bb6e68221fc7
Pick-to: 6.7 6.5
Reviewed-by: Albert Astals Cid <aacid@kde.org>
The constraint requires the input time_point's duration to be
convertible to milliseconds. That's inaccurate: we need to check the
duration of the time_point we get from the clock_cast, not the input.
In general, clock_cast is allowed to return arbitrary durations, so
it may not match the input. (It indeed doesn't match for some
standard clocks, like gps_clock.)
Pick-to: 6.7
Task-number: QTBUG-125587
Change-Id: I5a93317c8cdc0a3cef4acab17c656e2e5dac5d8d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of manual formatting, use ISO 8601, which is what XMP wants.
Specifically, XMP part 1 delegates datetime formatting to
Date and Time Formats, W3C submission, September 1997
http://www.w3.org/TR/NOTE-datetime
with a note that the time zone designator need not be present
in XMP.
This work has been kindly sponsored by the QGIS project
(https://qgis.org/).
Change-Id: I0468ca21e1cfde47fabdd764af215a2af2efadae
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Most of the Part internal type (except 'number') was one of two
QAnyStringView-look-alikes originally developed for
QStringView/QLatin1StringView arg() support.
Clean it up to use QAnyStringView directly, thus taking the first step
towards UTF-8 support in QString/View::args().
While we can't encounter UTF-8 Parts with this patch, yet, adjust the
concatenation logic to deal with them already: the concatenation
code-path required by the call to visit(), and the result truncation
due to the potential overestimation of UTF-8 decoded lengths.
Task-number: QTBUG-124365
Change-Id: Idcbcbf10fa8125026115201b963877efe498a18b
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
You could get the idea that the underlying int value is indicative
of the severity. Make it more explicit that the order in the text
is the correct one, and reorder for Qt 7.
While at it, remove mentioning of Qt 5.5.
Pick-to: 6.7
Fixes: QTBUG-102347
Change-Id: I5d1b46afb37e50baa209a06c192a943980ca774b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This is meant to allow the buildsystem to add additional paths (for e.g.
QML imports) while still allowing the application to pick up the paths
where e.g. Qt's plugins are located – without having to query qtpaths or
the build system to locate them first, and to then also add them to
qt.conf.
QLibraryInfo::paths will return a list containing any values provided in
qt.conf, followed by the value that would have been provided if there
were no qt.conf file.
If no value is provided at all for a given key in qt.conf,
QLibraryInfo::path will behave as if no qt.conf file was provided,
instead of using LocationInfo::defaultValue.
For now, this is considered to be internal only, and won't be
documented.
Change-Id: Ic74c66b5cbde605b43336cd88c3f909999381f46
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QMimeData::retrieveData() checks whether the returned QVariant value is
valid, i.e. the variant contains some data. If the variant contains an
empty QByteArray, it will be considered valid.
So retrieveData_sys() should return QVariant() in case data with the
specified mime type cannot be retrieved.
Fixes: QTBUG-125531
Pick-to: 6.7 6.5 6.2 5.15
Change-Id: I0a668ca7ad5b2c5430335e8554cc597747287173
Reviewed-by: Liang Qi <liang.qi@qt.io>
Users had eight Qt releases to adjust their code, remove the opt-out
now.
[ChangeLog][QtCore][QChar] Removed the QT_IMPLICIT_QCHAR_CONSTRUCTION
opt-in. The respective QChar constructors (`(int)`, `(uint)`,
`(uchar)`, `(uchar, uchar)`) are now always explicit.
Change-Id: I2cca1f98d486840f9e6bcd6c07678f0dd81832e5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Cleanup QIcon:
- factor out actualSize() calculation
- factor out deleting invalid pixmap entry
- don't overflow on int*int calculation
- use quint8 for state and mode in cacheKey calculation
- sync cacheKey calculation
- make QIconPrivate::pixmapDevicePixelRatio() static
Change-Id: I7716b6f69687b6e5c910a0cb180b32b2de9a015d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Remove all \since 4.x comments in gui/image - this is no longer of
interest.
Change-Id: Ic2d7252293f1951fb202ea907999301581671081
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Inkamari Harjula <inkamari.harjula@qt.io>
Found by ubsan: if rhs is nullptr, then we fed a nullptr as the second
argument of memcmp(), which is UB.
Fix by catching an empty rhs before we reach that line.
Amends e52d50a03d (which, despite
pick-to's to the contrary, never made it into 6.2 or 5.15).
Change b977ae371a fixed this for
UTF-8/UTF-8 comparison from 6.5 on, but 6.4 ad 6.3 remain vulnerable
there, but they're closed, so can't be fixed anymore.
Pick-to: 6.7 6.5
Change-Id: I12fa986aa82a7440a9d53fad19a15e9420233e0b
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
setFloating() called on the 2nd last dock widget in a floating tab
didn't cause reparenting to the main window. The dock widget remained
parented to a QDockWidgetGroupWindow, while no longer being part of
floating tabs. The QDockWidgetGroupWindow would therefore have only
one tab, which is an inconsistent state and causes crashes.
Factor out the implementation of setFloating() to a new
QDockWidgetPrivate::setFloating(). Reparent to the main window, if
the dock widget is part of floating tabs.
Add test functionality in tst_QDockWidget::setFloating().
Turn createFloatingTabs() into a macro, in order to QSKIP() in the test
function's scope.
Fixes: QTBUG-122394
Pick-to: 6.7 6.5
Change-Id: I3719785f310b131446cdea908f09b7195c992b3e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Since we don't have any API to specify trapping info, mark
the document as untrapped. (PDF/X-4 requires the entry, and
requires it to be true or false. The default would be "unknown"
but that's not allowed by X-4.)
This work has been kindly sponsored by the QGIS project
(https://qgis.org/).
Change-Id: Id8c3a4356ba5bb74877473549e55ccbb6839b07e
Reviewed-by: Albert Astals Cid <aacid@kde.org>
They're content-equivalent, except that the latter doesn't have to
allocate a return value on the heap.
Pick-to: 6.7
Change-Id: Ifcae47b487c80c2bac02900f08393b386cfe806c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
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>
... because it is. It's also convenient for tests.
Change-Id: I1b9e21763f62c446890ddd5970df25fcae9484b7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
QLibraryInfo::path only allows a single value, however, at least for
QmlImportsPath we would benefit from having more than one to ease
deployment (note that this is unrelated to Qml2ImportsPath which was
necessary to support QML 1 and 2 in a single Qt install).
Users inside Qt will ported in follow-up patches where it makes sense.
[ChangeLog][QLibraryInfo] qt.conf now allows providing mutliple paths,
and QLibraryInfo has a new paths method to fetch all of them.
Task-number: QTBUG-124009
Change-Id: I78b3bcfa94c8d975dbd789f6826cda4fc5e60403
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This patch enables the handling of spatialEvents from SwiftUI. Since
these events do not have ObjectiveC structs, for now we serialize them
to JSON and pass them to Qt for usage later in Spatial applications.
These events just cover the built-in gestures like pinch "clicking"
etc.
Change-Id: I8368683259eb64277083cf345ca3a5ed9af32ecf
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
As part of d8bbb5ee0e the order of
QDialog::accepted/rejected and QDialog::finished was changed so
that the latter came last. This has been the behavior now for
the entire Qt 6 series.
QPrintDialog didn't pick up on this new behavior, and was emitting
the QPrintDialog::accepted(QPrinter*) signal after calling the
dialog's done() method, which resulted in emitting finished before
the QPrintDialog printer-specific accepted signal. Clients such as
the textedit example, who would "clean up" in finished() would then
crash when processing the accepted signal.
We now emit QPrintDialog::accepted(QPrinter*) at the same time as
the dialog's accepted signal. The natural place to do this would be
the QPrintDialog constructor, but that's spread out and duplicated
between all the platform specific print dialog implementations, so
we do it via a single shot connect instead in QPrintDialog::done.
[ChangeLog[Print support] QPrintDialog::accepted(QPrinter*) is now
emitted before QDialog::finished, in line with QDialog::accepted.
Pick-to: 6.7 6.5
Change-Id: Idade32b667bdf7b81845025b8d83f08a551d32bb
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
When we use GetWindowPlacement, the showCmd parameter will NOT be
SW_HIDE, even if the window is hidden. To prevent showing a hidden window
with SetWindowPlacement, change showCmd if the window is currently hidden.
Amends 21e4116874
Fixes: QTBUG-120415
Pick-to: 6.7
Change-Id: Ib7de369a6d1a530fdeb5ff930097ae06e25761f3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Zhao Yuhang <yuhangzhao@deepin.org>
Commit c4f7dba81e reworked the C++20
QDate constructors and introduced a helper stdSysDaysToJulianDay()
method. However, the QT_POST_CXX17_API_IN_EXPORTED_CLASS was not used
on this new helper function.
As a result, an application which is built with C++20 but uses a
pre-built QtCore that is built with C++17 cannot call QDate constructors
with the new std::chorono types.
An obvious fix is to add the missing macro to the function.
However, we cannot do it directly, because the function is exported
in C++20 builds, and adding the macro will unexport it.
Use QT6_{DECL,CALL}_NEW_OVERLOAD_TAIL macros to add a new overload of
the stdSysDaysToJulianDay() function and mark it as
QT_POST_CXX17_API_IN_EXPORTED_CLASS.
Keep the old function under the QT_VERSION < Qt 7 check to keep BC.
Amends c4f7dba81e.
Fixes: QTBUG-125610
Pick-to: 6.7
Change-Id: I999354da51ee58c3691dbc1c0351be15a18a268b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Drag-dropping and image from for example photoshop didn't work in Qt6
due to a (probably?) copy paste error in the commit
8fa91c75ad
Pick-to: 6.7 6.5
Change-Id: I18dedc09596fe590e915e3aa526131f2d6957d8b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
... to avoid coloring mismatch in the generated doc page
of the tool.
Change-Id: I4334d49632c5f119a874e9112d4f13cd4d60e27a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Make classes that don't need to be public as package private
* Remove dead code that serves no purpose now.
* Use lambdas when needed.
* Use @UsedFromNativeCode for methods called from native code.
Change-Id: Ie34eec079366fb3ef048e0f49e03f507cdf90e97
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
MSVC compilers that could use both branches ended up
using one branch for some things and another branch for
other things, which didn't mix and caused build failures.
And in the header the #include was inside the Qt namespace
and caused internal build errors during parse.
Amends 9d693dbfb1
Change-Id: I1a77abe1fefd21ea3256f5b2d5a55998257762e5
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
clang's fallthrough detection is a little stricter than gcc.
Pick-to: 6.7
Change-Id: If1052275f035a8e8a496cc5a40a21137d18712e3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This work has been kindly sponsored by the QGIS project
(https://qgis.org/).
Change-Id: I9e1c26749579d645699a180dac88a00e8653ed65
Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com>
Reviewed-by: Albert Astals Cid <aacid@kde.org>
Implement partial support for SQL_INT128 datatype which is used for
DECIMAL/NUMERIC columns with a precision > 18. This support is only
available when QT_SUPPORTS_INT128 is defined and for MSVC.
Binding values to columns which need SQL_INT128 is supported but
numbers given as QString will be converted to doubles even if
QSql::HighPrecision is set.
[ChangeLog][SQL][IBASE] Added support for SQL_INT128 datatype.
Task-number: QTBUG-124575
Change-Id: If3fb1eb0f19dc60f000d163f3bf45da7acb08c87
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andreas Bacher <andi.bacher@outlook.com>
The old behavior was that calling begin() calls
QDirListingPrivate::advance(), if you call begin() again, it would call
advance() a second time. Not the most intuitive of APIs, but it wasn't
any worse/different from QDirIterator Java-style hasNext()/next() (if
you call next() twice, you advance twice).
Now (c)begin() always starts iterating from the very beginning.
Amends c39a0d1e89
pushDirectory(initialEntryInfo) is now called from beginIterating(), so
don't call it in init().
Not using a std::stack because beginIterating() needs to clear the
iterator containers; for some reason on INTEGRITY something like this
won't work (std::stack doesn't have clear()), complaining about the
constructor being explicit:
nativeIterators = {};
The above works just fine on Linux, so instead of having to spell out
the type... just use std::vector directly (back(), pop_back() and
clear()); this is private API so we have full constrol on how the
vectors are used.
Change-Id: Iaaa849f989b2724bf070730f6273263289dd4d9c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
clear() will shed any stored capacity, so that's a waste for the few
people who actually use setNum(). The majority use it from number(), in
which case the clear() is superfluous anyway.
And append() does an extra strlen() check, which we don't need.
This considerably reduces the size of both QByteArray::setNum() in a GCC
LTO build (though the compiler chose to not inline assign()). Moreover,
it now does inline setNum() in the number() functions and in a lot more
places (searching for "qulltoa2" in the disassembly finds it in
QFileSystemEngine::id, for example).
Change-Id: If3345151ddf84c43a4f1fffd17d28f2fc79aa072
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Mårten made this code ready for QByteArray in commits
e5e8e4f59b and
5d0542a356, but never actually made
QByteArray use it.
The simplest change of moving qulltoa2() is sufficient, instead of
moving the template to the header and using it in qbytearray.cpp.
qulltoa2() is called in three places and we don't want the compiler to
inline the function there, so having the function in a separate TU
accomplishes that for us. GCC won't inline it in LTO builds either.
Change-Id: If3345151ddf84c43a4f1fffd17d28682445fbdaa
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This prevents e.g. gtk3 platformtheme from hanging.
Pick-to: 6.7
Change-Id: I68593ad54fa5530366d590309c10621e5a48bd22
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
It is available in POSIX.1-2008 but is not worth it. The Linux man page
says it only works up to PATH_MAX anyway and the POSIX documentation
says it's UB if PATH_MAX isn't defined.
This cleans up the source code out of these messy #if and should be
faster, because we avoid a heap allocation (stack is always faster).
Instead, we only relegate the heap version to the case where PATH_MAX
isn't defined (i.e., GNU HURD), because in that case the realpath()
function can't be used with a stack allocation.
Pick-to: 6.7
Change-Id: Ie30a3caf09ef4176bb36fffd17cde1ed5c5dad59
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
[ChangeLog][QtNetwork][QNetworkAccessManager] QNetworkAccessManager now
supports using full local server name, as in, named pipes on Windows or path to
socket objects on Unix.
Task-number: QTBUG-102855
Change-Id: Ifc743f5025b3d8d0b558ecffff437881897915d9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
As the classes do not use the common naming pattern, qdoc suggested
some weird non-existend includes when generating the docs for these
classes.
Explicitly use the \inheaderfile qdoc command to point to a proper
include.
Amends bdd41f491c.
Pick-to: 6.7
Change-Id: Ia721658df38f1006fdc2fa1de1fab7eb381ceb0b
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Decided to keep the strong_ordering semantics, as user code is very
much guaranteed to rely on it.
Update the docs.
[ChangeLog][Potentially Source-Incompatible Changes] Made several
operators (relational, QDebug streaming, etc) hidden friends. This may
break code that calls these operators a) with types that require
implicit conversion on the arguments, or b) using member-function
syntax (lhs.operator<(rhs)). The backwards-compatible fix for (a) is
to make at least one of the argument's implicit conversions
explicit. For (b), use infix notation (lhs < rhs).
[ChangeLog][EDITORIAL] Replace all "Potentially Source-Incompatible
Changes" items that mention making operators hidden friends with the
catch-all one from the QPersistentModelIndex change.
Fixes: QTBUG-117660
Change-Id: I8175af5e2cb3c77e7486e972630b9410b3a0896c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Use Milian's asTuple() trick and compareThreeWayMulti().
The pointer variable presents a challenge, because, like op<, op<=>
cannot order unrelated pointer values. Trying to is UB; one is
supposed to use std::less and std::compare_three_way instead, but, you
guessed it, less<tuple<T*>> uses op< to compare the tuples, which, in
turn uses op< on the T* member, causing UB.
[ChangeLog][QtCore][QtCompare] Added a Qt::totally_ordered_wrapper
class whose relational operators use the std ordering types. Use
it to wrap the pointers when doing the comparison to avoid UB.
This allows a smooth migration once we depend on C++20 and class
authors start using lhs.asTuple() <=> rhs.asTuple() or even start
to =default op<=>. The wrapper type is robust against all these
transformations.
Update QModelIndex comparison documentation part.
Task-number: QTBUG-117660
Change-Id: I126b2ebff458800134ed6e774a389d85d76a395f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
I'm not 100% sure we still support WebKit, still leave a note.
This work has been kindly sponsored by the QGIS project
(https://qgis.org/).
Change-Id: I45d4351fd4a106763f26685a5510ed630d752745
Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
- CHECK name is too common, it turns out webengine uses it
widely
Amends ef964c254c.
Fixes: QTBUG-125627
Change-Id: I53d90621c09c0f50b7bea910875192bc49095987
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
The word "main" here is confusing. use "most recently started" instead.
Fixes: QTBUG-86203
Pick-to: 6.2 6.5 6.7
Change-Id: I3fd4e49204fac8a2f97cdfc57d5f7901fa7b96a6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
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>
Updated Gradle to 8.7
Updated AGP to 8.4.0
Updated same versions in examples and docs macros
Task-number: QTBUG-113383
Change-Id: Ib2e841f2e57e576c5d689a208a275ce5e9e4b80f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>