Commit Graph

61714 Commits

Author SHA1 Message Date
Amir Masoud Abdol
48014f99dc Remove an unused variable
Pick-to: 6.5 6.6
Task-number: QTBUG-109394
Change-Id: Ib1099e3d4091b0b222e405ce25b5e680f0514476
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-06-07 23:18:04 +00:00
Amir Masoud Abdol
b738ad7e3a Fix an issue with processing -prefix paths ending with \ on Windows
In cases like `C:\` or `C:\D\E F G\`, we had the issue were Windows'
path separator was acting as an escape and was corrupting configure
arguments', so, we were ending up with `-DCMAKE_INSTALL_PREFIX=C`, or
were cutting the argument list short, and ended up ignoring some of the
arguments.

Pick-to: 6.5 6.6
Change-Id: I433af61d5c143cc37a64dcf8ac82a1a78ce543a5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-08 01:18:04 +02:00
Amir Masoud Abdol
958c12273a Add Unity Build to config.summary
Unity Build was missing from the `config.summary`. This fixes that.

Pick-to: 6.5 6.6
Task-number: QTBUG-109394
Change-Id: Icd9898956ec1a5332297272130bce27d4d2675ca
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-06-07 23:18:03 +00:00
Marc Mutz
f5ed163c19 QString: add STL-style assign() [2/4]: (it,it) overload for QChar-convertible *it
Restrict the permissible value_types to those QStringView can take,
plus QLatin1Char. All of these implicitly convert to QChar and give
the correct result, even when converted char-by-char.

Task-number: QTBUG-106198
Pick-to: 6.6
Change-Id: Icb44244cb08af391161c4309467d4e0d2d3d3d62
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2023-06-07 23:18:03 +00:00
Timothée Keller
245c2b621f Windows QPA: Fix restore geometry after dragging from maximised - Fix
Small adjustment made to previous patch to fix the following issues:
- restoreGeometry not being updated after moving the window from one
screen to the other with keyboard shortcuts.
- restoreGeometry's size not being changed when moving screens if
WM_GETDPISCALEDSIZE isn't sent.

Pick-to: 6.6 6.5
Task-number: QTBUG-112814
Change-Id: I9dd2340137ce57a731f8881d476e902323887e62
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-06-07 21:41:55 +00:00
Timothée Keller
f4d6d04898 Windows QPA: Change monitor index detection
Monitor index detection changed from comparing deviceNames to comparing
serialNumbers, to prevent the case where two monitors with identical
names might overwrite one another.

Fixes: QTBUG-112829
Pick-to: 6.6 6.5
Change-Id: Ibfad08e178774396c4b347acfcfbdb83ed4fe332
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-06-07 17:31:19 +00:00
Axel Spoerl
c153066baa QDockWidget: Propagate window title when re-docking
When a floating dockwidget's title changes, it is rendered as a
window title. When the title changes while floating, the change will be
reverted to the pre-change title when the dockwidget is docked again.

This patch explicitly propagates the window title, if it has been
programmatically changed while the dock widget is floating.

It adds test functionality in tst_QDockWidget::floatingTabs().

Fixes: QTBUG-113591
Pick-to: 6.6 6.5
Change-Id: I96fa69fb27ad1a85f4ea9ce44c0a22290259fca6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-07 18:46:56 +02:00
Sze Howe Koh
5a2474b2dd Doc: Clarify how to use QPainter with QTextEdit
The documentation suggests that it is possible to reimplement
QTextEdit::paintEvent(), but doing so might produce cryptic runtime
warnings:

    QWidget::paintEngine: Should no longer be called
    QPainter::begin: Paint device returned engine == 0, type: 1

The correct way to reimplement this function is noted under
QAbstractScrollArea::paintEvent(). This patch updates the note and
copies it to QTextEdit for clarity.

Pick-to: 6.6 6.5 6.2
Change-Id: Ib7d8dadeb2358475bcdb0b2e624857700f9a004e
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-07 16:46:56 +00:00
Laszlo Agocs
526744ba65 rhi: vulkan: Fix swapchain format check
Fix the treatment of the sRGB flag. That is independent from the value
of format(), and should be checked regardless of wanting a HDR swapchain
or not. On Android for instance Display P3 with RGBA8 or RGBA8_SRGB is
one of the formats offered. While we do not support this right now,
it is an example of a "HDR" format that still uses a color buffer
format where a dedicated sRGB format is available and must be
chosen according to the specified swapchain flags.

Pick-to: 6.6
Change-Id: I2d97689fa5af7c08486702ae690f2230d06db469
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-06-07 14:42:58 +02:00
Laszlo Agocs
dc341ea284 rhi: d3d12: Fix swapchain format check
Pick-to: 6.6
Change-Id: Ie2c19ce0aa2c30997a682ed25bc69b2b8e9f7ee0
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-06-07 14:42:56 +02:00
Laszlo Agocs
8a1915e04e rhi: d3d11: Fix swapchain format check
...to only return true for HDR formats that are sensible for
Direct 3D. There are currently no other formats, but new ones
may get added in the future.

Pick-to: 6.6 6.5
Change-Id: I4fc6d605da8f6bf2644a4e5c355ab8f1c62ad68d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-06-07 14:42:54 +02:00
Marc Mutz
e4682408b0 Add tst_QString::prependEventuallyProducesFreeSpaceAtBegin()
This seems to work with prepend(char), but not with prepend("data"),
cf. QTBUG-114167.

Task-number: QTBUG-114167
Pick-to: 6.5 6.6
Change-Id: I7aa4dca7c2b5938c2e5ad416231945c23140d659
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-06-07 11:39:43 +00:00
Tor Arne Vestbø
f1011bd2ed macOS: Don't assume DnD is handled via internal drag loop
If we have only one item, we're not using beginDraggingSessionWithItems
which requires us to manage our own drag loop, and instead use good old
dragImage, which takes care of the drag loop on our behalf.

In both cases we end up in draggingSession:endedAtPoint, so we need
to explicitly check for the existence of a manually managed drag session.

Amends 8a359343621fa83941946cb4e661b54ca7a1c4cc.

Fixes: QTBUG-114236
Pick-to: 6.5 6.6
Change-Id: Ifa9110945e191c4ffebe099e3e4edf9c571ab376
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-07 13:39:43 +02:00
Tor Arne Vestbø
b006d6d9de iOS: Don't invalidate a11y whenever UI elements are added or removed
The UIAccessibilityScreenChangedNotification will result in iOS resetting
its state, focusing the first a11y element on the screen. We shouldn't
tie clearing the a11y cache to this notification, as those are two
separate actions.

In the case of adding or removing individual elements, we still likely
need to clear the cache, but can inform the system of the more granular
UIAccessibilityLayoutChangedNotification to have it re-read the a11y
tree.

We still handle additions and removal of a11y elements with Window
or Dialog roles as UIAccessibilityScreenChangedNotification, as these
likely involve major UI changes.

The implicit UIAccessibilityScreenChangedNotification on QIOSWindow
destruction has been removed, as it's assumed iOS will automatically
refresh its a11y tree when a UIWindow is destroyed, and in any case
it's up to the individual clients of QAccessible to send the relevant
QAccessibleEvent to inform about the situation.

Pick-to: 6.6 6.5
Fixes: QTBUG-100094
Change-Id: If7d5cb961743e5ca97d45553b05ae5e92f82d275
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-06-07 13:39:43 +02:00
Tor Arne Vestbø
0237709e2c Add QOperatingSystemVersion::MacOSSonoma for macOS 14
Pick-to: 6.6 6.5
Change-Id: I22d4a2443e10ef40f498aa48aabad9aaa7aa8d1a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-07 13:39:43 +02:00
Tor Arne Vestbø
9decda9063 Remove conanfile.py
The conan experiment has ended, and the file is only bitrotting
nowadays.

Pick-to: 6.5 6.6
Change-Id: I8408265f7db7e52803b1f532d08a11387ea978cb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-07 13:39:43 +02:00
Tor Arne Vestbø
366923b597 Detect when Xcode is presenting os_log as structured log messages
In that case, just like when os_log mirrors to stderr by itself, we
want to disable Qt's fallback stderr handler.

Pick-to: 6.6 6.5
Change-Id: Ia373b19788edbce616d4f0d3d9f0b217ddc1e5c0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-07 13:39:43 +02:00
Tor Arne Vestbø
569c78162a Remove compatibility defines for Apple OS versions
These are already defined in AvailabilityVersions.h in the SDK,
and we expect people to build Qt against the latest SDK available.

The corner case of requiring defines for upcoming/beta SDKs can
easily be handled by using the version number directly, which is
the recommended practice anyways.

Pick-to: 6.6
Change-Id: Ica296118ee17608b8c43f9338c3083189083474c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-07 13:39:43 +02:00
Tor Arne Vestbø
af47a197a5 macOS: Remove legacy SDK and deployment target check macros
These are no longer in use in Qt.

Pick-to: 6.6
Change-Id: Id07bc0e09a414754493562d3a48df55cc28c5049
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-07 13:39:43 +02:00
Tor Arne Vestbø
329db8b64f macOS: Remove fallback defines for MAC_OS_X_VERSION_MIN_REQUIRED
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>
2023-06-07 13:39:43 +02:00
Tor Arne Vestbø
18f966aed1 Update mapping between Apple Clang versions and upstream Clang
For Xcode 14.0 and 14.3

Pick-to: 6.6 6.5
Change-Id: Idd533e2d1f7b0feffa618ddf633165ce29043d5e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-07 13:39:42 +02:00
Laszlo Agocs
bee7d2c610 rhi: metal: Fix a swapchain debug print crash
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>
2023-06-07 11:39:42 +00:00
Laszlo Agocs
ec27b99c2a rhi widget compositor: Use Nearest filtering
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>
2023-06-07 13:39:42 +02:00
Laszlo Agocs
6ec01168d1 rhi: gl: Switch back to Nearest filtering when resolving
...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>
2023-06-07 13:39:42 +02:00
Edward Welbourne
3ab7b7e230 Fix deprecation warnings agains u"..."_qs in dnslookup.cpp
Pick-to: 6.5 6.6
Change-Id: I29a177c7d46304c5b494218f5862195eb92c7684
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-06-07 10:26:04 +02:00
Edward Welbourne
a7c87be888 QCoreApplicationPrivate::initLocale(): report correct encoding
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>
2023-06-07 10:25:44 +02:00
Edward Welbourne
f7e201ba89 Replace 0 with nullptr where the parameter is meant to be NULL
Change-Id: I2c9abf53fd20305903904fa45f620fe4c9d81047
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-06-07 10:25:23 +02:00
Edward Welbourne
9155a07667 Fix what we can of macOS's divergence for pre-1900 dates
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>
2023-06-07 10:25:15 +02:00
Thiago Macieira
f94e72d3d2 tst_QTimer: ensure that timer activation respects start order
Task-number: QTBUG-114152
Change-Id: Iff484344171647888da4fffd17640daef56f2479
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-06-06 17:47:00 -07:00
Thiago Macieira
766deb0e43 Fix GCC 13 warning about freeing the global static
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>
2023-06-06 15:26:04 -07:00
Fabio Falsini
211b54ea47 Add flag to hide eye dropper button from QColorDialog
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>
2023-06-06 19:49:06 +00:00
Volker Hilsheimer
2a7da1b3c8 QTabBar: recalculate scroll offset when showing
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>
2023-06-06 21:49:02 +02:00
Amir Masoud Abdol
a471324a03 Use parentheses for Xcode specific variables
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>
2023-06-06 19:49:02 +00:00
Kai Köhne
b63bf98329 CMake: Remove local __PPS target
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>
2023-06-06 15:33:41 +00:00
Marc Mutz
d6ce0bad67 QFusionStyle: de-pessimize arrow painting
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>
2023-06-06 16:29:28 +02:00
Marc Mutz
362b5b8428 QFusionStyle: optimize cache-key generation for qt_fusion_draw_button():
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>
2023-06-06 16:29:28 +02:00
Marc Mutz
6ab0d25a09 QPixmapCache: fix leaking of QStrings and Keys on clear()
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>
2023-06-06 16:29:27 +02:00
Eskil Abrahamsen Blomfeldt
d390ac99f2 Upgrade Harfbuzz to 7.3.0
Fixes: QTBUG-114098
Pick-to: 6.2 6.5 6.6
Change-Id: I7bc766e6edada6f964c2dc40f18ff710249fb159
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-06-06 14:09:03 +00:00
Friedemann Kleint
79436bd34d uic: Generate QFont::Weight
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>
2023-06-06 14:09:03 +00:00
JiDe Zhang
71bf2a3a32 Fix can't create rhi if VkInstance is not enable VK_KHR_surface
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>
2023-06-06 14:09:02 +00:00
Joerg Bornemann
08f3aa32b7 CMake: Add version tagging sources only if the linker supports it
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>
2023-06-06 10:43:54 +02:00
Kai Köhne
1352dba3b0 Doc: Small fixes to QCommandLineParser overview
Pick-to: 6.5 6.6
Change-Id: I535944b747ed511cfe5e6efe8ca2c13b52c2cfbb
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-06-06 10:43:50 +02:00
Andy Nichols
4d261c1b54 Revert "QStringBuilder: remove unneeded specializations"
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>
2023-06-06 06:12:53 +02:00
Ahmad Samir
88de696074 Moc: check sizes of specific member QLists are within INT_MAX range
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>
2023-06-06 01:23:01 +03:00
Ahmad Samir
2cca2323d3 Moc: pass a pointer to the parser to the Generator
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>
2023-06-06 01:23:01 +03:00
Ahmad Samir
845b5d63bf Moc: assert size of registered strings list is within INT_MAX range
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>
2023-06-06 01:23:01 +03:00
Ahmad Samir
9cb08c4c0d Moc: streamline how diagnostic messages are printed
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>
2023-06-05 22:23:01 +00:00
Ahmad Samir
e22f766bda Moc/Generator: fix 64-to-32 narrowing conversion warnigns
Pick-to: 6.6 6.5
Change-Id: Id1094aaba284c51c3a840a8e107abd837a825593
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-05 22:23:01 +00:00
Ahmad Samir
58329bbd2b Moc: remove STRINGDATA fallback code
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>
2023-06-05 15:23:01 -07:00
Thiago Macieira
4b4d384f3e Moc: remove GCC 9 ban for using QtMocHelpers::stringData()
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>
2023-06-05 15:23:01 -07:00