summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Document (some) Qt6 changes for QtWidgetsVolker Hilsheimer2020-10-161-0/+47
| | | | | | Change-Id: I8185e7c4d46f77fa80ad351e1e73d53ca30201a6 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix warning, make sure temporary is moved into return valueVolker Hilsheimer2020-10-161-2/+2
| | | | | | | | Seen on clang 12; might be a compiler bug, but doesn't hurt either. Change-Id: I4aba8406c99951106e57fe9e61c688e649963cd6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Don't divide by zero when calculating number of itemsVolker Hilsheimer2020-10-161-1/+1
| | | | | | | | | | | | | | | Amends e74af68654c0eb127277c73e20bda409b83d157b. If the model has children, then row 0 should have a non-zero size, but it's not unthinkable that a delegate returns zero for size hint, so protect against that case. Task-number: QTBUG-87588 Pick-to: 5.15 Change-Id: Ia396f532d42ce5fad8757d629816c3cdc31d84ed Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org>
* QAbstractItemView: don't lose items if model only allows MoveActionVolker Hilsheimer2020-10-165-15/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a model only allows MoveAction, then calls in the view/widget subclasses' dropEvent implementation to set the event's drop action to CopyAction will fail. QAbstractItemView will then remove the item when QDrag::exec returns. Instead of abusing the event actions for this, store explicitly that the dropEvent implementation already moved the item. If the flag is set, don't remove the item. In QListView, which uses moveRow to move items in the dropEvent handler, handle the case that the model might not implement moveRows. In that case, or when dropping an item onto another item (to overwrite data), fall back to the default implementation of QAbstractItemView. Sadly, it is impossible to know whether a model doesn't implement moveRows, or whether the move failed for other reasons, so this requires a bit of extra special case handling. QListView in IconMode is particularly odd in that it moves the item in the view, but not in the model. This follows up on fd894fd68edf3d67975cda8eb9dda43646887b0d and fixes additional issues discovered during debugging. Extend the existing unit test; since drag'n'drop runs a modal, native event loop on most systems, it still only runs on the Xcb platform. Change-Id: I6c5377e2b097c8080001afe904d6d3e4aed33df4 Pick-to: 5.15 Fixes: QTBUG-87057 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Q(E)SDP(V2): fill the API gap left by take()Giuseppe D'Angelo2020-10-163-2/+57
| | | | | | | | | | | | | | | | | | | | | | | | take() returns a pointer to the shared data object *without* decrementing the reference counter. The primary use case is adopting the object from a Q(E)SDP into a different reference counting mechanism. This is fine, but if we support the "extraction" part, we shall also support the "adoption" part. Also, the API for the shared data pointer classes should match. Add an adopting tag type and suitable constructors to the shared data pointer classes, and add take() to the classes lacking it. Drive by, apply qExchange to take()'s implementation. [ChangeLog][QtCore][QAdoptSharedDataTag] New class. It is now possible to adopt pointers to shared data into a QExplicitlySharedDataPointer or a QSharedDataPointer object without incrementing the object's reference counter. Change-Id: I62b8b005c1bfbe2add58566206fca27634bb7e70 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaType: Silence float comparison warnings in QEqualityOperatorForTypeUlf Hermann2020-10-162-0/+6
| | | | | | | | We actually do want to invoke the original equality operator there. If that is unsafe, we cannot do much about it at this point. Change-Id: Iadb2eaba1156828d89022d282c41bda57b500b13 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix "variable set but unused" in qvariant.cppUlf Hermann2020-10-161-1/+1
| | | | | | | ... how did that pass the CI? Change-Id: I84baaf3632df0410d1fb25f24fd22f65daae13af Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add comparison operators to shared data pointersAllan Sandfeld Jensen2020-10-161-32/+28
| | | | | | | To avoid they are compared as bools, or ambiguously. Change-Id: I1495b3126a71c1379e72d4cf53b1a67590eb9f4b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove redundant duplicate of EnableForNonVoid in QFutureWatcherAndrei Golubev2020-10-161-7/+1
| | | | | | | | | qfuturewatcher.h includes qfuture.h, which includes EnableForNonVoid through qfuture_impl.h header. Thus, there is never a need to keep the same alias in QFutureWatcher as it always can use one from QFuture Change-Id: I293fd087aea1a21ef5bcfdf50cdefc176a9703d0 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Fix subtle SFINAE problem in QPromise::addResultAndrei Golubev2020-10-161-3/+1
| | | | | | | | | | | | | | Accidentally found out that we enable/disable QPromise::addResult based on type deduced from input argument, instead of using "value_type" of QPromise itself, which is wrong Simplified the checks to a single one - EnableIfSameOrConvertible<InputType, StoredType> as this is sufficient to account for both cases: QPromise<void> and QPromise<T> with input, convertible to T Change-Id: I657998c0e26241b0fc5e70988622984ece8871df Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Rename QPromise starting and finishing methods to start and finishAndrei Golubev2020-10-162-13/+13
| | | | | | | | | Proposed during API review Change-Id: I9c43e1915c50803ab69bfe07a91c05d2224b86c4 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Make QPromise::addResult() return boolean status of operationAndrei Golubev2020-10-163-49/+56
| | | | | | | | | | | | | | | Changed QPromise::addResult() to return bool value. True is returned when result is added and false is returned when e.g. promise is in final state (canceled or finished) or when addResult() is called twice with the same index as argument (in which case new value is rejected) Updated QFutureInterface::reportFinished() that accepts optional result as argument to align with other result adding methods. This function is "internal" only (as of now), so no documentation update is needed Change-Id: I2d63069246e5e5c8cf04529c22bb296faaaae53d Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Guard vulkan.h inclusion with __has_includeLaszlo Agocs2020-10-161-5/+21
| | | | | | | | | | | | | | | | | | | | | | | | ...and provide our dummy typedefs when vulkan.h is not available. Originally this was there for qdoc, but from the qtdeclarative API review it becomes clear that we need this also when an application - that includes Qt Quick headers which in turn want to use VkImage and co. for type safety - is built on a system without vulkan.h against a Vulkan-enabled Qt build. Also fix some of the typedefs which were technically incorrect. (not that it matters much since the dummy typedefs still do not allow calling exported Qt functions that use the real Vk* types since the function signatures like won't match in some cases (would need to replicate too much hocus pocus from vulkan.h for that), but that's fine since our goal here is to keep application compilation going when it encounters a Vk* type in a Qt header, not about enabling actually calling those functions) Task-number: QTBUG-87450 Change-Id: I855b4478c8707587b28db2408e282145129a0194 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix some bad uses of QSharedPointerData::operator T*Allan Sandfeld Jensen2020-10-168-35/+40
| | | | | | | | Avoid detaching where possible Change-Id: I438d3e66689aeef05951af86a48af2a6910da7c2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Disallow promotion of bool and char in qMin and friendsLars Knoll2020-10-161-1/+3
| | | | | | | | | Feedback on the API review. Make sure, qMin<true, 'a'> and similar constructs don't compile. Change-Id: I59a66348a4168fe306159ddaf2595838d4ed66d1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix signature of QDebug::toString()Lars Knoll2020-10-162-19/+3
| | | | | | | | We don't need two overloads here. Change-Id: Ia6a3bcd93491843e07b0295fefe8da42ae9d6519 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* rhi: Further reduce copying in the command bufferLaszlo Agocs2020-10-167-228/+170
| | | | | Change-Id: I2e2ff5f4b8aa91d0accb01108a5199b98c371455 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* rhi: Unroll the res.binding factory functionsLaszlo Agocs2020-10-161-11/+59
| | | | | | | | | Trading typing in a few lines of straightforward code for a full sizeof(QRhiShaderResourceBinding::Data) copy (with less fortunate compilers that do not manage to optimize it away) is a bad deal. Change-Id: If227320f8a9598508c1fe02c4f56e6d75f0a787b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QSslCertificate (generic) fill the extension's variant mapTimur Pocheptsov2020-10-161-2/+18
| | | | | | | | | When parsing subjectAltName extension to make it more like OpenSSL counterpart. Fixes: QTBUG-86830 Change-Id: If1a4e72ee0b19f2cf40aa53632f9ec1468178c3b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove misleading commentTimur Pocheptsov2020-10-161-6/+0
| | | | | | | | NSSegmentedControl is not of much use for us, due to different problems it shows when rendered. Change-Id: I57be237b33c226d0a84d18c76a4bffb92cea5274 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Remove default parameter from QUnifiedTimer::updateAnimationTimersVolker Hilsheimer2020-10-162-2/+2
| | | | | | | After adjustments in Qt Declarative, this parameter is no longer needed. Change-Id: I4b398748277aa29edd06ac122cfa8984575abf97 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Document noteworthy change in QProcessVolker Hilsheimer2020-10-161-0/+31
| | | | | Change-Id: I4d9769901aef8255fc111f33eb141e05398f0ee3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Purge QDesktopWidgetVolker Hilsheimer2020-10-169-241/+23
| | | | | | | | | | | | It's no longer used; the only calls to QApplicationPrivate::desktop pass the default nullptr for QScreen, so all we need is a Qt::Desktop type toplevel widget. Include changes documentation about both the class and QApplication::desktop being gone in Qt 6. Change-Id: I22d6e93cabc6aaaefffe5e96942886a2ef4e0609 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QMultiHash: fix operator==Giuseppe D'Angelo2020-10-161-2/+7
| | | | | | | | | | | | An empty QMultiHash can still have an allocated dpointer, so we can't desume that two hashes are different because one has a dpointer and the other doesn't. Compares the sizes first, and infer that equal size, and non-zero size, mean both have a dpointer. Fixes: QTBUG-87575 Change-Id: I2e206bd071c02fb8970a4e77f8b0d29ad7e58bbe Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QHash: code tidiesGiuseppe D'Angelo2020-10-161-9/+5
| | | | | | | | | | Apply std::exchange. Remove a wrong comment about MultiNode -- the compiler isn't generating any move operations, the move constructor is user-provided and there isn't a move assignment operator... Change-Id: Idd69458c69cc93e4575c119daba564e0046452c1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QOverload helpers: further cleanupsGiuseppe D'Angelo2020-10-161-3/+3
| | | | | | | constexpr inline means we can remove [[maybe_unused]]. Change-Id: I034b6e742ef750dc1ebeca1d9cc7a2463f8c7b70 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Floating point function helpers: code tidiesGiuseppe D'Angelo2020-10-161-6/+6
| | | | | Change-Id: Id87390734f4ccb28fb83d25788ca600747c2e2a8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QtPrivate::Deprecated_t: code tidiesGiuseppe D'Angelo2020-10-161-1/+1
| | | | | Change-Id: I08ae749b32aa9a302937691c76b7910175c8a71a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QESDP::take(): document that it doesn't derefGiuseppe D'Angelo2020-10-161-1/+4
| | | | | | Change-Id: Iba6c1caf4a7681815559db7c06691d02108ae855 Pick-to: 5.15 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Port QColorTransform to QESDPGiuseppe D'Angelo2020-10-163-17/+8
| | | | | | | | Remove the hand-rolled refcount management code, and cleanup the existing constructors. Change-Id: I1b91dbf888feff25d67310637d42dcdc3acaac13 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Port some more /*implicit*/-like comments to Q_IMPLICITGiuseppe D'Angelo2020-10-165-14/+14
| | | | | Change-Id: Ib70ad3f29365153af647deea54fc45467c413cb9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QTimeZone: drop an implicit conversion commentGiuseppe D'Angelo2020-10-161-1/+1
| | | | | | | | | The constructor isn't selected for conversions anyhow (it has more than one argument), and in Qt we don't mark such constructors as implicit (or explicit) anyways. Change-Id: I4203b946b9c6934aef9eead2db96154f9851ab9a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVariant::compare: handle numerical values and pointers as documentedv6.0.0-beta1Fabian Kosmale2020-10-151-9/+80
| | | | | | | | [ChangeLog][QtCore][QVariant] Comparing two QVariants containing floating point numbers for equality no longer uses fuzzy comparisons. Change-Id: Iaba40a66d8fa566a432547fa1a30d5ea191c7fc0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QLocalSocket/Win: prevent writing to broken pipeAlex Trotsenko2020-10-151-0/+6
| | | | | | | | | | | | When a peer closes the connection, the device remains opened for reading purposes. However, we should disable writing on disconnected socket. Otherwise, if the user issues a write() call, a new pipe writer object will be created and the write call occurs with invalid handle value. Pick-to: 5.15 Change-Id: Id136798c7663df1fce7ed0aa4e3c6f5c65218a11 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Android: fix path issue with backslashes on WindowsAssam Boudjelthia2020-10-151-2/+2
| | | | | | | | | | | | The androiddeployqt tool wasn't handling dependencies with backslashes properly, some dependencies like libplugins_platforms_qtforandroid was written into libs.xml as plugins\platforms\libplugins_platforms_qtforandroid_armeabi, the the app won't be looking for the correct path of the lib to load. Task-number: QTBUG-87574 Change-Id: Iad8c74d30d090adf69a17f2dafb455dff50b3d99 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QOverload helpers: code tidiesGiuseppe D'Angelo2020-10-151-10/+4
| | | | | | | | | Remove pre-C++14 code paths; and mark as `inline` the qOverload helper objects (constexpr variables at namespace scope aren't automatically inline). Change-Id: Ieb2a9f06e39720d0c7215a3d1273c3a5996d0bc7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Migration Guide for QString related changesKarsten Heimrich2020-10-151-0/+84
| | | | | | Task-number: QTBUG-87097 Change-Id: Idcdeaea5a65e91b99a08c2af03c7e76bbe5913bb Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Unwrap private QPalette data memberVolker Hilsheimer2020-10-142-15/+12
| | | | | | | | | Following 556511f9f39ddc887481e0cd5a877134ceb0da6b, there is only one data member in addition to the shared QPalettePrivate, so we don't need a data struct anymore. Change-Id: I8d7f33ed042e47464eb5f60a048956f8bf70e0b9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* rhi: Fix up vertex inputs with matricesLaszlo Agocs2020-10-143-6/+31
| | | | | | | | | | | | In order to prevent too much voodoo in backends like D3D11, the input layout is expected to specify the slice index for vecX that are part of an unrolled matrix. Also deoptimize the instancing manual test to exercise a matrix too instead of just vectors. Change-Id: If2dcbcbc483645ce2420b2f87dda765b95da6e80 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Return false from canFetchMore for uninitialized QFileSystem modelsDoris Verria2020-10-141-0/+2
| | | | | | | Task-number: QTBUG-87273 Pick-to: 5.15 Change-Id: I1787e3dd26ec10cf161d8fa4e329972b6dd4aa6c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix infinite loop triggered when displaying model with QTreeViewDoris Verria2020-10-141-1/+5
| | | | | | | | | For some models like the QFileSystemModel canFetchMore() returns true even though fetchMore() doesn't return anything if setRootPath is false. To prevent an infinite loop, add a check to make sure the model's rowCount was updated during the loop. Fixes: QTBUG-87273 Pick-to: 5.15 Change-Id: I16275fc2765fd77badc1c5d265e8ba5cd250163a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix compile time type normalization codeLars Knoll2020-10-141-81/+146
| | | | | | | | | | | | | | | | | | | | | Use a simpler constexpr to generate type name on gcc This works around an ICE on gcc in release mode when compiling with PCH enabled. As the type we're getting from Q_FUNC_INFO is already in a somewhat normalized form, this requires significanlty less processing and esp. not a recursive constexpr method which I suspect triggers the ICE. Fix integer type conversions to also properly normalize long long values (to q(u)longlong. Make sure the mapping also works on MSVC, where long long types get mapped to __int64. Also, normalize unsigned short and unsigned char to ushort and uchar, respectively, to follow the convention set by uint and ulong. Add some test cases to verify the mappings. Change-Id: I3dec5764450bf22ab6f066597803c3f46c2cd5ac Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Simplify implementations of QtConcurrent::blocking* methodsSona Kurazyan2020-10-142-89/+70
| | | | | | | Call non-blocking methods from the blocking ones. Change-Id: Icf63637223533254b76826340334de35bca258b2 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Minor cleanups based on API reviewSona Kurazyan2020-10-142-7/+7
| | | | | | | | | - Be more more consistent when declaring type aliases. - Re-group include directives Change-Id: Ic521e9f7692e538cc98871bdeccd9644c9879089 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* QMetaType: fix warning messageFabian Kosmale2020-10-141-1/+1
| | | | | Change-Id: I93c8b0d6b490cfed944a2a6a2b64361258a50141 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* General cleanup of qshareddata.hAllan Sandfeld Jensen2020-10-142-134/+135
| | | | | | | | Update the code to something more modern and make the two types more consistent. Change-Id: I524d33fea158e2ba7079fe836164eec03c45649b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Long live Q_IMPLICIT!Giuseppe D'Angelo2020-10-145-19/+25
| | | | | | | | | | | | | C++20 will give us explicit(bool). While we can't use it just yet in its full potential, we can introduce a macro to start marking our implicit conversions (aka `explicit(false)`), removing the need for /* implicit */-like comments. Port a few usages to it. Change-Id: I336d5e4c8d51d8329627900d1059e59062c5cafd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix Qt6 renamingBogDan Vatra2020-10-142-5/+11
| | | | | | | Fixes sha: 1907599bfd817e00c7f42b8cb941ebf93a098e7f Change-Id: I20ece75c321835f13a605ae4d56fee1a034ca7c8 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Use QScroller in the Dir View exampleShawn Rutledge2020-10-141-2/+2
| | | | | | | | | | | We have never had enough examples that show how easy it is to install a QScroller. In this case, one line makes a QTreeView flickable. Pick-to: 5.15 Task-number: QTBUG-86090 Change-Id: Idb8b4709617befb261f3b78d63ddbdaf5ad18d6b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Mark QApplication::fontMetrics as obsoleteVolker Hilsheimer2020-10-142-0/+7
| | | | | | | | | | It returns the QFontMetrics of the desktop widget, so just for the default screen. Any usage of it is probably wrong, esp since code should use QFontMetricsF instead. Change-Id: I0b4b85a74a2c9b6cc023ffda0b2b399f9fc3c1c4 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>