Commit Graph

33897 Commits

Author SHA1 Message Date
Giuseppe D'Angelo
a769ca1d91 Assume static_assert is available everywhere in C++
I'm not adding a static_assert(Q_COMPILER_STATIC_ASSERT),
as ironic as that might be; we have enough
static_asserts around already which will surely cause
errors, in case of a broken compiler.

The detection itself has to stay around for C support.

Change-Id: Id32f5c8e0ab2e461fba7b0525da5eeaaea77c68d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-12 14:30:37 +02:00
Friedemann Kleint
1053e1f4a3 Fix Windows Font database code to use configure features
Use QT_CONFIG, QT_REQUIRE_CONFIG instead of custom macros.

Task-number: QTBUG-83255
Task-number: QTBUG-83931
Change-Id: Id067448dd59f4810a6bc8042d3fbe4244d5cc88a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-06-12 14:25:27 +02:00
Mårten Nordheim
a114b133f5 QByteDataBuffer: Remove the ctor and dtor
Remove the ctor as it was not doing anything special and the implicitly
generated one will do what we need anyway. And calling clear before
destructing wasn't useful, so just remove the dtor in general.

Change-Id: I9ed722d4db3ea220d32082d4cb38c10a9af34d5e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2020-06-12 14:05:24 +02:00
Sona Kurazyan
838025bd73 Include qpromise.h in corelib/CMakeLists.txt
Change-Id: I2a854ae5774c0b98387782af685d903818475173
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-12 14:00:03 +02:00
Laszlo Agocs
9d0a15b7a3 rhi: gl: Support reading back 1 byte texture formats
The GL texture readback is limited due to the underspecified glReadPixels,
especially on GLES. To preserve our sanity, we just do a GL_RGBA
readback always. This only worked for 4 byte formats, but now we extend
it to handle the 1 byte (R8 and RED_OR_ALPHA8) formats.

Note that this relies on the fact that the GL implementation is able to
do a GL_RGBA readback for a GL_R8 or GL_ALPHA texture.

Change-Id: I8286dca42964f0cbc6645355e105bbd81ec685ca
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-06-12 14:00:02 +02:00
Thiago Macieira
03dfd4199d QMimeDatabase/zstd: use -T1 instead of --single-thread
Some older versions of the command-line tool don't have --single-thread
but do have -T1. They're slightly different according to the
documentation, but it's not important to us. What we want is to make
sure we consume a single CPU during build.

Fixes: QTBUG-84792
Pick-to: 5.15
Change-Id: Ied637aece2a7427b8a2dfffd16129fe88a0466ee
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-06-12 07:26:58 +00:00
Eskil Abrahamsen Blomfeldt
eb72d788fe Add RHI feature check for screen space derivatives
Fragment shader functions like fwidth() are useful for antialiasing
distance field text in the case of perspective projections. In order
to enable this as an alternative code path, we need to detect support.

- OpenGL: Supported with GL_OES_standard_derivatives or GLES3 and up
- Direct 3D: Supported for ps_2_x, so always supported on Direct3D 11
- Vulkan/Metal: Always supported

Task-number: QTBUG-84695
Change-Id: I5e3fa8014c808a9a2d639305c5e90ec25d44655c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-06-12 09:26:15 +02:00
Marc Mutz
3f6142f5a1 Rename new slice() method sliced()
The recently-added slice() method has the problem that it's a noun
as well as a verb in the imperative. Like std::vector::empty, which
is both an adjective and a verb in the imperative, this may cause
confusion as to what the function does. Using the passive voice form
of slice(), sliced(), removes the confusion. While it can be read as
an adjective, too, that doesn't change the meaning compared to the
verb form.

Change-Id: If0aa01acb6cf5dd5eafa8226e3ea7f7a0c9da4f1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-11 19:14:03 +00:00
Lars Knoll
03107d0ccd Add some support to flag alias properties
This is required if we want to be able to get rid of the property
cache.

Also reserve a flag for var properties, in case it turns out that we
need to keep the distinction between var and QVariant properties in QML.

Change-Id: I55c2191adcc2d94bd8f148216e26423defaa900f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-06-11 19:39:57 +02:00
Lars Knoll
d0689ec867 Get rid of the obsolete isEditable flag for properties
Change-Id: I54411bd8e223671523c9c8fad5c80bfa6b5b7097
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-06-11 19:39:56 +02:00
Fabian Kosmale
9b383f3d5c Further metaobject cleanups
Remove QMetaProperty index member. Instead, add a function to compute it
on demand from the QMetaObject.
Also remove the remains of the signature function.

Original-patch-by: Lars Knoll <lars.knoll@qt.io>
Change-Id: I5b16d444e7474216a535e3e93a118825cd0e6090
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-11 19:39:55 +02:00
Lars Knoll
f5e8f9c814 Cleanup QMetaClassInfo
Change-Id: I0b4fa4568f8479106053e0fae72fc802fca74a65
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-06-11 19:39:55 +02:00
Fabian Kosmale
630c7b4811 Cleanups in QMetaProperty
This changes the layout of the meta object data, so
also bump the meta object revision.

Original-patch-by: Lars Knoll <lars.knoll@qt.io>
Change-Id: I176fb16c207e8ebe59e358e69554be813406232f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-06-11 19:39:54 +02:00
Lars Knoll
5603be705e Qt6: remove support for property flags being functions
Property flags should be compile time booleans, not something to
be determined at runtime.

We've been using this to dynamically disable some properties in QWidget
based classes dependent on the state of a different property, but this
should better get implemented on top of our widgets.

Change-Id: I6296e8761303ecdf24d9e842142e8596304c015d
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-06-11 19:39:53 +02:00
Lars Knoll
679492ecc6 Clean up QMetaEnum code
Change-Id: I9c1fcfd72890fb3d69d2d9caed7f3cff931c3ff6
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-06-11 19:39:53 +02:00
Lars Knoll
ee709e3236 QMetaMethod: clean up offset handling
Centralize the offset handling in one place and avoid lots of magic
numbers in various places. Expose the number of ints per method in
QMetaObjectPrivate as a constant, so that code in other places can
access it via private API.

Change-Id: I59790287a17ea47e6160ec65d9c8d0aaee748947
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-11 19:39:52 +02:00
Friedemann Kleint
b3e0732740 Move windows font databases into QtGui
Requires adapting a few config checks since cmake currently
does not detect directwrite.

Task-number: QTBUG-83255
Task-number: QTBUG-83931
Change-Id: I521f1924f701260b41dccbcecf87b19f08df5ccc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-06-11 19:38:09 +02:00
Lars Knoll
39e229fe13 Remove more QStringRef overloads that aren't required
The QStringView versions will do the job just fine :)

Task-number: QTBUG-84319
Change-Id: I376b310deb27683fd98bbcc55e0f56014cacecc3
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-06-11 15:52:25 +02:00
Lars Knoll
8ea11e0cf7 Remove most overloads taking a QStringRef from the QString API
Add QStringView overloads where they were missing. This keeps things
almost 100% source compatible.

Task-number: QTBUG-84319
Change-Id: Ica8ee773b2ce655e9597097786117959e34b236e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-11 15:52:25 +02:00
Marc Mutz
bf5629af44 QString: remove remnants of old multiArg()
Change-Id: I3bc5bab491ce74daa37f320ea5d4324f9827e870
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-11 15:52:25 +02:00
Volker Hilsheimer
f9940b15f7 Fix breakage of QPushButton on macOS when a style sheet was set
Amends comment 6e1d70ae12, which
introduced SE_PushButtonBevel so that QPushButton could ignore clicks
outside of the button's bevel.

In the macOS style, make sure that the framerect we pass to
NSButton::alignmentRectForFrame is the rect we receive from QPushButton
in the style options. The frame property of the shared NSButton* object
might not be initialized.

In the style sheet style, handle SE_PushButtonBevel the same ways as
Contents and FocusRect, as it is not a separately styleable property.

Change-Id: I12eb1b046c864a02b34d276e6352e2e16d44231e
Fixes: QTBUG-84852
Fixes: QTBUG-84879
Task-number: QTBUG-81452
Pick-to: 5.15
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-06-11 15:52:25 +02:00
Assam Boudjelthia
cde86464df Android: fix behovior of right click to not interfere with other clicks
To allow treating long press as right click on Android, set
the environment variable QT_ANDROID_ENABLE_RIGHT_MOUSE_FROM_LONG_PRESS
to 1.

Pick-to: 5.15
Fixes: QTBUG-73416
Task-number: QTBUG-84179
Change-Id: Ibe1d6af6ab9965112f1418638a088717798b554c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-06-11 08:30:10 +00:00
José Dapena Paz
6d323c0b22 Add more LTTNG tracing points
* QImage and QPixmap copy and transform operations.
* OpenGL paint engine texture cache texture upload
* OpenGL paint engine draw texture

Task-number: QTBUG-83347
Pick-to: 5.15
Change-Id: I03150d6ff80cbbcd787133d75854715cb81b5571
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-06-11 09:14:32 +02:00
Elvis Lee
ab6fd84c62 Make it possible to avoid loading comments from JPEG and PNG files
Skip reading JPEG and PNG comments information from the header to save
the memory.

This can now be configured through the feature system.

Change-Id: I3744312f69aa3201d5188776cbd99fe690b75d32
Task-number: QTBUG-83123
Pick-to: 5.15
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-06-11 09:10:01 +02:00
Friedemann Kleint
dee140a79a Windows: Fix registry string read failures
On Windows 7, it has been observed that the time zone registry key
is a string of size 256 padded with 0. Use QString::fromWCharArray(),
relying on 0-termination to cope with it.

Pick-to: 5.15
Fixes: QTBUG-84455
Change-Id: I5d242e2de73c1ea09344aee8de8eea941bc52bab
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-11 07:19:00 +02:00
Lars Knoll
60f83a7675 Port QtPrintSupport to QStringView
Task-number: QTBUG-84319
Change-Id: I4a2407dcf1c2979cd109e7cb3dd7d6395c56b927
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-11 06:52:54 +02:00
Lars Knoll
5c4f470132 Port testlib from QStringRef to QStringView
Task-number: QTBUG-84319
Change-Id: I780945c8923c0a03e9c0a32d039da0c793f650fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-11 06:52:13 +02:00
Lars Knoll
4895ae10c6 Port QtSql from QStringRef to QStringView
Task-number: QTBUG-84319
Change-Id: Icc9b955dae1aa13b16c01e26192cb82f828903b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-11 06:52:03 +02:00
Lars Knoll
d984adac68 Port QtGui from QStringRef to QStringView
Task-number: QTBUG-84319
Change-Id: I1761096fbcc9421a013cf73f831a2a2ba0c18006
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-06-11 02:51:03 +02:00
Lars Knoll
82a0f4a193 Port mimetypes away from QStringRef
Task-number: QTBUG-84319
Change-Id: I2bed1149df7f11495fd9dc3577828c0790b17dab
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-06-11 02:50:49 +02:00
Lars Knoll
ecacb3c62f Port QLocale::quoteString from QStringRef to QStringView
Task-number: QTBUG-84319
Change-Id: I29726ebfda7a5f51a0a6ee29e905b0b904256c8d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-11 02:50:16 +02:00
Lorn Potter
ce8c33e710 wasm: fix network POST data corruption
Emscripten does not like when the post data gets deleted in the local
scope.

Fixes: QTBUG-84685
Pick-to: 5.15
Change-Id: I17f9d5cc3253c26b42253daa68e2fbaccc48eaf6
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-06-11 09:24:45 +10:00
Friedemann Kleint
ad532ce118 Fix QToolButton menus showing on primary screens in multiscreen setups
Calculate an initial position based on the current size hint
and pass it to QMenuPrivate::exec(), which does screen checks
based on it.

Amends a78d667431.

Pick-to: 5.15
Fixes: QTBUG-84462
Task-number: QTBUG-78966
Change-Id: Icae8d2bc0fb50c4c853cfebaa2b2250fc06542e3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-10 19:59:12 +02:00
Volker Hilsheimer
fa5ae76356 Merge QToolTip::showText overloads as per ### Qt 6 comments
Change-Id: Ic156fed27bd535daf828e5d95049591833614307
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2020-06-10 19:59:05 +02:00
Volker Hilsheimer
ea09e2f466 Clean up special functions for QTextFrame::iterator
Member initialization syntax allows declaring now inline default
constructor as default. Remove copy/move/assignment operators, which
had already been disabled.

Change-Id: Ie407e65aa39c72f5e6436a6beaf9323663f78cfc
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-06-10 19:58:57 +02:00
Shawn Rutledge
84e76c37a5 Restore default role names in QStandardItemModel::roleNames()
Amends 32b586864e, which added an override
of QStandardItemModel::roleNames().  It's good for it to have its own
QHash so that roles can be added, and because
QStandardItemModel::setItemRoleNames() remains un-deprecated; but before
that change, they were the roles that QAbstractItemModel had initialized
from QAbstractItemModelPrivate::defaultRoleNames().  In particular, we
need "display" to map to Qt::DisplayRole by default; several tests in
qtdeclarative depend on that.

Change-Id: I58b2d6aa6b6c78b1d618335ddc4ecb834af57274
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-10 19:58:48 +02:00
Friedemann Kleint
7ec12b2902 Move the UNIX event dispatchers into QtGui
Task-number: QTBUG-83255
Change-Id: I7d32eb1ec01784c9ed6bf5fc4913ffc5b3a34a49
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-06-10 19:58:19 +02:00
Kai Koehne
732c670590 Doc: Improve documentation for QLocale::FormatType
LongFormat and ShortFormat are not limited to day and month names.
Different locales might also use numbers for months instead of strings,
so the example is a bit misleading.

Instead of extending the enum description even more there's now
examples in the dateFormat(), timeFormat(), dateTimeFormat()
functions.

Task-number: QTBUG-83841
Pick-to: 5.15
Change-Id: Icea2cbce7e9505d706a2171e7d1f4486abdb20be
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-06-10 14:49:18 +00:00
Giuseppe D'Angelo
8e98a161e9 Long live std::pair!
Make QPair an alias for std::pair, and qMakePair just a forwarder
towards std::make_pair.

Why? Fundamentally to ditch a bunch of NIH code; gain for free
structured bindings, std::tuple and std::reference_wrapper
compatibility, and so on.

Breakages:

* Some that code manually forward declares QPair.
We don't care about it (<QContainerFwd> is the proper way).

* Some code that overloads on std::pair and QPair. Luckily
it's mostly centralized: debug, metatypes, testing macros.
Just remove the QPair overload.

* Usages of qMakePair forcing the template type parameters.
There are a handful of these in qtbase, but only one was actually
broken.

* std::pair is NOT (and will never likely be) trivially copiable.
This is agreed to be a mistake done by practically all implementations
in C++11, can can't be fixed without breaking ABI.
Some code using QPair assuming it's trivially copiable may break;
exactly one occurrence was in qtbase.

* QMetaType logic extracts the type names in two different ways,
one by looking at the source code string (e.g. extracted by moc)
and one via some ad-hoc reflection in C++. We need to make
"QPair" (as spelled in the source code) be the same as "std::pair"
(gathered via reflection, which will see through the alias)
when compared. The way it's already done e.g. for QList is
by actually replacing the moc-extracted name with the name
of the actual type used in C++; do the same here.
On libc++, std::pair is actually in an inline namespace --
i.e. std::__1::pair; the reflection will extract and store
"std::__1::pair" so we need an ad-hoc fix to QMetaType.

[ChangeLog][QtCore][QPair] QPair is now an alias to std::pair,
and does not exist as a class in Qt any more. This may break
code such as functions overloaded for both QPair and std::pair.
Usually, the overload taking a QPair can be safely discarded,
leaving only the one taking a std::pair. QPair API has not changed,
and qMakePair is still available for compatibility (although
new code is encouraged to use std::pair and std::make_pair
directly instead).

Change-Id: I7725c751bf23946cde577b1406e86a336c0a3dcf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-10 16:49:08 +02:00
Marc Mutz
ce5931aaf2 QLatin1String: add toString()
For symmetry with other views.

[ChangeLog][QtCore][QLatin1String] Added toString().

Change-Id: I4a0677e2dbd009e8da097f4cb0dbb27a6baf5469
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-10 16:48:43 +02:00
Eirik Aavitsland
56f40cdca6 Remove the openglextensions module
[ChangeLog][General] The QtOpenglExtensions module has been
discontinued. It provided only convenience functionality for certain
direct OpenGL usage. With the new RHI graphics API abstraction, that
is no longer a primary use case. Applications that still need to
access that API have a number of alternative options, including
QOpenGLExtraFunctions.

Fixes: QTBUG-84085
Change-Id: I272af61c69ebcec207b576d67d08b59623d485ec
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-06-10 09:35:04 +02:00
Lars Knoll
122d66f69f Port QtNetwork from QStringRef to QStringView
Task-number: QTBUG-84319
Change-Id: I0f4e83c282b58ab4cc5e397b21981978f79d92cf
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-06-10 09:09:36 +02:00
Lars Knoll
4ab3089a2c Port QUrl away from QStringRef
Task-number: QTBUG-84319
Change-Id: I6167599ac86f17d37fbb6ea90d302641969b0f72
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-10 09:09:29 +02:00
Lars Knoll
957b999683 Port QMetaObject away from QStringRef
Task-number: QTBUG-84319
Change-Id: I905c2e1780a2ec42b1d189494bd5399e124df354
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-10 09:09:22 +02:00
Lars Knoll
7b05e5df18 Port QLibraryInfo from QStringRef to QStringView
Task-number: QTBUG-84319
Change-Id: I500e43e1918b22d636f11c915967e75223be9ef2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-10 09:09:15 +02:00
Lars Knoll
6c108ee0c4 Port QtWidgets from QStringRef to QStringView
Change-Id: Ibe348e7aea838ab8c2d628bb43709c867a506637
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-10 07:08:57 +00:00
Mårten Nordheim
be61790a9e Remove accidental leftover debug printout
Change-Id: I1de2f1dfd8ba4a19049ef96d85cf15206510410d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-10 08:35:15 +02:00
Paul Wicking
f3c402a6df Doc snippets: Use nullptr instead of 0 literal
Also mark constructors explicit, where applicable.

Pick-to: 5.15
Fixes: QTBUG-84859
Change-Id: I145d366d854fd6b4373bcc23d0b880d6361d9014
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2020-06-10 07:47:37 +02:00
Giuseppe D'Angelo
c208b648f9 qGetPtrHelper: make it work with null d-pointers
operator-> comes with the precondition that the smart pointer
is not null. Having null d-pointers is a valid use case, so
enable it by using get() instead of operator->().

Change-Id: I78d77ca8c44e92a65ca98b15d0620bc3a1917ad2
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2020-06-10 02:46:42 +02:00
Giuseppe D'Angelo
d7c75ee005 Q(E)SDP: add get()
[ChangeLog][QtCore][QSharedDataPointer] Added get() for
STL compatibility.
[ChangeLog][QtCore][QExplicitlySharedDataPointer] Added get() for
STL compatibility.

Change-Id: I1acb3b4f4bd70842ed53f6437be10404b67d9909
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2020-06-10 00:08:12 +02:00