summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
Commit message (Collapse)AuthorAgeFilesLines
* Avoid doing kill(-1) in QProcess destructorDimitrios Apostolou2020-10-291-4/+5
| | | | | | | | | It can happen under unspecified conditions, see relevant ticket. Task-number: QTBUG-86285 Pick-to: 5.15 Change-Id: I1f77bf0061a0faaa60283bb93fc3d82031247d54 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QStorageInfo: Make comparison operators hidden friendsVolker Hilsheimer2020-10-292-19/+14
| | | | | | | | Reduce ADL noise. Task-number: QTBUG-87973 Change-Id: Ia8957e6452cdebac808ec2a20d475db448863149 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Doc: Remove mentioning of old macos versions from QSettingsKai Koehne2020-10-281-1/+1
| | | | | | | | | | The specific mentioning of macOS 10.2, 10.3 goes back to Qt 4 times. Anyhow, both versions aren't supported anymore, and the logic in qsettings_mac.cpp is the same for all versions. Pick-to: 5.15 Change-Id: Ibac503cb7c8563dec8560cc41c471c1db0f20566 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Remove usage of deprecated QStandardPaths::DataLocationKarsten Heimrich2020-10-233-25/+12
| | | | | | | | | * Rearrange the documention to match the enumeration order. Fixes: QTBUG-87037 Change-Id: Iad001351e0f309e694b8bbd503813017e6586a21 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Deprecate QVariant::TypeLars Knoll2020-10-233-26/+26
| | | | | | | | | It's been obsolete for a long time already. Make sure the compiler now warns about it and remove all remaining uses in qtbase. Change-Id: I0ff80311184dba52d2ba5f4e2fabe0d47fdc59d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Whitespace cleanup in corelib/iov6.0.0-beta2Allan Sandfeld Jensen2020-10-2018-224/+224
| | | | | | | | | Selective application of clang-format to follow our coding style where it is significantly off. Change-Id: I0ff4ed146fe53922691d5473d0c236f31d478a04 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QFileSystemWatcher: use nullptr, instead of 0Giuseppe D'Angelo2020-10-201-1/+1
| | | | | | | | | I'm not sure why this hasn't been flagged so far, probably we don't have this warning enabled on MSVC. Task-number: QTBUG-87713 Change-Id: I97c65079c8f8e439645ff7fe75eede9b01b26166 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add function to access QLockFile's file nameShantanu Tushar2020-10-182-0/+10
| | | | | | | | This is useful in cases like error handling when you need to print the name of the lock file. Change-Id: Ife4901ed53ae81d19e68cce7f1c173ef3745d56f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix allocated memory of QByteArray returned by QIODevice::readLineKai Koehne2020-10-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | If the maxSize argument is 0 (the default), QIODevice::readLine will allocate a QByteArray with the size of the next chunk of data, which may be quite large. Before returning, it then resizes the byte array to the actual size that was read. But since change 6b884d2aa129, QByteArray::resize() does no longer shrink the capacity. This means that the returned QByteArray keeps it's maximum size as allocated memory. This can lead to excessive memory consumption, especially if the returned QByteArray's are stored for further processing in the client code. Fix this by explicitly calling QByteArray::squeeze() before returning. [ChangeLog][QtCore][QIODevice] Fixes a regression in Qt 5.15 causing QByteArray's that are returned by QIODevice::readLine() to consume large amounts of memory. Fixes: QTBUG-87010 Pick-to: 5.15 Change-Id: I1f95fc4098849e900680fc945238bfeda881022c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Refactor QMutexLocker to be able to handle recursive mutexesLars Knoll2020-10-171-1/+1
| | | | | | | | Since we're going to split QMutex and QRecursiveMutex into separate classes, make sure QMutexLocker is prepared for that. Change-Id: Id5e9a955d1db7c8ee663dd3811ad6448dad0aeae Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix some bad uses of QSharedPointerData::operator T*Allan Sandfeld Jensen2020-10-162-10/+12
| | | | | | | | Avoid detaching where possible Change-Id: I438d3e66689aeef05951af86a48af2a6910da7c2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.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>
* Fix warning: 'open' has superfluous mode bits; missing O_CREAT?Alessandro Portale2020-10-091-1/+1
| | | | | | | | Adding mode flags doesn't make sense if you don't create a file but only open if for reading. Change-Id: I9307b07cbbcddea565fff9258de7f7beb373a8ad Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix a compiler warning on AndroidLars Knoll2020-10-081-1/+1
| | | | | Change-Id: Ia3d1ee6dccfbf335d689513d51c3920cfa102166 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-075-5/+5
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Convert a couple of APIs to use viewsLars Knoll2020-10-062-3/+3
| | | | | | | | | | | Try to get rid of APIs that use raw 'const {char, QChar} *, length' pairs. Instead, use QByteArrayView or QStringView. As QStringConverter is a new class, simply change the API to what we'd like to have. Also adjust hidden API in QStringBuilder and friends. Change-Id: I897d47f63a7b965f5574a1e51da64147f9e981f6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QUrl::fromLocalFile: accept invalid hostnamesThiago Macieira2020-10-051-3/+11
| | | | | | | | | | | | | | | | | | | | QUrl hostnames must be compliant with STD3, but we must somehow accept file paths that begin with double slash but aren't valid hostnames. Because the file URI spec requires us to start with "file://" anyway, we can represent those with four slashes. Note that on Unix "//X/y" is a valid but local file path. If given to QUrl::fromLocalFile(), if the path at the root does parse as a hostname, we will still try to normalize (the above becomes "file://x/y"). [ChangeLog][QtCore][QUrl] Changed QUrl::fromLocalFile() to accept Windows UNC paths whose hostname component is not a valid Internet hostname. This makes QUrl able to accept extended-length paths (\\?\), device namespace (\\.\), WSL (\\wsl$), etc. Pick-to: 5.15 Fixes: QTBUG-86277 Change-Id: I3eb349b832c14610895efffd1635759348214a3b Reviewed-by: David Faure <david.faure@kdab.com>
* Replace Q_DECL_UNUSED with [[maybe_unused]]Allan Sandfeld Jensen2020-10-031-16/+16
| | | | | | | Use C++17 attribute directly Change-Id: Id853e7a5117065e4adb549f81303c1820fe198ce Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Centralize the implementation of move assignment operatorsGiuseppe D'Angelo2020-10-037-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment we have two main strategies for dealing with move assignment in Qt: 1) move-and-swap, used by "containers" (in the broad sense): containers, but also smart pointers and similar classes that can hold user-defined types; 2) pure swap, used by containers that hold only memory (e.g. QString, QByteArray, ...) as well as most implicitly shared datatypes. Given the fact that a move assignment operator's code is just boilerplate (whether it's move-and-swap or pure swap), provide two _strictly internal_ macros to help write them, and apply the macros across corelib and gui, porting away from the hand-rolled implementations. The rule of thumb when porting to the new macros is: * Try to stick to the existing code behavior, unless broken * if changing, then follow this checklist: * if the class does not have a move constructor => pure swap (but consider ADDING a move constructor, if possible!) * if the class does have a move constructor, try to follow the criteria above, namely: * if the class holds only memory, pure swap; * if the class may hold anything else but memory (file handles, etc.), then move and swap. Noteworthy details: * some operators planned to be removed in Qt 6 were not ported; * as drive-by, some move constructors were simplified to be using qExchange(); others were outright broken and got fixed; * some contained some more interesting code and were not touched. Change-Id: Idaab3489247dcbabb6df3fa1e5286b69e1d372e9 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove typedef Q_PIDFriedemann Kleint2020-10-024-25/+14
| | | | | | | | | | | It is not used in public API any more since 0f8848b7e25e4d8fb9265ff6e0aa31946addd741. Replace by an internal Windows-specific Q_PROCESS_INFORMATION typedef. Change-Id: Ia6dcc83ca667c40ac5d678c00d143c09d650e42a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QProcessPrivate: Use member initializationFriedemann Kleint2020-10-022-39/+18
| | | | | | Change-Id: I9fb8120a68daaa41c153010a52f7a3e99087153b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFileInfo: Allow constructing from QFileDeviceThorbjørn Lindeijer2020-10-012-4/+4
| | | | | | | | | | | Also allow QFileDevice argument to QFileInfo::setFile. This parameter change allows conveniently constructing a QFileInfo from a QSaveFile, in addition to QFile. Change-Id: I71244cb79b1cf92425eaff0e6de13524de562e0f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove deprecated QProcess::pidVolker Hilsheimer2020-10-012-24/+1
| | | | | Change-Id: I6bce5b374a9e22f0a3d67755dbd0f8e14458ce3b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Properly deprecate QProcess::pidVolker Hilsheimer2020-10-012-2/+5
| | | | | | | | | | | Address an old ### Qt 5 comment. The method has been documented as deprecated and replaced by QProcess::processId since at least Qt 5.9, so we can first properly flag it as such for 5.15.2, and remove it from Qt 6 in a follow-up commit. Change-Id: Ic4e3351740617083b16723db8eef7a341bccfbf6 Pick-to: 5.15 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix qdoc warnings from references to removed APIsVolker Hilsheimer2020-09-262-2/+1
| | | | | Change-Id: Id41052be0878715eda4879fcd3171a30ddd5a9a7 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Fix -Wmaybe-uninitialized warningsJulien Schueller2020-09-261-1/+1
| | | | | | | | | Fixes few of these, for example: qurlrecode.cpp:308:19: warning: 'ucs4' may be used uninitialized in this function [-Wmaybe-uninitialized] *output++ = ucs4; Change-Id: Iaf09fa854102c76b51e6e18556c5ef20212e57cf Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Replace Q_REQUIRED_RESULT with [[nodiscard]]Allan Sandfeld Jensen2020-09-251-2/+2
| | | | | | | It was already used many places directly making the code inconsistent. Change-Id: I3b14bc6c333640fb3ba33c71eba97e78c973e44b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix qdoc warning from flag instead of enum type in \enumVolker Hilsheimer2020-09-231-1/+1
| | | | | Change-Id: Ia6b1152c99905ac805b411c9a77144879adfd848 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix qdoc warning: yet another std::filesystemVolker Hilsheimer2020-09-231-1/+1
| | | | | Change-Id: If3c2e7ea3ae32e9596c51623449a405b16b27a5f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix some qdoc warnings: std::filesystem::path gettersVolker Hilsheimer2020-09-223-4/+4
| | | | | | | Those APIs need to be declared for qdoc runs, even if cxx17_filesystem is not. Change-Id: Iaa437aa424f35d0414b6b79328bcafb49af872b3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix some qdoc warnings: function parameter namesVolker Hilsheimer2020-09-221-1/+1
| | | | | | | In QTextDocument and QTextFormat, standardize language a bit. Change-Id: I7c81ecc7a32e36ec32214e6b5386a2827cfcbc3f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QFile::copy: call syncToDisk on destinationThiago Macieira2020-09-221-1/+1
| | | | | | | | Syncing the source makes no sense. Fixes: QTBUG-86806 Change-Id: I0d3ff441bec041728945fffd1637205d9cf6ab72 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix some MSVC conversion warningsFriedemann Kleint2020-09-221-2/+2
| | | | | Change-Id: Ib2c1fdb7b84f89201136438362ab5962126ec929 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Silence qdoc warnings from std::filesystemVolker Hilsheimer2020-09-211-0/+7
| | | | | | | | | We change the declaration of the new APIs using std::filesystem::path for qdoc runs, and need to forward declare it consistently for qdoc builds to avoid a flood of clang warnings when building documentation. Change-Id: Iddcf0ce7d6207b6cc5910790315ab21076bd6ce1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QDir: add note to docs about isAbsolutePath(":foo") returning trueAhmad Samir2020-09-191-1/+5
| | | | | | | | | | | As can be seen in the _q_resolveEntryAndCreateLegacyEngine_recursive method in QFileSystemEngine, paths starting with ':' are treated as QResources, which means that from QFileInfo's POV they're "not relative", which is why QDir::isAbsolutePath would return true. Pick-to: 5.15 5.12 Change-Id: I701d08ce43ea707bc34c928e39bea0b83597a4b6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QDir: Use QDoc syntaxAhmad Samir2020-09-181-6/+6
| | | | | | | Replace Note/Note: with \note. Change-Id: I9a4cd79836fced9d858a478304a03e6c4bccfed5 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Make usage of forkfd_pidfd in QProcess a configurable featureAlexandru Croitor2020-09-171-0/+6
| | | | | | | | | | | | | | | | | | | Our CI cross-compiling arm qemu builds have issues in tests that use QProcess, due to user-space qemu seemingly not supporting pidfds properly. Add a 'forkfd_pidfd' configure.json feature, which can be manually disabled when configuring Qt, causing QProcess to do a regular fork instead of using the new pidfd kernel feature. This will help us avoid the regression of multiple tests failing on the new Ubuntu 20.04 CI host images when they are run via qemu. Task-number: QTBUG-86285 Task-number: QTBUG-86187 Task-number: QTBUG-86198 Change-Id: Ib2209d7e95126e0fb738bf59e39070d5a62c482f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFile: for filesystem::path, use iteratorsMårten Nordheim2020-09-161-5/+2
| | | | | Change-Id: I06477d48191e5c02ebf362ee31d8db5b1f76247a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Remove outdated informationPaul Wicking2020-09-141-5/+0
| | | | | | | | | Seems this information is obsolete, get rid of it. Fixes: QTBUG-86607 Pick-to: 5.15 Change-Id: I0250e32b3c312c7da0363dd1b0d7f676bbfa0115 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Purge Q_{STDLIB,COMPILER}_UNICODE_STRINGSEdward Welbourne2020-09-141-2/+0
| | | | | | | | | These were now always defined, hence redundant. Leave the #define in place so that we can verify we actually do always define it, in a #else of an existing #if check on it. Change-Id: Iea4c3dbc8f9982268bcf81da5ef17fe2ebf5c462 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Compile on QNX after QFlags constructor deprecationThiago Macieira2020-09-131-2/+2
| | | | | | | | | | The QFlags constructor taking a plain zero literal was deprecated in commit af2daafde72db02454d24b7d691aa6861525ab99. Pick-to: 5.15 Fixes: QTBUG-86585 Change-Id: I2fc68c725ba649218bd9fffd1633d6251649d2bd Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Rename QLibraryInfo::location() to path()Lars Knoll2020-09-122-3/+3
| | | | | | | | As per ### Qt6 comment. Also rename the LibraryLocation enum to LibraryPath. Change-Id: I556025a19c5bcdf2ff52598eaba32269522d4128 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix Qt6 related comments in qdebugLars Knoll2020-09-112-45/+33
| | | | | Change-Id: I9861d29a6615863094cd007178f214a816865eb7 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Get rid of QEnableIfLars Knoll2020-09-111-3/+3
| | | | | | | Use std::enable_if instead. Change-Id: I02a2f3066f9e4cab6db1909681a17330afdbbedb Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Document that this method got added in 6.0Lars Knoll2020-09-111-0/+1
| | | | | | Change-Id: I6a7f35f81b9df83f911781516ec7e0ed82e09303 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Introduce QProcess::startCommand(QString, OpenMode)Joerg Bornemann2020-09-102-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The removal of the QProcess::start(QString, OpenMode) leads to more porting work than anticipated. A call like QProcess p; p.start(cmdline); must be transformed in the following cumbersome way: QProcess p; QStringList args = QProcess::splitCommand(cmdline); QString program = args.takeFirst(); p.start(program, args); This patch revives QProcess::start(QString, OpenMode) and renames it to QProcess::startCommand. This is still source-incompatible, but the transformation is much simpler: QProcess p; p.startCommand(cmdline); [ChangeLog][QtCore][QProcess] Added QProcess::startCommand(QString, OpenMode) as replacement for the removed QProcess::start(QString, OpenMode). Change-Id: I5499bbb39a025e115042c43a4cc63affddae585c Reviewed-by: hjk <hjk@qt.io>
* Revert "Do not wait in QWindowsPipe{Reader|Writer}::stop()"Alex Trotsenko2020-09-104-30/+14
| | | | | | | | | | | | | | This reverts commit c7ec07d40115bef849574c81d619b629af9434a9. Reason for revert: This causes a memory leak on program termination. The initial commit was an attempt to fix a deadlock where the user destroys object from a thread that does not own the object. This is an unsupported case and should be treated as an invalid report. Pick-to: 5.15 Change-Id: I4957784b86a0361adb65b9d023542f96480f00ba Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Fix a number of MSVC integer conversion warningsFriedemann Kleint2020-09-101-1/+1
| | | | | | | | Mostly related to qstrlen(). Change-Id: I69e2052c83766e4fc466ed398d0d0eac011a77ec Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* QProcess/Unix: introduce setChildProcessModifier()Thiago Macieira2020-09-084-22/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][Source-Incompatible Changes] QProcess::setupChildProcess() was removed. To execute code in a child process, use QProcess::setChildProcessModifier() [ChangeLog][QtCore][QProcess] Added setChildProcessModifier() function with which one can provide code to be run in the Unix child process between fork() and execve(). With this function, it is no longer necessary to derive from QProcess in order to execute actions in the child process. Another reason is that we can tell whether the std::function carries a valid target much more easily than we can tell whether QProcess was overridden. The setupChildProcess() virtual function does not need to be marked final, since no overrider could ever return an inaccessible private class. This also makes sure the error presented to the user is about the return type, not about attempting to override a final. Clang: error: virtual function 'f' has a different return type ('void') than the function it overrides (which has return type 'QProcess::Use_setChildProcessModifier_Instead') GCC: error: conflicting return type specified for 'virtual void MyProcess::setupChildProcess()' note: overridden function is 'virtual QProcess::Use_setChildProcessModifier_Instead QProcess::setupChildProcess()' ICC: error: return type is neither identical to nor covariant with return type "QProcess::Use_setChildProcessModifier_Instead" of overridden virtual function "QProcess::setupChildProcess" MSVC is not relevant since it doesn't compile to Unix. Change-Id: Ia8b65350cd5d49debca9fffd15f801161363aea7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Long live QKeyCombination!Giuseppe D'Angelo2020-09-031-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++20 via P1120 is deprecating arithmetic operations between unrelated enumeration types, and GCC 10 is already complaining. Hence, these operations might become illegal in C++23 or C++26 at the latest. A case of this that affects Qt is in key combinations: a QKeySequence can be constructed by summing / ORing modifiers and a key, for instance: Qt::CTRL + Qt::Key_A Qt::SHIFT | Qt::CTRL | Qt::Key_G (recommended, see below) The problem is that the modifiers and the key belong to different enumerations (and there's 2 enumerations for the modifier, and one for the key). To solve this: add a dedicated class to represent a combination of keys, and operators between those enumerations to build instances of this class. I would've simply defined operator|, but again docs and pre-existing code use operator+ as well, so added both to at least tackle simple cases (modifier + key). Multiple modifiers create a problem: operator+ between them yields int, not the corresponding flags type (because operator+ is not overloaded for this use case): Qt::CTRL + Qt::SHIFT + Qt::Key_A \__________________/ / int / \______________/ int Not only this loses track of the datatypes involved, but it would also then "add" the key (with NO warnings, now its int + enum, so it's not mixing enums!) and yielding int again. I don't want to special-case this; the point of the class is that int is the wrong datatype. Everything works just fine when using operator| instead: Qt::CTRL | Qt::SHIFT | Qt::Key_A \__________________/ / Qt::Modifiers / \______________/ QKeyCombination So I'm defining operator+ so that the simple cases still work, but also deprecating it. Port some code around Qt to the new class. In certain cases, it's a huge win for clarity. In some others, I've just added the necessary casts to make it still compile without warnings, without attempting refactorings. [ChangeLog][QtCore][QKeyCombination] New class to represent a combination of a key and zero or more modifiers, to be used when defining shortcuts or similar. [ChangeLog][Potentially Source-Incompatible Changes] A keyboard modifier (such as Qt::CTRL, Qt::AltModifier, etc.) should be combined with a key (such as Qt::Key_A, Qt::Key_F1, etc.) by using operator|, not operator+. The result is now an object of type QKeyCombination, that stores the key and the modifiers. Change-Id: I657a3a328232f059023fff69c5031ee31cc91dd6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>