summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qflags.h
Commit message (Collapse)AuthorAgeFilesLines
* doc: Add template text to \fn commands in qglobal.cppMartin Smith2017-12-081-25/+25
| | | | | | | | | | | | | | This update corrects many qdoc warnings in qglobal.cpp caused by incomplete \fn commands. It also corrects many undocumented parameter errors caused by clang's requirement that the formal parameter names be the same in both the declaration in the include file and the \fn command. Some formal parameter names were changed in the declarations in the header file. Change-Id: I4cd38f30461c585b97ec11923cdbc81a41fe00b8 Reviewed-by: Martin Smith <martin.smith@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-301-1/+1
|\ | | | | | | | | | | | | | | | | Conflicts: src/corelib/thread/qsemaphore.cpp tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: Id35b535e88df63fdfe4007ea92ed4a39c4b6d707
| * QFlags: support enum classes in setFlag()Giuseppe D'Angelo2017-11-241-1/+1
| | | | | | | | | | | | | | Unary ~ is not defined for enum classes, so we need a cast. Change-Id: I79d495ebcc24ab960da8dae3be08eb307a9de448 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-1/+1
|/ | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Add QDataStream streaming operator for QFlagsThiago Macieira2017-02-091-0/+4
| | | | | | | | | | | | We're already using it, for example in qpaintengine_pic.cpp:502: d->s << p << ti.text() << fnt << ti.renderFlags() << [...] ^ [ChangeLog][QtCore][QFlags] Added operator<< and operator>> for streaming QFlags into and out of QDataStreams. Change-Id: I33dc971f005a4848bb8ffffd1478e79d6102d1bc Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Streamline #include <type_traits>Giuseppe D'Angelo2017-01-311-2/+0
| | | | | | | It's included by qglobal.h, so we get it for free in other headers. Change-Id: I90072156e313271a5354a39cbf78a83a6885c431 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove qtypetraits.h's contents altogetherGiuseppe D'Angelo2017-01-121-4/+5
| | | | | | | | | | | | | | | | | So that QFlags can use an (un)signed int matching the underlying type as identified by the compiler and not by us. Requires fixing a few warnings about sign conversion due to QFlags misusages in qtbase that were either plain wrong, or were relying on the enum being backed by an (un)signed int when it wasn't. Keep qtypetraits.h in the source tree in order to prevent source breaks if some downstream #includes it (note however that it did not contain any public API). Change-Id: Ib3a92b98db7031e793a088fb2a3b306eff4d7a3c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rename QtPrivate::is_[un]signed to QtPrivate::Is[Un]signedEnumKai Koehne2016-11-091-1/+1
| | | | | | | | Any other use than for enums should use std::is_[un]signed. Make this explicit by renaming the type traits. Change-Id: I494158563c95c710e710d0d337f4e547006df171 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace custom type traits with std one'sKai Koehne2016-11-081-1/+1
| | | | | | | | | | | | | | | | | | Remove most type traits from qtypetraits.h, but keep the custom implementation of is_signed/is_unsigned. This gets rid of BSD-3 licensed code from Google in a public header (hugh!). The custom implementations for is_signed/is_unsigned are kept because the implementations in gcc's standard headers do not work as we expect for enums - both is_signed and is_unsigned always returns false there - see also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59027 [ChangeLog][QtCore][General] Qt now relies on type traits from the C++ standard library. Change-Id: I3f2188b46949f04ca4482a6ac9afd3482103f0e1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Let Q_DECLARE_METATYPE and Q_DECLARE_FLAGS be undefined under Q_MOC_RUNThiago Macieira2016-05-041-0/+5
| | | | | | | That's required so that they remain in the output from the preprocessor Change-Id: Id69569111e7d4e619e22ffff144b4a1ee90865f0 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QFlags documentation: The constructors are constexprOlivier Goffart2016-03-291-2/+2
| | | | | | | | | | | One day we might add that information to the documentation itself. But it is important to declare them as constexpr otherwise this causes error while parsing code that wants it to be constexpr when generating the documentation of other constexpr function Change-Id: I28120fea90b29fe1e87af0d8cded0f2430e35443 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* Add setFlag method to QFlagsAndre Somers2016-02-081-0/+5
| | | | | | | | | | | | This makes implementing class methods that enable or disable a feature stored in a QFlags<> member easier. [ChangeLog][QtCore][QFlags] Added setFlag method to set or unset a flag Task-number: QTBUG-27100 Change-Id: Ic602abbbf3100df78f21b7918573744d1bbd18c1 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QtCore: Use Q_NULLPTR instead of 0 in all public headersMarc Mutz2015-07-011-1/+1
| | | | | | | | | This is in preparation of adding -Wzero-as-null-pointer-constant (or similar) to the headers check. Task-number: QTBUG-45291 Change-Id: I0cc388ef9faf45cbcf425ad0dc77db3060c104a8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* QFlags: plaster API with Q_DECL_NOTHROWMarc Mutz2015-01-051-36/+37
| | | | | | | | | | | | Yes, this is necessary. The noexcept operator looks for noexcept tagging, not at the contents of the function to determine whether to return true. The more conditionally-noexcept functions are used, the more important it becomes that low-level classes are correctly marked noexcept. In that, it is like constexpr. Change-Id: Ia1aebf9b8d73fd8164c10dfca27a710934ba79a8 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Use Q_DECL_RELAXED_CONSTEXPR in QFlagsOlivier Goffart2014-10-311-7/+7
| | | | | Change-Id: I91073f4bb71e554402fc13cbd0e9ba5b5b95bce0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-07-101-6/+15
|\ | | | | | | Change-Id: Ia12ffdb27ecdf25c2a2bdb0eed1945387502108a
| * Attempt to work with Visual Studio in -Za (strict ANSI) modeThiago Macieira2014-07-051-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Visual Studio always treats enum values as signed int, even when the value doesn't fit in a signed int (like 0x80000000 or larger than 32- the tags themselves are still signed. That causes ambiguity in creating a QFlag from an enum value. Visual C++ defines __STDC__ in C mode, but we have no macro in C++ mode. Also note that the Windows SDK headers don't compile in -Za mode. Task-number: QTBUG-39700 Change-Id: Ia943cef37ac1f539bd461c3c18200b0c365c72b3 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Add support for initializer_list construction in QFlagsAdam Majer2014-07-021-0/+17
|/ | | | | | | | [ChangeLog][QtCore][QFlags] Added initializer_list constructor Task-number: QTBUG-39786 Change-Id: I36967c67b489c2a893fb031954f46f5243aba2c4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add other integer overloads to QFlag's constructorThiago Macieira2014-02-011-3/+9
| | | | | | | | | | | | This avoids "change of sign" warnings as found by ICC when the high bit is set. This often happens when you do X & ~Y as ~Y probably has bit 31 on. If the enum is unsigned, then there's a sign conversion. Change-Id: Ia5f221d928ac0155f4504a70c4046e60c25fbf3b Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Q(UrlTwo)Flags: avoid undefined behaviorMarc Mutz2013-11-071-8/+8
| | | | | | | | | | | | | | Loading an enum with a value that isn't in the enum is undefined, according to Clang's usan. So when doing logical operations on QFlags<E>, don't go through the QFlags(E) constructor, but via QFlags(QFlag) (=int) instead. Apply the same change to QUrlTwoFlags. Change-Id: I5f27e22c4d831482fcbba88b97cb124fb005e3fd Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make QFlags enum flags (C++11 strict enums) friendlyAlbert Astals Cid2013-05-091-7/+8
| | | | | Change-Id: I9ccb3e4d281a545ca1845db4f6aa7ac6c04e8621 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QFlags: Remove text promising 64 bit enums for 5.1Kai Koehne2013-04-281-1/+1
| | | | | Change-Id: I34173abd693cb124beb8feec5e0cee1f7842725e Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-4/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Replace macro qdoc with Q_QDOCDebao Zhang2013-01-081-2/+2
| | | | | | | | Both qdoc and Q_QDOC are used in source code, which looks not good. Change-Id: I4f3a71670278b0758d92bfa5db086a07e1b1acfd Reviewed-by: hjk <qthjk@ovi.com> Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Fix direct compilation of qtypeinfo.h and othersThiago Macieira2012-12-181-1/+2
| | | | | | | | | | | | | | qtypeinfo.h is included by qglobal.h, so it needs to include that before the #ifdef. Otherwise, we get a circular dependency problem with qflags.h: ./QtCore/../../src/corelib/global/qflags.h:60:27: error: "Q_PRIMITIVE_TYPE" has not been declared Also, take the opportunity to fix the other headers that are included from qglobal.h to avoid similar problems in the future. Change-Id: I99a56f42775c24bdcc796995b06509c1ca0cb849 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QFlags: use unsigned int when the enum's underlying is unsignedMarc Mutz2012-09-281-3/+13
| | | | | | | | | | | Replace storage and operator int() return types with unsigned int if the enum is unsigned. This fixes a number of exisiting warnings, in particular with Qt::MouseButton under GCC. Change-Id: Ia12d36212329aec3e9d62a5fbd38809a6c2b36d0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFlags: fail for 64-bit enumsMarc Mutz2012-09-271-0/+3
| | | | | | | | An int is not enough to hold all values of a 64-bit enum, so don't allow to compile QFlags for such enums. Change-Id: Ia291c4a5e2160dfd6d5a35e61a7f71ab571b9d9a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* QFlags: don't provide a constructor from void**Marc Mutz2012-09-221-1/+2
| | | | | | | | | | | | | | | | Use a pointer-to-member instead of void** for Zero, the type that is used to accept only a literal 0, but not other ints, as QFlags ctor arguments. This was developed while trying to find the cause for a build failure in the qCompare<QIcon> specialisation after adding underlying-enum detection to QFlags, and it didn't help, but I think it's a saver alternative to void**, in particular since the ctor in question is implicit. Change-Id: I71c67b0b50e9404e4e42836d09d62663296f58af Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Mark the QFlag and QIncompatibleFlag as primitive.Stephen Kelly2012-07-281-0/+3
| | | | | | Change-Id: I7dab4d029e7840fe4778a750a8dd7367675d7a27 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFlags: complete constexpr'ifcationMarc Mutz2012-07-211-4/+4
| | | | | | Change-Id: Ie7c33bc1e3abaa9100093a84e65bee5f3b80fe0f Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make the QIncompatibleFlag constexpr.Stephen Kelly2012-07-181-3/+3
| | | | | | Change-Id: If99b43b45cc667449dbe7c487b56885c6ce9b1c7 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use Q_DECL_CONSTEXPR for the QFlag's inline constructorLaszlo Papp2012-07-101-2/+2
| | | | | Change-Id: I8f9c7bf0fddb79c6c0937e415c427a0547a5cab0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove Q_CORE_EXPORT from the simple QFlag and QIncompatibleFlagThiago Macieira2012-04-131-2/+2
| | | | | Change-Id: I0302238e817fc7d3b4682c5cc4f9cb51d181a7d2 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Move QFlags to qflags.hThiago Macieira2012-04-131-0/+139
This is a verbatim copy of the source code. Change-Id: I1f7efc75cad1ba05dda31d8ccfd091ae9ae40fd5 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>