summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Clean up QVariant::Private::DataLars Knoll2020-08-243-115/+90
| | | | | | | | | | | 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>
* Get rid of the private v_cast<>() methodLars Knoll2020-08-242-213/+187
| | | | | | | Replace it with QVariant::Private::get<>(). Change-Id: I801742300d9b15f748bb91fcd6cfa176d2057271 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Add QVariant::Private::storage(), get() and typeId()Lars Knoll2020-08-241-0/+19
| | | | | | | | | | | | | | 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>
* Use QMetaTypeModuleHelper as the interface to do type conversionsLars Knoll2020-08-247-238/+123
| | | | | | | | | | | | | | 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>
* Fix compiler warnings in autotestLars Knoll2020-08-241-1/+2
| | | | | Change-Id: I891b31fa86c6e0e8bcbfb6e6760e093d33598b47 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Clean up the converter function handlingLars Knoll2020-08-242-128/+43
| | | | | | | | 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>
* Get rid of the additional bool * parameter to the internal convert methodLars Knoll2020-08-243-71/+61
| | | | | | | That parameter is duplicating the return value, get rid of it. Change-Id: I8d6ecee8aca90aecaf08e6d0072d83e9a08ce3d6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Get rid of the unused meta type switcherLars Knoll2020-08-245-94/+0
| | | | | Change-Id: I8771feb68227bf69643b66314284c645cccdec6f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Cleanup v_construct and friendsLars Knoll2020-08-241-73/+9
| | | | | | | Streamline code using if constexpr and remove some unused code paths. Change-Id: I602acffab4b3e53fab9e2433856f6b7e8210cc60 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Inline QVariant::constData()Lars Knoll2020-08-242-10/+4
| | | | | | | This should speed up quite some of the QVariant operations Change-Id: Ifae2df39e47e2e1ef1d9a947802bdd17fc66aa66 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Cleanup unused codeLars Knoll2020-08-243-11/+0
| | | | | Change-Id: I27821ca7e63fccd5353c48eebfde19756846dd2e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Cleanup QVariant::PrivateSharedLars Knoll2020-08-243-45/+56
| | | | | | | | | | | | | 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>
* Always use the variants internal space if possibleLars Knoll2020-08-243-5/+5
| | | | | | | | | | 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>
* Simplify the QVariant copy constructor and assignment operatorLars Knoll2020-08-241-5/+7
| | | | | Change-Id: Id517dfc220adf06c5852745c92cfbe5e9c2e94a3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Generate less code when creating QMetaTypeInterfacesLars Knoll2020-08-243-12/+23
| | | | | | | | | 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>
* Refactor Q*IterableLars Knoll2020-08-246-153/+103
| | | | | | | | | | | | 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>
* Cleanups in the Iterable classesLars Knoll2020-08-244-58/+52
| | | | | | | Store a QMetaType, not a meta type id in the classes. Change-Id: If27a60512a46fa029cc914d65b8cad7f89d7f3b0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Clean up a custom void_t implementationLars Knoll2020-08-241-8/+3
| | | | | Change-Id: I30fcaef2a242cc2daee82d37debdb97e59a9a8f2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Cleanups in QSequentialIterableLars Knoll2020-08-242-27/+13
| | | | | | | | | 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>
* Small doc fixLars Knoll2020-08-241-3/+1
| | | | | | | | 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>
* Remove some dead codeLars Knoll2020-08-244-84/+0
| | | | | | | | This code is now unused, as streaming operators are registered automatically. Change-Id: I0e48944c33a92cf1f2f158fb2dc0ca49256d7938 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Get rid of the custom debug stream handling in QVariantLars Knoll2020-08-245-138/+6
| | | | | | | | 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>
* Automatically register data/debug stream operations in QMetaTypeLars Knoll2020-08-2418-470/+225
| | | | | | | | | | | | | | | | | | | | | | And remove the old manual registration code for those operators. Add some special handling for long/ulong, as these types could be streamed as a QVariant so far, but are not directly streamable through QDataStream. [ChangeLog][QtCore][QMetaType] The QMetaType::registerStreamOperators() and QMetaType::registerDebugStreamOperator() methods have been removed. The streaming operators for a type are now automatically registered together with the type registration. This implies that the operators should be visible wherever the type is visible and being used. [ChangeLog][Behavior Incompatible Changes] Because the QDataStream and QDebug serialization operators are automatically registered with QMetaType, the declarations of those functions must be present at any point where the type is used with QMetaType and QVariant. Change-Id: I4a0732651b20319af4a8397ff90b848ca4580d99 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QWidget: drop an unncessary const_castGiuseppe D'Angelo2020-08-241-1/+1
| | | | | | | Thanks to the newly introduced indexOf overload. Change-Id: I00377591dba4104f1dfd34816cc74efcf5220a4d Reviewed-by: David Faure <david.faure@kdab.com>
* QLineF::intersects(): Make the output parameter optionalSze Howe Koh2020-08-231-1/+1
| | | | | | Change-Id: I1ccd290a81b38db2e86958fa8ce188878484dcc4 Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix include in public headerKai Koehne2020-08-231-1/+1
| | | | | | | | We shouldn't rely on include path containing also /QtCore Task-number: QTBUG-82615 Change-Id: I0f98f6097865cc5aa2c2fc9a0fabf2c4513b7afe Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Merge the two QUrl::fromUserInput overloadsDavid Faure2020-08-232-64/+36
| | | | | Change-Id: I4d4cd0961c30e898118c0a5f74bcd3234173384a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Leave a comment about a usage of a restricted bool trickGiuseppe D'Angelo2020-08-231-0/+2
| | | | | | | | | | | | | | I'm pretty sure we want to keep supporting statements like bool ok = connect(~~~); that is, statements that do use copy initialization and not direct initialization. As such, QMetaObject::Connection has to keep using the restricted bool trick and cannot be ported over to explicit operator bool. Change-Id: I07a38f7c134686e67b5984aa93fe5cf3201561d7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QAutoPointer: port to explicit operator boolGiuseppe D'Angelo2020-08-231-3/+1
| | | | | Change-Id: Ic8ec02d7225e884bfd98d93398502a8b8b825da8 Reviewed-by: David Faure <david.faure@kdab.com>
* pro2cmake.py: support multiple versions in QT_QML_SOURCE_VERSIONMitch Curtis2020-08-231-4/+8
| | | | | | Task-number: QTBUG-86174 Change-Id: I56f4a54874410a19f782ce4dda2e166789570fb9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove the deprecated -qpa-platform-guard argumentJoerg Bornemann2020-08-234-17/+0
| | | | | Change-Id: I0bde5552c8801660e2be57531d64b6d2b499bb32 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Implement configure -gdb-indexJoerg Bornemann2020-08-234-2/+11
| | | | | Change-Id: Iea0fb99297751b1baf830a416ea5041d0b9a3b63 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix detection of the 'debug' featureJoerg Bornemann2020-08-232-1/+2
| | | | | | | | | | | | | The debug feature for the CMake build is solely determined by the value of CMAKE_BUILD_TYPE or CMAKE_CONFIGURATION_TYPES. There is no point in restricting the autoDetect expression to developer builds or MSVC and macOS builds. User-visible result: -DCMAKE_BUILD_TYPE=Debug now actually turns the 'debug' feature on, also for non-developer builds on Linux. Change-Id: I65c92575c9483bff16beb78b60606c55aeadcece Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Actually evaluate AUTODETECT expressions in featuresJoerg Bornemann2020-08-231-1/+2
| | | | | | | | Very simple AUTODETECT expressions worked fine, but expressions with parentheses, for example, were not correctly evaluated. Change-Id: Ibec4fa55474e149a701f861838fdea41d31beca0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Support configure tests of type 'linkerSupportsFlag'Joerg Bornemann2020-08-234-0/+57
| | | | | | Task-number: QTBUG-86155 Change-Id: I3764d99cd4ad1c432b499ec9ba7c4c48391fa421 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Implement configure -optimize-sizeJoerg Bornemann2020-08-234-2/+12
| | | | | | | | | | | | This configure switch controls the feature 'optimize_size'. This isn't merely a mapping to CMAKE_BUILD_TYPE=MinSizeRel, because we potentially want to combine -optimize-size with -force-debug-info, which maps to CMAKE_BUILD_CONFIG=RelWithDebInfo. Task-number: QTBUG-85373 Change-Id: I1a9343ebc54816f52e90e9d33ea3df4c99b1ec9f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix configure setting superfluous featuresJoerg Bornemann2020-08-231-5/+7
| | | | | | | | | | | | | Command line options like -debug result in setting the variable INPUT_debug. INPUT_debug is mapped to the CMake argument -DCMAKE_BUILD_TYPE=Debug. INPUT_debug also matches the feature 'debug', and the CMake argument -DFEATURE_debug=ON was passed. Do not pass -DFEATURE_xxx CMake arguments for inputs that are already handled. Change-Id: If096dff1c6dd694545c6f671f5f3512a43c3ec50 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Document more configure argument mappingsJoerg Bornemann2020-08-231-3/+3
| | | | | Change-Id: Icda71c14cde638e874cc2e6406527b9c98535165 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix tst_moc to build when tests are built as part of Qt treeAlexandru Croitor2020-08-231-0/+1
| | | | | | | | | | | | | tst_moc uses qt_wrap_cpp, which tries to dispatch to qt6_wrap_cpp depending on the value of QT_DEFAULT_MAJOR_VERSION. That value is only set in Qt6CoreConfigExtras.cmake.in, which is not loaded as part of the qtbase build unless something does find_package(Qt6Core). Set the QT_DEFAULT_MAJOR_VERSION to 6 before including the Qt6CoreMacros in the qtbase top-level project. Change-Id: I7b81d89d965f755e51727007e68771ac3931ac55 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix creation of host-qmake wrapper when cross-compilingAlexandru Croitor2020-08-231-1/+2
| | | | | | | | | The -host prefix was added to the 'preliminary' directory rather than the actual wrapper shell script. This caused it to be overwritten every time by the cross-compiled qmake binary. Change-Id: I103811c6aa9181fa701e3e7ecaf828ecdd1e3c90 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Workaround building DBus 'car' example with qmakeAlexandru Croitor2020-08-233-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While trying to implement instructions for building examples with qmake in the CI, an issue has surfaced. When building examples with CMake with -DBUILD_EXAMPLES=ON in the CI, the examples are built in-source, aka source dir == build dir. This means that the header files generated by qdbusxml2cpp will be placed in the qtbase source dir. The instructions that try to build examples with qmake build the examples in a separate build dir after building the examples with CMake. Unfortunately the qtbase/examples/dbus/remotecontrolledcar/car example includes the generated DBus adaptor header via a statement like #include "car_adaptor.h" and the compiler prefers to pick up the header file from the example source dir (the one generated by CMake), rather than the one generated by qmake in the example build dir. Because CMake's DBus integration uses different flags than qmake's DBus integration, the generated header file code is not compatible with the qmake generated cpp file, and the example fails to link when building with qmake, because it can't find an appropriate constructor symbol. In an ideal world, we wouldn't do in-source builds with the CMake build, but that leads to other issues which I currently don't recall. To circumvent the issue, adapt the CMake DBus qt6_add_dbus_adaptor function to allow not passing the problematic '-l' flag by making it optional. This shouldn't break existing code, but allows us to generate a compatible header that will be used by qmake and succeed in linking the example. Task-number: QTBUG-85986 Change-Id: I06759f79aeb66bb32da7f158f55dd4734c4a9887 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QStringTokenizer: use sliced() instead of mid()Marc Mutz2020-08-231-2/+2
| | | | | | | | The code was developed against the narrow-contract version of mid(), but not updated when mid() became wide-contract. Change-Id: I038054fb3f5acc0085c48fbf36af13dd14c917b8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* [trivial] tst_qstringapisymmetry: remove remnants of from() experimentMarc Mutz2020-08-231-10/+14
| | | | | | | | Reduce the scopes so that also the result of 1-arg-sliced() can be called 'sliced'. Change-Id: Ie156f76838f8650d6926d3c198007aaf12f90734 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port QLatin1String to qsizetype and add narrow-contract substring functionsMarc Mutz2020-08-235-68/+154
| | | | | | | | | | | | | | | | | | | | | | QLatin1String::mid() etc were changed from narrow to wide contract, but the narrow-contract replacements weren't added. This blocks using the narrow-contract functions in QStringTokenizer. As a drive-by, Q_REQUIRED_RESULT -> [[nodiscard]] and Q_DECL_CONSTEXPR -> constexpr. Also centralize most Q_ASSERT()s in a single function, verify(), in an attempt to reduce the amount of string data generated from the asserts in assertive builds. [ChangeLog][QtCore][QLatin1String] Added from(), sliced(), first(n), last(n) functions. [ChangeLog][QtCore][QLatin1String] size_type/size() is now qsizetype (was: int). This makes QLatin1String(ptr, 0) ambiguous now between the (ptr, ptr) and (ptr, qsizetype) constructors. Change-Id: Ie195f66ae1974eb0752c058aa9f3b0853ed92477 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Drop spurious const from parameterEdward Welbourne2020-08-231-1/+1
| | | | | | | | Quanifying a parameter passed by value (which is correct for QTime, there is no need to pass it by reference) as const is pointless. Change-Id: I86850f65dfac28ffcc4a8633dd6d212259bb33d0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix crash on serializing default-constructed QTimeZoneEdward Welbourne2020-08-232-3/+39
| | | | | | | | | | | | | | The serialization code neglected to check against null. Sinze zones are saved either by IANA ID or in our special OffsetFromUtc format, representing an invalid zone by a string that cannot possibly be a valid IANA ID will do. Fixes: QTBUG-86019 Pick-to: 5.15 Pick-to: 5.12 Change-Id: I6882026403d00f8b254aab34c645f1cf8f9fcc2d Reviewed-by: Taylor Braun-Jones <taylor@braun-jones.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix mistake in AESHASH algorithmAllan Sandfeld Jensen2020-08-231-2/+2
| | | | | | | The read data wasn't encoded into the state correctly. Change-Id: Ib0a3b50bfeb56968de5c5e8353b28383cb586271 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Ignore clang-format for GUI snippetsPaul Wicking2020-08-231-0/+2
| | | | | | | | | | | | Among other things, this allows for ignoring proper indentation of code that's contained in a wrapper function which serves the purpose of compiling the snippet only. This is useful because the extra indentation is included in the output generated by QDoc. Task-number: QTBUG-84470 Change-Id: I3d702e82169a87447939f357cbee15cb0f74a391 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Fix CaseSensitivity handling for QRegularExpression in QSortFilterProxyModelMarcel Krems2020-08-232-1/+23
| | | | | | | | | | | setFilterRegExp retains the caseSensitivity() while setFilterRegularExpression did not. Change setFilterRegularExpression to also retain the case sensitivity. Fixes: QTBUG-83313 Pick-to: 5.15 Change-Id: I46f494d320aee99d50612f01f63558c693276989 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: David Faure <david.faure@kdab.com>
* Fix truncation warning in qversionnumber.hMarcel Krems2020-08-231-1/+1
| | | | | | | qversionnumber.h(390): warning C4310: cast truncates constant value Change-Id: I26f525db84d1c3691d9ac3f91f67be0bc4034b41 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>