These are no longer in use in Qt.
Pick-to: 6.6
Change-Id: Id07bc0e09a414754493562d3a48df55cc28c5049
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Availability.h from the platform SDK should take care of this these
days.
Pick-to: 6.6
Change-Id: I23dd821682db66a1f22b1240d485f4a9cc877cd8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When enabling the logs, printing hdrInfo() to qDebug
in Qt Quick is something that is done before calling
createOrResize() on the swapchain. (logically since
this is still at the point of configuring the swapchain
settings)
Thus the correct thing to do is to only access m_window,
not the backend data's window.
Pick-to: 6.6 6.5
Change-Id: I3004b0c4a4fdb09cb07a9c0e3c503f79c699c562
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
To stay compatible what the OpenGL-based code did before Qt 6.4.
Pick-to: 6.6 6.5
Fixes: QTBUG-113811
Change-Id: I80d89b21dcace9b5c361b964d56f29e996940c24
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
...for Qt 5 compatibility. It seems both Qt Gui and Quick calls
the QOpenGLFramebufferObject helper for blitFramebuffer with
the default GL_NEAREST argument for the filtering. In Qt 6 we
must use the same if we want to ensure pixel-perfect compatibility.
Pick-to: 6.6 6.5
Task-number: QTBUG-113811
Change-Id: I03c69448265e7b0d73f021d71135a1725e96fcbc
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
We override the old encoding because it wasn't UTF-8, then we use a
fresh call to nl_langinfo(CODESET) when reporting the encoding that
"is not UTF-8", except that we've just fixed that so it is now.
Store the old encoding in a std::string before we change it, so that
we can report what it was rather than what we changed it to.
Amends commit 3690c202f9
Pick-to: 6.5 6.6
Task-number: QTBUG-113371
Change-Id: I5f7c3648890cb0abf1d4769af24715686762c176
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The system locale backend on macOS uses system APIs to format dates
and times in localized ways. Those system APIs appear to know more
about time zones than the time_t functions (which artificially cut off
before 1900) are willing to tell us. As a result, QDateTime is left to
guess the offsets in use before 1900 but the locale-formatting takes a
correct offset into account, which can lead to QDateTime and the
locale-aware APIs using different offsets. This is further compounded
by the system APIs taking into account the calendar transition from
Julian to Gregorian. We can't do much about the latter.
Previously we were formatting dates by passing the start of the day to
the system APIs (which take a date-time, albeit using a "Date" name
for the type), along with a date-format that ignores the time of day.
For dates before 1900, if the system APIs know the offset in use was
less than that in use in the early 1900s, QDateTime (using the latter)
gets the start of the day slightly earlier than where the system APIs
know it is, so the day before is the date at that time. Use noon on
the day in question to avoid this problem, at least for zones that
didn't do whole day offset-shifts (crossing the date line) before
1900. Document the problem and the limited extent to which we can
solve it.
Task-number: QTBUG-54955
Pick-to: 6.6 6.5 6.2
Change-Id: I5be1bfdb3013433ee248846533ef73af39f173f5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
I believe the problem is that QGlobalStatic::operator Type *() may
return a null pointer, in which case the compiler is right that we could
attempt to free the shared_null. Instead use QGlobalStatic::operator*,
which doesn't ever return nullptr.
Change-Id: I9201d9ecf52f4146bb04fffd17644782bf0eb9d1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
There are cases where this eye dropper control is useful and other
cases where it is useless. In case of an application connected with
graphics it's useful because it allows to select a precise color in
a very simple way. But in the case of a simple app where the user
only has to choose a color for, example, a graph this control is
useless and risks confusing the user (this kind of control is only
present in graphics software, not all "normal" users know what it
is for or understand its use). This patch add a flag to hide the
button.
As a drive-by change, the internal screenColorPickerButton pointer
is renamed to eyeDropperButton to be more consistent with the
qml ColorDialog.
[ChangeLog][QtWidgets][QColorDialog] Added a NoEyeDropperButton
option to hide the eye dropper button.
Change-Id: Ib29d5343383af97c1f488f9e33749517181aead7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
If an application sets the current index and resizes the tab widget
before showing it, then the scroll offset might be calculated based on
an old size. Since after ca15f650a1,
resizing explicitly avoids scrolling, this could result in tabs ending
up scrolled outside of the tab bar when showing the tab widget.
Fix that by explicitly making the current tab visible in the tab bar's
showEvent handler, which recalculates the scroll offset based on the
actual size.
This is only reproducible with a tab widget, which lays out the tab bar
for each change and resets the tab bar's layoutDirty flag. Add a test
case there.
Pick-to: 6.5 6.6
Fixes: QTBUG-114204
Change-Id: I1e9506b9dde1dd892291d108dd2c7b675ef99509
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Jonas Kvinge <jonas@jkvinge.net>
If I'm not mistaken we would like to leave this to Xcode, if so, we can
use `$()` to make our intention more clear in the code.
Pick-to: 6.5 6.6
Change-Id: I3867f68f371a1cf1a5db5e639ec740f2546ccd75
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Remove the local __PPS target and make PPS::PPS itself the
imported target. This is not only simpler, but also hopefully resolves
an issue with static builds, where PPS::PPS was not properly promoted
to a global target, leading to linker errors.
Fixes: QTBUG-108794
Pick-to: 6.5 6.6
Change-Id: Ia9334a27312ba9bfeec964f6bd6a82652e5f9d37
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Instead of holding three QPointF's in a QPolygonF, which will allocate
them on the heap, use QVarLengthArray<>, which will allocate them on
the stack instead.
Pick-to: 6.6 6.5
Task-numbber: QTBUG-112200
Change-Id: If078e5a9a5cb82fd03b511e28cceb88bd42996f8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Instead of passing a QLatin1StringView to QStyleHelper::uniqueName(),
which takes a QString, allocating, and then using QStringBuilder to
append something to the result of uniqueHelper(), allocating again,
pull the appends to before the call to uniqueName(), folding these two
allocations into one.
Pick-to: 6.6 6.5
Task-number: QTBUG-112200
Change-Id: I501dd4a3df4b9f5267ca931b550d521f4dafe493
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
QPixmapCache maintains a mapping from QString to QPixmapCache::Key, in
the form of the cacheKeys QHash, but QPixmapCache::clear() didn't
touch it, leading to the string data (as well as the Keys) being
retained after any possible use. This can lead to memory slowly being
eaten up, as reported in QTBUG-112200, and prevents a periodic calling
of QPixmapCache::clear() from being a work-around for the issue in the
bug report.
Fix by clearing cacheKeys in QPixmapCache::clear().
This is designed as a low-risk enabler of a work-around, not a fix for
the issue. The work-around enabled by this is periodic calling of
QPixmapCache::clear().
[ChangeLog][QtGui][QPixmapCache] Fixed QString key data not being
freed on clear().
Pick-to: 6.6 6.5 6.2 5.15
Task-number: QTBUG-112200
Change-Id: Ica6fa0e27e1b47b8df58d5e996378a2ececa5f9c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Check for the new "fontweight" attribute before "bold".
Pick-to: 6.6 6.5
Task-number: QTBUG-113670
Change-Id: Ib34ab5a19872adb3c063861ffbe6b2d3374afcaa
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
The VK_KHR_surface is not need if we not using QRhiSwapChain, such as
using QQuickRenderControl on QtQuick, it's using "beginOffscreenFrame"
without QRhiSwapChain.
It's useful if you using a custom VkInstance to QVulkanInstance, and the
VkInstance is not create by other library and isn't enable the
VK_KHR_surface extension.
Pick-to: 6.6 6.5
Change-Id: I7623630adea9c933f38c180d4d73044b0e88f5b8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
If the TEST_ld_version_script configure test fails with GCC or Clang,
then we still added qversiontagging.cpp, and linking failed.
Use the result of the configure test to decide whether to add
qversiontagging.cpp or not.
Task-number: QTBUG-111514
Change-Id: Id09e372a7a1e5cdbe59987be4481f64c6c45251e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
This reverts commit 3c6c3eccd1.
Reason for revert: They do appear to be needed, and removing them
changes behavior: QTBUG-114206
Pick-to: 6.6
Fixes: QTBUG-114206
Task-number: QTBUG-114238
Change-Id: Iac75bbc1ef14fe89f4282bd58fe996f9a09b8506
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Parts of the public API, e.g. QMetaMethod::methodIndex and similar
functions return int, and other parts of the code expect int values, at
least for Qt6 this can't be changed, so use qsizetype internally and
assert the values fit in an int.
As pointed out in code review, not many people will build moc in debug
mode, so asserts aren't that useful here. Instead print error messages
and exit, like is already done in other parts of the code.
Change-Id: Id305165caa996c899f30770a757098fe2f9a96f6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This way the Generator can use e.g. Parser::error() to print error
messages (which will happen in a later commit).
Change-Id: Id710d7b604a82ce6bb61999addad8c95c53e3226
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Assert generator.strings.size() < INT_MAX after all strings have been
registered.
Parts of the public API, e.g. QMetaMethod::methodIndex and similar
functions return int, and other parts of the code expect int values, at
least for Qt6 this can't be changed, so use qsizetype internally and
assert the values fit in an int.
Change-Id: Ib226e9c19a578bbeaeb9bb767d756a9569fe57b3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If we don't have a valid Symbol to get a line number from, or if the
symbol.lineNum is -1, print a shorter message containing only the file
path. Printing: '/path/to/file👎1' isn't useful (and looks wrong).
Change error/defaultErrorMsg/warning/note() to delegate to one central
method, so that they all behave the same; e.g. previously warning() and
note(), guarded against printing "-1" for the line number, whereas
error() didn't.
This also makes it possible to use error() for reporting other issues
(e.g. the size of generator.strings list exceeding INT_MAX, which will
happen in a later commit).
Pick-to: 6.6
Change-Id: Iddc96e08315fae415be6a84928f845d7bceb4c5f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
If QT_MOC_HAS_STRINGDATA isn't defined, just put an '#error' directive
in the generated code.
Since the proposal of doing ±4 versions of tool compatibility hasn't
been adopted, just remove the fallback string code. Requested by Thiago
in code review.
Drive-by changes:
- Use "STRINGDATA" in comments too
- Remove a now unused static helper
Change-Id: I6dbdf427b7219b8b32076a9e0a41799c0a476ff9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Whatever issue used to be present in the CI no longer is. That doesn't
mean the problem went away; Ubuntu 20.04 is probably still shipping a
broken compiler with bad codegen, but this isn't the first issue.
Change-Id: I9201d9ecf52f4146bb04fffd1764673c94ee8955
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This is a minimal version of qtloader. The load function accepts
the same arguments as emscripten runtime with a few additions:
- qt.environment
- qt.onExit
- qt.containerElements
- qt.fontDpi
- qt.onLoaded
- qt.entryFunction
State handling has been removed in favor of making the load async
(assume loading when the promise is live).
Public APIs getting crashed status, exit text and code have been
refactored into the new qt.onExit event fed to load. No need for
keeping the state in the loader.
The loader is integration-tested. A test module with test APIs
has been created as a test harness.
The runtime APIs exposed by Qt (font dpi and screen API) are handled
by the qtloader seamlessly.
Change-Id: Iaee65702667da0349a475feae6b83244d966d98d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
- Fix narrowing conversion warnings
- Don't use an out of bounds index with QStringView::mid(), which
happened when view.size() was used as an index
- Use sliced()
Change-Id: Ia9bf62887ffb6ddd2458c9e46d33e8cfe0ee2b66
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use QVLA since buf is no techincally a var-length-array.
Change-Id: I334cf2d1f9ef162495ed223a8e48e1b8e674afc0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Split the getpwnam* related code to a separate helper; this makes the
code more readable.
Change-Id: Ia7c6b6f7801d88b6b3a8809e973ede6c58e89923
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
And using qsizetype in some places.
::pathconf() returns long.
Found by using -Wshorten-64-to-32 clang compiler flag, or adding that
flag to the flags clangd uses.
Change-Id: I9f9abd3d4d6fe73f525eec869ceabc799317f3d6
Pick-to: 6.6 6.5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Using:
- range-for and iterator-based loops
- QList constructor that takes a pair of iterators
Found by using -Wshorten-64-to-32 clang compiler flag, or adding that
flag to the flags clangd uses, e.g. adding this to clangd's config file
(see https://clangd.llvm.org/config):
CompileFlags:
Add: [-Wshorten-64-to-32]
Pick-to: 6.6 6.5
Change-Id: I13ae65e09ab59a59f9e5c189ea27e4e16527df2d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This is needed by static analysis tools (which compile each header on
its own, IIUC), e.g. clang-tidy:
src/widgets/itemviews/qtableview_p.h:99:22: error: unknown type name
'QTableView' [clang-diagnostic-error].
Q_DECLARE_PUBLIC(QTableView)
^
Change-Id: I84a1221469e9a78f243cc892ef7c60da9b515718
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
User projects that use qt_add_qml_module faced unnecessary rebuilds when
using the Unix Makefiles or Visual Studio project generators.
The bug was in qt6_extract_metatypes. For the mentioned generators (and
CMake 3.16 in general), we detect that CMake's AUTOMOC does not generate
a dep file, and we use a custom target to trigger cmake_automoc_parser.
That custom target runs always.
Later, we call moc to generate meta_types/foo_metatypes.json.gen. To not
trigger a rebuild of its dependents on every build, we use
copy_if_different to generate meta_types/foo_metatypes.json only if the
content changed.
The custom command for that had two outputs:
add_custom_command(
OUTPUT
${metatypes_file_gen}
${metatypes_file}
...
)
The Unix Makefile generator and the Visual Studio generator (and
potentiall others) interpret this as "all outputs are always changed by
this command". The Unix Makefile generator even ensures that by creating
an additional foo_metatypes.json target that touches the file. In the
generated Visual Studio project, the dependents of foo_metatypes.json
are out of date even if the actual file has an old timestamp.
In projects with QML modules, the QML type registration depends on this
file. This caused a near full rebuild of the affected QML modules.
We must mark foo_metatypes.json as byproduct of the command to specify
that it is a file "whose modification time may or may not be newer than
the dependencies".
Unfortunately, there's CMake upstream issue #19005. There's a dependency
missing between the consuming target and the byproduct. We must work
around this issue with an additional custom command with OUTPUT
${metatypes_file}.
Pick-to: 6.5
Fixes: QTBUG-106683
Change-Id: Icc2f7227c3e7b523631c1f361e29e26ae4efc46c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
When a block is drawn in a text document, drawBlock is checking,
whether the block has a BackgroundBrush property defined. If none is
defined, the color used to draw lines around the block defaults to
QPalette::Dark. This was implemented, assuming a light color scheme.
In a dark color scheme, the lines become hardly or even not visible.
This patch changes the default to Inactive/WindowText of the underlying
QPalette. This provides contrast to the document's text content and
is dark/light sensitive.
Fixes: QTBUG-113990
Pick-to: 6.5
Change-Id: Ie855852f441a0efb11c318c7edb27395151cbcce
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Implemented assign() methods for QString to align with the
criteria of std::basic_string, addressing the previously missing
functionality. This is a subset of the overloads provided by the
standard.
Reference:
https://en.cppreference.com/w/cpp/string/basic_string/assign
The assign(it, it) overload is a bit more complicated and will be
added in follow-up patches.
[ChangeLog][QtCore][QString] Added assign().
Task-number: QTBUG-106198
Change-Id: Ia1481d184865f46db872cf94c266fef83b962351
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
More and more code in Qt uses char16_t instead of QChar, even
QString::Data, so reduce the impedance mismatch with such code and
supply a char16_t overload in parallel to the existing QChar* one.
[ChangeLog][QtCore][QStringDecoder] Added appendToBuffer() overload for
char16_t*, complementing the existing overload taking QChar*.
Task-number: QTBUG-106198
Change-Id: I0cb8ab22c897c14b1318a676f5212cc0cf1b72b7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Keeps all the special cases in a central place and will help with
adding an rvalue overload of fromValue() for 6.6.
Change-Id: I14f12bb98a2e2f4edfcec8ce39660643e23c1d07
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Avoid decoding multiple times the domain name when it comes in
sequence. This happens when a given domain label either has multiple
entries in its record set or when it's a CNAME (or both), such as in:
;; ANSWER SECTION:
cname-cname.test.qt-project.org. 3600 IN CNAME cname.test.qt-project.org.
cname.test.qt-project.org. 1614 IN CNAME multi.test.qt-project.org.
multi.test.qt-project.org. 1614 IN A 198.51.100.2
multi.test.qt-project.org. 1614 IN A 198.51.100.3
multi.test.qt-project.org. 1614 IN A 198.51.100.1
Label targets from other records such as MX and SRV usually do show up
again, in the Additional section, but the chance that they are
sequential isn't very good, so we don't cache those.
;; ANSWER SECTION:
mx-multi.test.qt-project.org. 3354 IN MX 10 multi.test.qt-project.org.
mx-multi.test.qt-project.org. 3354 IN MX 20 a-single.test.qt-project.org.
;; ADDITIONAL SECTION:
multi.test.qt-project.org. 1145 IN A 198.51.100.3
multi.test.qt-project.org. 1145 IN A 198.51.100.1
multi.test.qt-project.org. 1145 IN A 198.51.100.2
a-single.test.qt-project.org. 3364 IN A 192.0.2.1
Change-Id: I5f7f427ded124479baa6fffd175f5cf88939ee73
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
[ChangeLog][QtNetwork][QDnsLookup] It is now possible to look up the
root DNS domain, by setting the name property to an empty string. This
query is usually done while setting the query type to NS.
Change-Id: I5f7f427ded124479baa6fffd175f688395941610
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>