Commit Graph

56292 Commits

Author SHA1 Message Date
Liang Qi
f9e4402ffe xcb: recreate xcb window under some conditions
Some netWmState needs to be set during unmap/hide(), which is too
difficult to follow, and causes m_mapped status out of sync very easily
sometimes, which we had tried in
e946e6895a .

Destroy the xcb window and recreate new could make the thing
much easier. This practice is also used in other platforms, such
as cocoa plugin.

In Qt 4, the platform window was destoryed and re-created in this
situation on all platforms, which was not ported into Qt5.

See also the code between setWinId(0) and createWinId() in
QWidgetPrivate::setParent_sys() in qwidget_x11.cpp/qwidget_win.cpp/
qwidget_mac.mm.

Fixes: QTBUG-69515
Fixes: QTBUG-73485
Fixes: QTBUG-81341
Pick-to: 6.3 6.2 5.15
Change-Id: If55c57a198bc785719b61b8748dabd8281c9639d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-04-19 20:06:26 +00:00
Liang Qi
d27a623524 Revert "xcb: implement missing bits from ICCCM 4.1.4 WM_STATE handling"
This reverts commit e946e6895a.

It clears the duplicate show() and hide() too aggressive in
handleDeferredTasks() and can cause visible states out of sync between
qt and system(x11) when user switches visible on and off very
frequently.

This change also reverts 28138aa80a.

Fixes: QTBUG-101347
Fixes: QTBUG-99810
Task-number: QTBUG-69515
Pick-to: 6.2 6.3 5.15
Change-Id: I419c324634be8ee6884e02032bb53a42738305ac
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-04-19 22:06:26 +02:00
Sona Kurazyan
fbbad06751 Sql: replace remaining uses of QLatin1String with QLatin1StringView
Task-number: QTBUG-98434
Change-Id: Ia621f9d937649dda41a7b0d13a61e6f1397f6dde
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-19 19:40:04 +02:00
Sona Kurazyan
128785d0fa Sql: use _L1 for for creating Latin-1 string literals
Task-number: QTBUG-98434
Change-Id: Ie12ca82fd912617eabe4f602c08914f12878cb32
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-19 19:40:04 +02:00
Sona Kurazyan
917b4d3802 Sql: stop using QLatin1Char constructor for creating char literals
Required for porting away from QLatin1Char/QLatin1String in scope of
QTBUG-98434.

As a drive-by, fix qsizetype -> int narrowing conversion warnings for
the touched lines.

Change-Id: I03477e645a94948cac3e3e2abca52aa4e3e2efff
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-19 19:40:04 +02:00
Sona Kurazyan
5ec4b0b8e8 Printsupport: replace remaining uses of QL1String with QL1StringView
Task-number: QTBUG-98434
Change-Id: Ibeb9608d3ebc3c0c2e7ea93561e24cb24c601fec
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-19 19:40:04 +02:00
Sona Kurazyan
42c8f56acc Printsupport: use _L1 for for creating Latin-1 string literals
Task-number: QTBUG-98434
Change-Id: I415132ed381c25313e7fcccd050e522667eb6c22
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-19 19:40:04 +02:00
Sona Kurazyan
24d2a00ce2 Printsupport: stop using QL1Char constructor for creating char literals
Required for porting away from QLatin1Char/QLatin1String in scope of
QTBUG-98434.

Change-Id: Ia186ed178239796bdf19db5b35a36ea606baf937
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-19 19:40:04 +02:00
Axel Spoerl
87762234a7 Update documentation of enum Qt::DockWidgetArea
Describe enum usage in QDockWidget::isAreaAllowed() as well as meaning
of enum members.

Pick-to: 6.3 6.2 5.15
Change-Id: Ib88509feb001be27c11fd167c9009da50ce1b851
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-19 19:12:20 +02:00
Axel Spoerl
9ff40b59da Fix QDockWidget parenting and dock permissions
Check DockWidgetArea permissions of QDockWidgetGroupWindows with single
dock widget. Obtain a dock widget's tab position from a dock widget
group window if it can't be established otherwise. Remove hardcoded
assumption that a dock widget is in the left dock. Both cases have lead
to inconsistent entries and dangling pointers in
QDockAreaLayoutInfo::item_list.
Remove warning: QMainWindowLayout::tabPosition called with out-of-bounds
value '0', which becomes obsolete by the fix.
Create a QDockWidgetGroup window prepered to become a floating tab,
whenever a dock widget is being hovered over. Store it in item_list so
it can be found and deleted when required.
No longer call e->ignore() after propagating close events to the first
dock widget and thus preventing others from receiving the event.
Add logging category qt.widgets.dockwidgets
Update dock widget autotest with tests to check the fixes mentioned:
plugging, unplugging, hiding, showing, closing and deleting.
Blackist closeAndDelete, floatingTabs test on macos, QEMU, arm, android
due to flaky isFloating() response after a dock widget has been closed
or plugged.
QSKIP dockPermissions and floatingTabs test on Windows due to mouse
simulation malfunction.
QSKIP hideAndShow test on Linux in case of xcb error (QTBUG-82059)

Fixes: QTBUG-99136
Pick-to: 6.3 6.2
Change-Id: Ibd353e0acc9831a0d67c9f682429ab46b94bdbb0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-19 17:12:20 +00:00
Sona Kurazyan
908e85cc85 Replace uses of _qs with _s in sources and examples
Task-number: QTBUG-101408
Change-Id: I48360ba3b23965cd3d90ac243c100a0656a4cde8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-19 19:12:20 +02:00
Alexandru Croitor
a1d8b9023f CMake: Disable CMAKE_INSTALL_RPATH_USE_LINK_PATH
There should be no need for CMake to add rpaths pointing to
directories outside of the build tree to the installed libraries.
All relevant install rpaths are handled by qt_apply_rpaths().

Change-Id: If554b1e3c790c2bb04a34e8b0524aab3febf5afc
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-04-19 17:20:14 +02:00
Alexandru Croitor
8254ee6a3b CMake: Fix implementation of qt_apply_rpaths
There were a few things that were not ported correctly.

Make sure to disable rpath manipulation if the rpath feature is
disabled.

Fix if(IS_ABSOLUTE) conditions to actually take values.

Don't embed bogus relative rpaths if the platform does not support
it. QNX is such a platform, it does not support $ORIGIN (at least from
my scouring of QNX documentation and manual testing via QEMU).

Handle the extra rpath case where they are relative, but the platform
does not support relative rpaths, by transforming them into absolute
ones.

Amends 67ee92f4d8

Change-Id: I04168633ec51b3cc5d580b738a7dc280fe6e0d2d
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-04-19 17:20:14 +02:00
Alexandru Croitor
e28a32ea45 CMake: Sync rpath documentation with the current implementation
Pick-to: 6.2 6.3
Change-Id: Id3af1cdfd66cd9527ab76137d72e354edfc3de75
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-04-19 17:20:14 +02:00
Alexandru Croitor
e327ed191c CMake: Print prefix info when building qtbase
Pick-to: 6.2 6.3
Change-Id: Ib76d94b1c51f99d5ce007d463d97b5d2b256d2bf
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-04-19 17:20:14 +02:00
Alexandru Croitor
5059f7adc2 CMake: An -extprefix -developer-build should install by default
Previously if
 -extprefix /tmp/sysroot (CMAKE_STAGING_PREFIX)
 -developer-build (FEATURE_developer_build)
were specified, but
  -prefix (CMAKE_INSTALL_PREFIX)
was not,
the build system would set the CMAKE_INSTALL_PREFIX to the
qtbase build dir.

Then, if targeting desktop, this would be considered a non-prefix
build (ninja install would refuse to work), whereas in a cross-build
it would be considered an installable build.

In both cases though, the rpath of installed binaries would point to
the qtbase build dir (because CMAKE_INSTALL_PREFIX would be set to the
qtbase build dir).

This is quite confusing behavior, in more than one way.

Change the build system to consider that an explicit -extprefix should
cause Qt to always be installed, even if -developer-build is
specified.

This means the installed rpaths and on-device install prefix
(CMAKE_INSTALL_PREFIX) will now use the default computed install
prefix, e.g. /usr/local/Qt

It also means that to get a non-installable developer + custom staging
and install (on-device) prefix build, users will have to be explicit
and set all the options
 -extprefix ~/qt/qtbase_build_dir
 -prefix /usr
 -developer-build

Pick-to: 6.2 6.3
Change-Id: Ib560452a4b4778860e0fd7666c76f8a6745773ee
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-04-19 17:20:14 +02:00
Alexandru Croitor
f3483e6b96 CMake: Allow no install + custom on-device prefix for desktop builds
Allow such a combination
- staging prefix (CMAKE_STAGING_PREFIX / -extprefix) set to the
  qtbase build dir
- install prefix (CMAKE_INSTALL_PREFIX / -prefix / on-device prefix) set
  to some custom location
even for non-cross builds.

An example would be
    configure -prefix    /usr \
              -extprefix ~/qt/qtbase_build_dir

CMake will put the Qt libraries in the qtbase build dir, ninja install
will not be required, but ultimately in order to run applications,
the Qt libraries are expected to be in /usr.

Support for this scenario was originally added for cross-builds in
062318feb2 , but not desktop builds.

Such a build is useful when you want to have install rpaths different
from where Qt is initially installed to (the staging prefix).

This case doesn't really happen often when targeting desktop
platforms, it's mostly used for cross-compilation (e.g yocto).

Being able to have the same setup with a desktop build is nevertheless
useful for faster iteration on build system issues in such a scenario.

Amends 062318feb2

Pick-to: 6.2 6.3
Change-Id: I42be3628a30025f14eebaf0a79401b54e95cde26
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-04-19 17:20:14 +02:00
Alexandru Croitor
475ac94374 CMake: Fix no_prefix feature to take into account the staging prefix
Instead of complicating the condition even more, just use the value of
QT_WILL_INSTALL which is determined in QtSetup before configure.cmake
is loaded.

The AUTODETECT part is needed to ensure that
 -developer-build
implies -no-prefix.

The CONDITION part is needed so that
 -extprefix /tmp/sysroot -no-prefix
correctly errors out saying that this can't be a non-prefix build,
unless
 -extprefix ${qtbase_build_dir} -no-prefix
is passed.

Pick-to: 6.2 6.3
Change-Id: Ie4f5a91281bf2fbe1bd0744de05d57f43fe992e7
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-04-19 17:20:14 +02:00
Tor Arne Vestbø
857264715a configure: Add newline between configure summary and build instructions
Otherwise we get:

    Styles ................................. Basic Fusion Imagine iOS
    Material Universal macOS Windows
    -- Qt is now configured for building. Just run 'cmake --build .
    --parallel'

Pick-to: 6.2 6.3
Change-Id: Ie8d009455e4f45c9eb0557c4a08e9d0a94030c3a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-04-19 12:46:18 +00:00
Tor Arne Vestbø
bb3c80e051 objc_namespace: Add support for universal binaries
Pick-to: 6.2 6.3 5.15
Change-Id: If6a15c1ec27fe0e1a42764fbcd194d7806aecf0c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-04-19 14:46:18 +02:00
Tor Arne Vestbø
e6e443e0bb objc_namespace: Fix misspelled argument for silencing output
Pick-to: 6.2 6.3 5.15
Change-Id: I318a57e193bd10f8dbd2b22ab173a2940ba1dad9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-04-19 14:46:18 +02:00
Tor Arne Vestbø
661931aa98 objc_namespace: Update parsing logic to account for otool changes
The textual output of otool in recent Xcode releases has changed.
We now look for OBJC_CLASS_RO/OBJC_METACLASS_RO rather than
class_ro_t.

Pick-to: 6.2 6.3 5.15
Change-Id: I86192e91e55d8deb7e5c6790b327855fc0f7e594
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-04-19 14:46:18 +02:00
Morten Sørvig
8ae20c975a wasm: add fps counter to the rasterwindow test
Change-Id: Iddda72287119bc3ee6495d746ac75d64ff0c2f2c
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: David Skoland <david.skoland@qt.io>
2022-04-19 14:46:18 +02:00
Morten Sørvig
c78925f487 wasm: propagate QWindow format to backing store
Qt backing store images should have alpha iff that was
requested by the QWindow's surface format. This changes
wasm to be in line with the other platforms, and enables
use of transparency for Qt windows.

Change beginPaint() to clear the backing store only
if the format/image has alpha. This is also established
behavior Qt's backing stores.

Change-Id: Idafe658e24d864f7c4f9e68ee39cb409982b5852
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: David Skoland <david.skoland@qt.io>
2022-04-19 14:46:18 +02:00
Assam Boudjelthia
e629efc82c Android: use libexec path for qmlimportscanner
This should've been done already for Qt 6.2.

Pick-to: 6.2 6.3
Change-Id: I2f943254698a4f0f2742619fd7fcab9ac3a5014a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-04-19 12:16:43 +00:00
Liang Qi
46d047b76c QMimeData: return null string for null byte array
This is a cherry modification of 5826a7ad92
in 5.15 branch.

Fixes: QTBUG-102438
Pick-to: 6.3 6.2
Change-Id: I8bdb7cb2537c6df7bb1381871b3cc2446ff1d270
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-04-19 09:57:12 +02:00
Moody Liu
4088b27b93 Explicitly check for atomic addition and relaxed load operation support
...and properly find and link against `libatomic` using find_library.
This fixes the qtdeclarative build on the RISC-V platform.

Initial-patch-by: Sprite <SpriteOvO@gmail.com>
Pick-to: 6.2
Pick-to: 6.3
Task-number: QTBUG-99234
Change-Id: I2b5e4812886ce45cb02bed3106ce8c519b294cbe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-04-18 15:01:53 +00:00
Marc Mutz
a0858c639e tst_qstringapisymmetry: check toInt() etc also with base != 0
This shows we're lacking support for the 0b prefix, and, as it turns
out, there's a request for it.

Task-number: QTBUG-85002
Pick-to: 6.3
Change-Id: Ie201c84bf906a7e482b929301699ceb429b53c14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-04-17 21:55:23 +02:00
Marc Mutz
c948d3ce11 QFutureCallOutEvent: remove unused pseudo-copy-ctor
This constructor was used in the previous implementation of
clone(). The current implementation uses the compiler-generated
copy-constructor.

Change-Id: Ibae163653e43ceb2b07872b496cd004e50b1e625
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-15 13:43:51 +02:00
Lorn Potter
0ec75f4b99 wasm: use emscripten::val for specialHTMLTargets
We need to add specialHTMLTargets to EXPORTED_RUNTIME_METHODS in order
to use it, as Emscripten does not export it.

Also, EM_ASM is not allowed for SIDE_MODULES, so it's better to use
emscripten::val methods.

Change-Id: I9b352ac98e2a961157f5bb36456bec3e35891270
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-04-15 21:06:32 +10:00
Allan Sandfeld Jensen
830b1550de Fix race condition in futex-based QSemaphore
Add one and reset the wakeAll bit atomically.

This avoids a race in a case where an acquiring thread
is owning the semaphore, and deleting it after a
set number of releases (one for each thread referencing the semaphore).

Two releasing threads could enter the if statement under
futexNeedsWake(prevValue), the counter been incremented at
this point and reached the value being acquired, meaning the thread
acquiring can be awakened by just one of the two releasers,
delete the semaphore, and then the second releaser would access
the now deleted semaphore.

The patch avoids that by unsetting and reading the wakeAll bit
atomically, so only one thread will try to wake all threads.

Pick-to: 6.3 6.2 5.15
Fixes: QTBUG-102484
Change-Id: I32172ed44d74378c627918e19b9e1aaadb5c6d1d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-15 10:27:52 +02:00
Volodymyr Zibarov
8b3f2dd994 TextEdit: Avoid scrolling to cursor during app switch on GNOME
GNOME sends empty InputMethod event when switching applications
with Alt-Tab. As long as this event is empty, we don't need to
scroll to cursor, because we're not adding any input text to it.

This also fixes "out of scope" bug QTCREATORBUG-26628

Fixes: QTBUG-100039
Task-number: QTCREATORBUG-26628
Pick-to: 6.2 6.3
Change-Id: I3ccfea50ae52f6f0cbf82c29f07944894050e7dd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-14 23:08:54 +03:00
Giuseppe D'Angelo
41a7546789 QDate(Time): add a addDuration method
To complement the existing addSecs / MSecs / etc., add a function
that takes any compatible std::chrono::duration.

QTime also features similar functions, but it's also "unique" in that
it uses modular arithmetic (it wraps around in case of "overflow").
I'm not so sure that adding durations to a QTime object therefore
makes sense, and I'm not doing it in this patch.

[ChangeLog][QtCore][QDate] Added addDuration().
[ChangeLog][QtCore][QDateTime] Added addDuration().

Change-Id: I02aa37ff024d7f56fa976dc8f4f73523bdba8d94
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-14 21:56:56 +02:00
Marc Mutz
3141a13b2a QFutureCallOutEvent: de-export again
A previous commit Q_CORE_EXPORTed this class so it could be used in
tst_qevent. But we can also keep it Q_AUTOTEST_EXPORTed and make the
testing of the class subject to QT_BUILD_INTERNAL on the test side.

That's what this patch does.

Change-Id: I9bd5f80ada856b7db4b39dfb59b32bd825416c13
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-04-14 19:07:16 +02:00
Marc Mutz
da0f72ebb8 QEvent: start to de-inline copy ctor and clone() of all subclasses
There's no advantage to them being inline: Absent de-virtualisation,
clone() is only supposed to be called through the vtable, and the copy
ctor is only supposed to be used in the implementation of clone().

And when the compiler de-virtualises, we don't want the code
duplication associated with inlining.

Enforce this by introducing new macros to hide the boilerplate.

This fixes missing out-of-line dtors in:
- QSinglePointEvent
- QApplicationStateChangeEvent
- QFutureCallOutEvent

Wrong covariant return in:
- QFutureCallOutEvent

And missing clone() reimplementations in:
- QCloseEvent
- QIconDragEvent
- QShowEvent
- QHideEvent
- QDragEnterEvent
- QDragLeaveEvent

While these don't carry extra data or members, a dynamic_cast of the
result of clone() as well as using the expected covariant return value
would fail:

   QShowEvent *e = ~~~;
   QShowEvent *e2 = e->clone(); // ERROR: converting QEvent* to QShowEvent*

Check that reimplementing clone() is binary compatible (covariant
returns may change the numerical pointer value returned, cf.
https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B).

The copy-assignment operator stays inline for the time being, as the
goal is to = delete it in the future.

This patch covers, roughly, QtCore and QtGui.

[ChangeLog][QtGui][QEvent subclasses] Fixed missing clone()
reimplementations on QCloseEvent, QIconDragEvent, QShowEvent,
QHideEvent, QDragEnterEvent, and QDragLeaveEvent.

Task-number: QTBUG-45582
Task-number: QTBUG-97601
Change-Id: Ib8a0519dbe85a7a8da61050d48be338004dfa69a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-14 19:07:16 +02:00
Edward Welbourne
ec59ae6189 Spacing-only change: fix indents and spacing in qtestcase.cpp
Separated from other clean-ups to avoid inanity 'bot complaints.

Change-Id: Ia33f87da224dba7c50bbf14beb642825dc46fe90
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-14 16:58:17 +02:00
Edward Welbourne
f3184770e2 qtestcase.cpp: s/QString::fromLatin1/QLatin1String/ where viable
Now that QL1S has its own arg(), we can use that directly instead of
going via QString before calling arg(). Only works in most cases, as
the QL1S::arg() overload set is more limited.

Change-Id: Ie4c566c5998538b1b8a953b1ba4481e0f1663bf7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-14 16:58:17 +02:00
Sona Kurazyan
adad2a468d Android: replace remaining uses of QLatin1String with QLatin1StringView
Task-number: QTBUG-98434
Change-Id: I35a97eef61746039738b4a5f2271c3bffd5711b4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-04-14 15:29:06 +02:00
Sona Kurazyan
b28ed7fdc2 Android: use _L1 for for creating Latin-1 string literals
Task-number: QTBUG-98434
Change-Id: I5ee5fe079c9a4530f636e59f6171abfa523591f4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-04-14 15:29:06 +02:00
Sona Kurazyan
d0a08d1f11 Android: stop using QLatin1Char constructor for creating char literals
Required for porting away from QLatin1Char/QLatin1String in scope of
QTBUG-98434.

As a drive-by, fix qsizetype -> int narrowing conversion warnings for
the touched lines.

Change-Id: Iebcbdbd7cecac09d0a7039e3ef6a4509d33039ba
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-04-14 15:29:06 +02:00
Joerg Bornemann
252e3a1526 CMake: Add rudimentary c++2b feature
This fixes the "Could not find feature c++2b." error when building a Qt
module with qmake.

The feature is OFF by default for now.

This amends commit b5ed3cb7ba.

Pick-to: 6.2 6.3
Change-Id: Ibabe3ce29275699e66ab1f32d19d583d6bcede9e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-04-14 09:28:06 +02:00
Thiago Macieira
fbe6f19853 QBENCHMARK: Replace the double underscore with something not reserved
Clang with -Wreserved-identifier complains.

Pick-to: 6.3
Fixes: QTBUG-102431
Change-Id: If2e0f4b2190341ebaa31fffd16e441ee35b0e3b9
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-04-14 03:17:42 +00:00
Thiago Macieira
c87c2b0544 QObjectPrivate:Connection:: use NSDMI for the ref count
Can't use it for the bit in the bit field until C++20.

Change-Id: If2e0f4b2190341ebaa31fffd16e313f64d52c26a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-13 20:17:38 -07:00
Thiago Macieira
06c2478762 QObjectPrivate: deinline a bunch of stuff only used in QtCore
All of this connection management code is used only in QtCore and
mustn't be touched by other modules (not even qtdeclarative). So there's
no reason for it to be around and slow down the compilation time of
everything using QObjectPrivate.

Change-Id: If2e0f4b2190341ebaa31fffd16e31313f1b7020f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-13 20:17:27 -07:00
Thiago Macieira
d1e9cab81c QObjectPrivate: use placement new/delete for SignalVector
Just to be pedantically correct, but also makes the construction code
slightly more readable.

Pick-to: 6.2 6.3
Change-Id: I29f1c141c0f7436393d9fffd16e2bbf0f361c024
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-13 20:17:25 -07:00
Thiago Macieira
bc6087fce2 QObjectPrivate: use ConnectionList's constructor instead of copy-assignment
For all new elements, this is the correct thing to do. This seems to
work around an MSVC compiler bug on ARM64. It also seems to generate
better code for x86-64 too, as a nice bonus.

See: https://developercommunity.visualstudio.com/t/codegen-elides-initializers-when-copying/10004323
Before: https://msvc.godbolt.org/z/Wcd4haaPd
After: https://msvc.godbolt.org/z/vWYjazWGr, https://gcc.godbolt.org/z/hdsvTq9nE

Fixes: QTBUG-102246
Pick-to: 6.2 6.3
Change-Id: I29f1c141c0f7436393d9fffd16e2bbbf4c0fe54d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-13 20:17:23 -07:00
Ilya Fedin
974a7bd6e0 FileChooser portal: set current_name
Fixes: QTBUG-100297
Pick-to: 6.3 6.2
Change-Id: I5d41e01aafeccce2d886debdb595b4c87b03a043
Reviewed-by: Jan Grulich <jgrulich@redhat.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-14 03:52:52 +04:00
Giuseppe D'Angelo
7de83f06c1 QDateTime: add conversions for time_point and zoned_time
In C++20, QDateTime is a direct equivalent of a sys_time<milliseconds>
time point. (Before, it might not have been, because system_clock before
C++20 was not guaranteed to be tracking Unix time, AKA UTC time without
leap seconds.) To be specific, sys_time<milliseconds> corresponds to
a QDateTime using the Qt::UTC timespec.

This patch:

1) adds named constructors taking time_points:

* a generic one taking any time_point convertible (via clock_cast) to
  a system_clock (this obviously includes system_clock, but also e.g.
  utc_clock)

* another couple taking local_time, interpreted as a duration from
  1/1/1970 in local time.

2) adds a named constructor from zoned_time (i.e. a sys_time + a
   timezone), that we can easily support via QTimeZone.

3) add conversion functions towards sys_time, matching the existing
   to(M)SecsSinceEpoch() functions.

[ChangeLog][QtCore][QDateTime] QDateTime can now be constructed
from std::chrono::time_point objects (including local_time), as
well as from std::chrono::zoned_time objects. Moreover, they
can be converted to std::chrono::time_point using system_clock
as their clock.

Change-Id: Ic6409bde43bc3e745d9df6257e0a77157472352d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 18:45:54 +02:00
Sona Kurazyan
a5b9600356 QtGui: stop using QLatin1Char constructor for creating char literals
Required for porting away from QLatin1Char/QLatin1String in scope of
QTBUG-98434.

Change-Id: I308d86cefcbfd126929b68f9a853d420840c965f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-13 18:34:15 +02:00
Giuseppe D'Angelo
2e29f55f76 QDate: add conversions for std::chrono calendaring classes
std::chrono::year_month_day and related classes offer very
convenient to specify dates.

This patch adds implicit constructors to QDate to support this
convenience, e.g.:

  // YYYY-MM-DD, DD-MM-YYYY, MM-DD-YYYY formats:
  QDate d1 = 1985y / December / 8;
  QDate d2 = 8d / December / 1985;
  QDate d3 = December / 8d / 1985;

  // Indexed weekday:
  QDate d4 = 2000y / January / Monday[0];
  QDate d5 = 2000y / January / Monday[last];

and so on.

These are all implemented using the conversion from the std
calendaring classes to sys_days. Conversions between sys_days
and QDate are also added, since they're basically "for free".

I don't expect "ordinary" users to stumble upon it, but it's
worthy mentioning that std::chrono::year *does* have a year
zero (hence, year_month_day in year 0 or below are offset
by one with the corresponding QDate). I've left a note
in the documentation.

[ChangeLog][QtCore][QDate] QDate (and therefore QDateTime)
is now constructible using the year/month/day/week classes
available in the std::chrono library. Moreover, it now
features conversions from and to std::chrono::sys_days.

Change-Id: I2a4f56423ac7d1469541cbb6a278a65b48878b4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 18:08:38 +02:00