Commit Graph

47290 Commits

Author SHA1 Message Date
Ulf Hermann
7127bf1d04 Rename QSequentialIterable::ref
Follow the naming convention and remove workarounds in ctors.

Change-Id: Ic7f9de074edab7db369803612a2a2a4ea3deaf57
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-24 09:37:42 +02:00
Ulf Hermann
3fdc08b422 Remove private QSequentialIterable begin/end methods
Those are only used by the only friend of the class. As that one can
already poke into QSequentialIteralble's privates, there is no point
in exposing further methods in the public API.

Change-Id: I368e7bcfc43c31f38a42a41a339ff3135d79417c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-24 09:37:36 +02:00
Eskil Abrahamsen Blomfeldt
f70b955ce8 Remove the QPF2 font engine
The QPF2 font engine has been kept around for compatibility
reasons in Qt 5.x, and it is time for it to retire for now. If
we want something like this in the future, we can revive it with
hardware acceleration / Qt Quick as one of the primary use cases,
but for now, it seems that Freetype and our existing caching is
sufficient also for low-end use cases.

[ChangeLog][QtGui][Text] Removed support for the legacy QPF2 font
format as well as the makeqpf tool used to generate those files.

Change-Id: Id43039c92fe5bd95b628cd769e045c029f39a350
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-24 07:08:45 +02:00
Lars Knoll
75097c7782 Make the canConvertMetaObject method safe
This triggered a crash in QtQml, where an manually created
metattype interface set the PointerToQObject flag to true while
not providing a metaobject.

Change-Id: I206fb9655058a1e8a2d04e44186b05db33358338
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-24 00:19:48 +02:00
Lars Knoll
02dfec9209 Remove QVariant(QDataStream) constructor
The constructor wasn't constructing a QVariant holding a
QDataStream, bug loading the variant from the datastream.

This is opposed to how QDataStream works in all other places,
and also not in line with all other constructors for QVariant.

[ChangeLog][QtCore][QVariant] Removed the QVariant(QDataStream)
constructor. Use QVariant().load(datastream) instead.

Change-Id: I6ac54e12166b9383c09c3940eef2516f896fd359
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:19:42 +02:00
Lars Knoll
0161f00e50 Use QMetaType in QMetaCallEvent
And don't use int based type mapping anymore.

Change-Id: I456e76d1933ef646a7bd39ce565886b89e938a44
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:19:36 +02:00
Lars Knoll
700e6341e5 Pass QMetaType by value
Now that QMetaType is not refcounted anymore, we can and should
pass it by value.

Change-Id: I848db65070713762f548ca949097c27783aacad4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:19:30 +02:00
Lars Knoll
369cb1470d Clean up int based convert() API
Pass QMetaType instances instead.

Change-Id: I07366cea566fdebf5bb793aa8087f8109216ec0c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:19:24 +02:00
Lars Knoll
e7e7540aec Deprecate int based convert/canConvert
Better to provide the correct meta type to convert to.

Change-Id: I8e0d46e4ba482186201c157e302c03874bd38e7b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:19:18 +02:00
Lars Knoll
92a31781bb Return a qsizetype from QMetaType::sizeOf()/alignOf()
Object sizes in Qt 6 should use qsizetype.

Change-Id: I76ceb5faf361d7f6be88d88c772358ad6d701d54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:19:11 +02:00
Lars Knoll
1697fbdf05 Deprecate the static int based API in QMetaType
And remove one of the type id to name mapping that still
existed in QMetaType. QMetaTypeInterface can provide that,
so there's no need to have a second copy of the data.

qMetaTypeTypeInternal() can still map all the names of all
builtin types to ids. That functionality is for now still
required by moc and can't be removed yet.

Change-Id: Ib4f8e9c71e1e7d99d52da9e44477c9a1f1805e57
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-24 00:19:05 +02:00
Lars Knoll
92b3767632 Remove refcounting of QMetaTypeInterface
It's only used for dynamic types in DBUS and QML, where we control
things good enough to be able to handle the lifetime of those
interfaces there.

Change-Id: Ia7f8970d17a85b195db85fcdc2d8f1febd8753f4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:18:58 +02:00
Lars Knoll
d0ccb3aaf9 Cleanup the qRegisterMetaType function
Remove the arguments that are nowadays unused.

Change-Id: I97ed983b158aba57653f35e7e2f91f5c79dace8c
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-08-24 00:18:52 +02:00
Lars Knoll
9c501b0670 Remove an unused enum value and document another one
Change-Id: If9fed4f20242d789c1251b8798d7378d2d6911a6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:18:45 +02:00
Lars Knoll
13c1e3f434 Cleanup qvariant_cast<>
Move the last functionality it had (casting between QObject
derived types) over to QMetaType. Now qvariant_cast<> is
nothing but a wrapper around QMetaType::convert().

Change-Id: Iab02b6b97c141d64052823646e18227d1eb403dd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:18:37 +02:00
Lars Knoll
c7ce1bc05c Move conversions to and from *Iterables into QMetaType
Those were not yet supported by QMetaType.

Change-Id: I9f85476049f200e35939ac58ef7e8b4e7cbe0b77
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-24 00:18:31 +02:00
Lars Knoll
9d36032370 Implement QMetaType::canConvert() and use it in QVariant
Use the fact that we return the conversion function as a lambda
to find out reliably whether a conversion between two types
can be done.

This requires some minor adjustments to our tests:

* Nothing can convert to an unknown type and vice versa
* Adjust results to the fact that we don't convert from char
  to QString anymore (where the old method was incorrect)
* QStringList->QString requires some adjustments, as we only
  convert if the string list has exactly one element. For now
  we return true in canConvert(), but the conversion behavior
  in this case is something we should rethink, as it is very
  surprising.

Change-Id: I3f5f87ee9cb99d690f5a7d13b13d6a6313d8038e
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-08-24 00:18:24 +02:00
Lars Knoll
2d3b31171d Get rid of the old QVariant conversion codepath
All conversions do now happen through QMetaType::convert().

Change-Id: I70f7a883262087768acccf8361d34c0490ff2b43
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:18:17 +02:00
Lars Knoll
53047c3623 Move QJsonValue and QCborValue conversions to QMetaType
Change-Id: Id4796e0913c0c5b0abce0ea27bed0f7b41bc0cca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:18:10 +02:00
Lars Knoll
b69a1d8eed Remove some unused code
Change-Id: I184c0e00562b9cc61e628457629633f8157333ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:18:04 +02:00
Lars Knoll
2b83244402 Finish porting number conversions to QMetaType
Change-Id: I2861c6fb5f8192a627ffb41f1455c703849cf945
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:57 +02:00
Lars Knoll
fefb1c1362 Move enum conversions over into QMetaType
Take the opportunity to properly handle the underlying type
(size and signed vs unsigned).

Change-Id: I0cb8cf40acac6de03c24ed3fe570db68268952c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:50 +02:00
Lars Knoll
f21a7116e9 Implement integral conversions in QMetaType
Change-Id: Ib2617d37b80bb45818dcd093744cfe5a37a74606
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:40 +02:00
Lars Knoll
4ccf76ff53 Start porting conversions over from QVariant to QMetaType
This will ensure full symmetry in what QVariant and
QMetaType support. With this done, QVariant will become
simply a container that can hold any QMetaType with fully
symmetric functionality between both.

Change-Id: I796d4368a2bc0f08cf4f70f4465ed6a0e07bdd76
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-08-24 00:17:33 +02:00
Lars Knoll
e45fa5aaf0 Remove some dead code
Change-Id: Ic1cd0a70b2412c0e4bfcc06bf5609f9d4590ae66
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:26 +02:00
Lars Knoll
1d7a9fc9b4 Add a metatype helper class for Qt Core
This helps get better symmetry with the other modules,
and to unify the code paths for both conversion and
retrieving the interface for static types.

Change-Id: Icbd20de2563f36e3de20d826323acd057734abfb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:19 +02:00
Lars Knoll
f44d2ea1cc Always try to conversions through QMetaType
Always ask QMetaType to convert first before trying the builtin
code in QVariant. That way we can migrate conversions piece by
piece to QMetaType.

Change-Id: I4fd1bad3ef045d37f84f68e748a6357e0ee0c16c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:12 +02:00
Lars Knoll
560a419281 Use QVariant::Private::typeId()
Avoid some atomic operations by using this instead
of type().id().

Change-Id: Ic664794908d3a9fc3686f954b582740b73c052c6
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-08-24 00:17:06 +02:00
Lars Knoll
524edc7363 Clean up QVariant::Private::Data
Remove all the internal members of the union. Instead replace
it with raw storage (uchar[]) aligned to max_align_t.

Place all accesses to the internal members with get<> methods
for consistency.

Change-Id: Icebf46b90c9375aa6ea0b5913b2132608e8c223d
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-08-24 00:17:05 +02:00
Lars Knoll
bfbac6be75 Get rid of the private v_cast<>() method
Replace it with QVariant::Private::get<>().

Change-Id: I801742300d9b15f748bb91fcd6cfa176d2057271
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-08-24 00:17:05 +02:00
Lars Knoll
d1c3f81126 Add QVariant::Private::storage(), get() and typeId()
Adds convenient access to the data from the Private pointer.
data() determines the storage location at run time, get()
at compile time. internalStorage() can be used if we're accessing
one of multiple types, but know that the type is stored internally.

typeId() is an optimization as it allows retrieving the type id
of the metatype without atomic refcounting operations (which
type().id() would be doing).

Change-Id: I39a508c530a1588053248607c8932e501fd474dc
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-08-24 00:17:05 +02:00
Lars Knoll
73fd7f2efc Use QMetaTypeModuleHelper as the interface to do type conversions
Move the type conversions from QVariant::Helper to QMetaType. Only do
this for Qt Gui in a first step.

This makes it possible to completely remove the Handler struct in
QVariant, and now allows QMetaType to also convert Gui types.

Moving the conversion of Core types into QMetaType will require
further work.

Change-Id: I061f789deca1b595d92bb29227eb54b8e71a3ee3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:05 +02:00
Lars Knoll
a701b0ed30 Fix compiler warnings in autotest
Change-Id: I891b31fa86c6e0e8bcbfb6e6760e093d33598b47
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:05 +02:00
Lars Knoll
0e4ae4fbf8 Clean up the converter function handling
Use std::function to register the converter functions
instead of our own handrolled interface.

Change-Id: Ifc1d1d383d21ee8d4239dbc3970c1f31bf0f4037
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:05 +02:00
Lars Knoll
7f009b648f Get rid of the additional bool * parameter to the internal convert method
That parameter is duplicating the return value, get rid of it.

Change-Id: I8d6ecee8aca90aecaf08e6d0072d83e9a08ce3d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:04 +02:00
Lars Knoll
47b5821c4e Get rid of the unused meta type switcher
Change-Id: I8771feb68227bf69643b66314284c645cccdec6f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:04 +02:00
Lars Knoll
68c4449d2f Cleanup v_construct and friends
Streamline code using if constexpr and remove some unused code paths.

Change-Id: I602acffab4b3e53fab9e2433856f6b7e8210cc60
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:04 +02:00
Lars Knoll
fb0968049f Inline QVariant::constData()
This should speed up quite some of the QVariant operations

Change-Id: Ifae2df39e47e2e1ef1d9a947802bdd17fc66aa66
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:04 +02:00
Lars Knoll
ab867673f0 Cleanup unused code
Change-Id: I27821ca7e63fccd5353c48eebfde19756846dd2e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:04 +02:00
Lars Knoll
6754198c33 Cleanup QVariant::PrivateShared
Remove the additional indirection through ptr and replace
it with an offset calculation. Get rid of PrivateSharedEx
that was handling certain types differently.

This also fixes the support for overaligned types, by
using the alignment field from QMetaType to determine
the alignment requirements.

Change-Id: Icc6a78eb57f664c7747450578fe58dfee8f2863b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:04 +02:00
Lars Knoll
76e8e8e9c8 Always use the variants internal space if possible
There's no point in storing small types with an external
refcount, even if they aren't movable. Simply copying
the type should be faster in pretty much all cases, while
this uses less memory.

Change-Id: I127474f8e3c5fa042f530684f9d5bfccbba134ca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:04 +02:00
Lars Knoll
cb17157b27 Simplify the QVariant copy constructor and assignment operator
Change-Id: Id517dfc220adf06c5852745c92cfbe5e9c2e94a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:04 +02:00
Lars Knoll
0daa9dbfc4 Generate less code when creating QMetaTypeInterfaces
There is no need to generate wrapper functions for equals,
lessThan or debugStream for pointer types, as those can
easily be handled by a few lines of code in QMetaType itself.

Change-Id: If79b3bc3a629249c1d17c9e592202f08b59f80ef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:04 +02:00
Lars Knoll
bd64f9397a Refactor Q*Iterable
Refactor the methods retrieving data in Q*Iterable so
that we don't return pointers with unclear ownership. Instead,
copy the data into a out pointer provided by the caller.

This also means there is no need for the metatype flags
anymore and we can remove those.

Change-Id: I517de23a8ccfd608585ca00403aca0df2955f14b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-24 00:17:04 +02:00
Lars Knoll
49f2253be3 Cleanups in the Iterable classes
Store a QMetaType, not a meta type id in the classes.

Change-Id: If27a60512a46fa029cc914d65b8cad7f89d7f3b0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:04 +02:00
Lars Knoll
d78df77485 Clean up a custom void_t implementation
Change-Id: I30fcaef2a242cc2daee82d37debdb97e59a9a8f2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:04 +02:00
Lars Knoll
6d95ffe996 Cleanups in QSequentialIterable
Remove the old revision of the interface, this is not
required with Qt 6 anymore, as everything is being
recompiled anyway.

Change-Id: I66070c4dc6b5e2a6d22f5a9ebea7688ed38333fe
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-08-24 00:17:04 +02:00
Lars Knoll
804cb94da9 Small doc fix
Change-Id: I349f68c4b86558aba5db4e8fbe5d876447baaeb3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-08-24 00:17:03 +02:00
Lars Knoll
fc4a08cee7 Remove some dead code
This code is now unused, as streaming operators are
registered automatically.

Change-Id: I0e48944c33a92cf1f2f158fb2dc0ca49256d7938
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-24 00:17:03 +02:00
Lars Knoll
ef6c5f29ab Get rid of the custom debug stream handling in QVariant
Use the builtin support in QMetaType instead.

Change-Id: Ifc0e88719a384aa7fb525652bada22b6f7ee1c45
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-24 00:17:03 +02:00