summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
...
| | * | | Use takeFirst() instead of first() with removeFirst()Anton Kudryavtsev2016-04-131-4/+2
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduce code size and improve readability. Change-Id: I5ec035a39cb607f15748aaa08d73f1c1bc8e4ad8 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | | darwin: Move conversion function documentation to function definitionTor Arne Vestbø2016-05-0310-212/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It's easier to maintain the function and the docs when they live together. Change-Id: I1e047b4ac1eb61a36849188da560dd899e05509f Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | | | darwin: Simplify conversion function declarations in headersTor Arne Vestbø2016-05-035-25/+5
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need to include Q_QDOC in the forward-declarations of the native types, and Q_FORWARD_DECLARE_OBJC_CLASS works in non-Objective-C mode as well, which means we can declare the Objective-C versions of the functions without guards. Change-Id: I32089c496b4f7ce47f0388ba3f65e0b091d1e9ee Reviewed-by: Martin Smith <martin.smith@theqtcompany.com> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | | QtBase: use printf-style qWarning/qDebug where possible (II)Marc Mutz2016-05-036-22/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this second part, replace qWarning() << "" << non-QString with qWarning("..%.", non-QString). QString (and QUrl etc) have special escaping handling when streamed into QDebug, so leave those alone. They also seem to expand to less code than the qPrintable() alternative, so there's no reason to replace them. Saves 2KiB, 3.4KiB, ~750b and ~450b in text size in QtCore, Gui, Network and Widgets, resp., on optimized GCC 5.3 AMD64 builds. Change-Id: Iae6823e543544347e628ca1060d6d51e3b04d3f4 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* | | QOpenGLContext: add a way to disable the thread affinity checkGiuseppe D'Angelo2016-05-022-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem of the check is that it makes Qt non compliant with OpenGL thread affinity semantics. One is allowed to make a GL context current on any thread, without the Qt-specific idea of moving the QOpenGLContext to that thread first. Moreover, the move is plain impossible if the user needs to handle the context to 3rd party code which assumes the context to have GL semantics. Add an application flag to disable that. Change-Id: I55ca02ee62f8cc171a9a1bddef5331ad0949c061 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | | Remove remains of Windows CE from QSysInfo.Friedemann Kleint2016-04-301-8/+0
| | | | | | | | | | | | | | | | | | | | | Remove documentation of enumeration values and code from manual test. Change-Id: I8e6cbbe11ab38421fb29595ae79351f5a919ff70 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Make QSharedPointer without custom deleters call the correct destructorThiago Macieira2016-04-282-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Where "correct" is defined by what std::shared_ptr does as well as what happens when an intermediate QSharedPointer of the exact type of the constructor behaves That is, QSharedPointer<X> ptr(new Y); Behaves like QSharedPointer<X> ptr; { QSharedPointer<Y> tmp(new Y); ptr = tmp; } Change-Id: Id75834dab9ed466e94c7ffff14455d445f72592b Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | Add QLibraryInfo::version() returning the Qt version as QVersionNumberThiago Macieira2016-04-273-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QLibraryInfo] Added QLibraryInfo::version(), which returns the current version of the Qt library as a QVersionNumber object. Change-Id: Ifea6e497f11a461db432ffff1448d4dc84ef57b1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | | Revert "Optimize QMetaObject::activate."Milian Wolff2016-04-251-30/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Andre reported issues to me which seem to arise from this patch. Most notably, he showed me a backtrace containing the following assertions. Note how the dtor of ConnectionListsRef is accessing shared data which used to be guarded by the connection lock, which got broken by my patch that is now reverted hereby. A future patch can potentially reintroduce my performance optimization but that will require more evaluation and better checks with TSan or helgrind. Sorry for this. Thread 7 (Thread 0x7fffc7fff700 (LWP 32705)): .0 0x00007ffff55ef267 in raise () from /lib/x86_64-linux-gnu/libc.so.6 No symbol table info available. .1 0x00007ffff55f0eca in abort () from /lib/x86_64-linux-gnu/libc.so.6 No symbol table info available. .2 0x00007ffff62286d7 in qt_message_fatal (context=..., message=...) at global/qlogging.cpp:1647 No locals. .3 0x00007ffff622472a in QMessageLogger::fatal (this=0x7fffc7ff8650, msg=0x7ffff658c9d0 "ASSERT: \"%s\" in file %s, line %d") at global/ qlogging.cpp:792 message = {static null = {<No data fields>}, d = 0x7fffc14f5050} ap = {{gp_offset = 40, fp_offset = 48, overflow_arg_area = 0x7fffc7ff8630, reg_save_area = 0x7fffc7ff8570}} .4 0x00007ffff621cf43 in qt_assert (assertion=0x7ffff6657ba8 "connectionLists->inUse >= 0", file=0x7ffff6656fa7 "kernel/qobject.cpp", line=3646) at global/qglobal.cpp:3036 __PRETTY_FUNCTION__ = "void qt_assert(const char*, const char*, int)" .5 0x00007ffff64db388 in QMetaObject::ConnectionListsRef::~ConnectionListsRef (this=0x7fffc7ff8710, __in_chrg=<optimized out>) at kernel/qobject.cpp:3646 No locals. .6 0x00007ffff64dbe71 in QMetaObject::activate (sender=0x9d2110, signalOffset=3, local_signal_index=1, argv=0x7fffc7ff8850) at kernel/ qobject.cpp:3685 locker = {val = 140737328754040} connectionLists = {connectionLists = 0xa9c460} lists = {0xa9c4e8, 0x7ffff64a0ceb <QMetaObjectPrivate::signalOffset(QMetaObject const*)+89>} numLists = 1 currentThreadId = 0x7fffc7fff700 signal_index = 4 empty_argv = {0x0} __PRETTY_FUNCTION__ = "static void QMetaObject::activate(QObject*, int, int, void**)" .7 0x00007ffff64db300 in QMetaObject::activate (sender=0x9d2110, m=0x7fffe2d66a80 <CppTools::CppModelManager::staticMetaObject>, local_signal_index=1, argv=0x7fffc7ff8850) at kernel/qobject.cpp:3602 No locals. <snip> Thread 4 (Thread 0x7fffc77fe700 (LWP 32712)): .0 <function called from gdb> No symbol table info available. .1 0x00007ffff55ef267 in raise () from /lib/x86_64-linux-gnu/libc.so.6 No symbol table info available. .2 0x00007ffff55f0eca in abort () from /lib/x86_64-linux-gnu/libc.so.6 No symbol table info available. .3 0x00007ffff62286d7 in qt_message_fatal (context=..., message=...) at global/qlogging.cpp:1647 No locals. .4 0x00007ffff622472a in QMessageLogger::fatal (this=0x7fffc77f7500, msg=0x7ffff658c9d0 "ASSERT: \"%s\" in file %s, line %d") at global/ qlogging.cpp:792 message = {static null = {<No data fields>}, d = 0x7fffb94f14b0} ap = {{gp_offset = 40, fp_offset = 48, overflow_arg_area = 0x7fffc77f74e0, reg_save_area = 0x7fffc77f7420}} .5 0x00007ffff621cf43 in qt_assert (assertion=0x7ffff6657ba8 "connectionLists->inUse >= 0", file=0x7ffff6656fa7 "kernel/qobject.cpp", line=3646) at global/qglobal.cpp:3036 __PRETTY_FUNCTION__ = "void qt_assert(const char*, const char*, int)" .6 0x00007ffff64db388 in QMetaObject::ConnectionListsRef::~ConnectionListsRef (this=0x7fffc77f75c0, __in_chrg=<optimized out>) at kernel/qobject.cpp:3646 No locals. .7 0x00007ffff64dbe71 in QMetaObject::activate (sender=0x9d2110, signalOffset=3, local_signal_index=1, argv=0x7fffc77f7700) at kernel/ qobject.cpp:3685 locker = {val = 140737328754040} connectionLists = {connectionLists = 0xa9c460} lists = {0xa9c4e8, 0x7ffff64a0ceb <QMetaObjectPrivate::signalOffset(QMetaObject const*)+89>} numLists = 1 currentThreadId = 0x7fffc77fe700 signal_index = 4 empty_argv = {0x0} __PRETTY_FUNCTION__ = "static void QMetaObject::activate(QObject*, int, int, void**)" .8 0x00007ffff64db300 in QMetaObject::activate (sender=0x9d2110, m=0x7fffe2d66a80 <CppTools::CppModelManager::staticMetaObject>, local_signal_index=1, argv=0x7fffc77f7700) at kernel/qobject.cpp:3602 No locals. .9 0x00007fffe2a7aa0a in CppTools::CppModelManager::documentUpdated (this=0x9d2110, _t1=...) at .moc/debug-shared/moc_cppmodelmanager.cpp:299 _a = {0x0, 0x7fffc77f7740} This reverts commit 8619214c5e76c70e32b47cd002be1adb1bc2f5bf. Change-Id: I13df84012e74a01db750a99a8e5e4bf5357c7f78 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | Append the Windows OS/kernel version number in QSysInfo::prettyProductName().Jake Petroules2016-04-251-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The rationale is to be consistent with other operating systems, all of which print a version number following their name (possibly in parenthesis if the version is typically non-numeric as is always the case with OS X so far and has been with Windows). The version number printed here is only two digits, both for consistency with OS X and because the first two digits of an operating systems's version are typically the limit in marketing materials and general presentation. This also fixes a bug where the returned string would be "Windows " (note the space) in the case where the name of a future Windows version was not known. [ChangeLog][QtCore][QSysInfo] The output of QSysInfo::prettyProductName now includes the Windows OS/kernel version number. In case of future versions of Windows, a valid string is now returned. Change-Id: I588c2e0aaae19337eb69b4645f8bccf8270c75bc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Remove window flags WindowOkButtonHint, WindowCancelButtonHint.Friedemann Kleint2016-04-202-12/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They were duplicating other enumeration values (WindowTransparentForInput, WindowOverridesSystemGestures) and were only supported on Windows CE. Task-number: QTBUG-42897 Task-number: QTBUG-51673 Change-Id: I993a933ee2a3dc8a0ebd7ba6aef80b456f50a657 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Remove dynamic loading of functions that are present in Windows Vista onwards.Friedemann Kleint2016-04-198-129/+55
| | | | | | | | | | | | | | | | | | | | | | | | Invoke functions directly and add libraries accordingly. Task-number: QTBUG-51673 Change-Id: Ie19d1fc6aa932d6e93a7d310048e4c162fb81046 Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
* | | Remove the -qconfig command line argumentLars Knoll2016-04-196-1406/+0
| | | | | | | | | | | | | | | | | | | | | | | | This functionality will get replaced by a new and more flexible system to configure Qt. Change-Id: I04cf694ab1671eeed39b79a660566595a22f54a7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | | Add support for initializing QSharedPointer from nullptrThiago Macieira2016-04-193-9/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | std::shared_ptr supports it. To resolve an ambiguous overload when a literal 0 is passed as a parameter, the normal constructors needed to be made a template, like std::shared_ptr. Task-number: QTBUG-52569 Change-Id: Id75834dab9ed466e94c7ffff14451417892d2148 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | Change the way we handle features that have sub-featuresLars Knoll2016-04-152-17/+12
| | | | | | | | | | | | | | | | | | | | | | | | Make sure we always set the base feature as a flag in qtconfig, and set the sub-feature in addition if it's being used. Change-Id: Icfeb0ec1ac9e1a615b5b22eb5fcce47e0e7fc153 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | | Windows CE cleanup.Friedemann Kleint2016-04-141-9/+0
| | | | | | | | | | | | | | | | | | | | | Remove remaining CE-specific files and #ifdefs. Change-Id: I407e14cade64c9eaa414f333764b4f82a75befde Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Implement ordered dithering for image format conversionsAllan Sandfeld Jensen2016-04-121-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QImage::convertToFormat was ignoring its conversion flag argument, only performing dithering when converting to indexed formats. This patch updates the documentation and implements ordered dithering for other conversions. Change-Id: I807353d61669694185b7e595ef262d80d9fbb3f1 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | | Fix documentation of qOverload with clang based qdocOlivier Goffart2016-04-121-0/+3
| | | | | | | | | | | | | | | Change-Id: I4c9dbefff0e51753fdd6c06a8d0cf1733b8d3d85 Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* | | QUrl documentation: fix clang parsingOlivier Goffart2016-04-111-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QUrl::FormattingOptions need to be declared with Q_DECLARE_FLAGS for documentation purposes. But it's actually a QUrlTwoFlags and need to be so in order to get the default arguments parsed without errors. So hack it by introducing a fake internal QFlags specific to QUrl Change-Id: I851aca2ab3fd4c10d9cb2dc4d6a0f236813d20ad Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-04-1119-5418/+5920
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qobject.cpp src/gui/painting/qpaintengine_raster.cpp Change-Id: I74e1779832f43d033708dcfd6b666c7b4f0111fb
| * | Remove unused variables.Volker Krause2016-04-101-2/+0
| | | | | | | | | | | | | | | Change-Id: I44f4e4f454d86e7a53b44a9b3eb51879f97ae9c6 Reviewed-by: David Faure <david.faure@kdab.com>
| * | QDateTime: don't allocate memory in fromOffsetString()Anton Kudryavtsev2016-04-091-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | Manual splitting instead of QStringRef::split() Change-Id: I27ccf1c4e44ead5b13f85f2cdbd990cb3b874a7a Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| * | QDateTime: add some constAnton Kudryavtsev2016-04-092-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | For CoW types const methods will be called. For QDate we can use new const getDate() method. Change-Id: Ie3a4fe48b3635d270a79c9ac5205b835b3442eae Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| * | QtBase: use erase and std::remove_if with QList and QVectorAnton Kudryavtsev2016-04-081-7/+7
| | | | | | | | | | | | | | | | | | | | | ... instead of using removeAt in a loop, with quadratic complexity. Change-Id: I38b49e56b12c396db9fc0f1b75d8fb43c503a7f6 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| * | add cross-platform tablet->mouse event synth; enable on AndroidShawn Rutledge2016-04-082-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's urgent to fix the issue that on Android, it became impossible to interact with any widget or MouseArea which handles only mouse events but not tablet events, using the stylus, because stylus events are sent only as QTabletEvents. Before 5.6 (change 01d78ba86a631386a4d47b7c12d2a359da28f517) they were sent as touch events, and mouse events were synthesized from those. Whereas on other platforms, every QTabletEvent is followed by a synthesized QMouseEvent. This fix proceeds in the direction that event synthesis should be done in cross-platform code so that platform plugins don't have to repeat it, following the same pattern as for touch->mouse synthesis. Just as in that case, the application can disable it, and the platform plugin can also report that it's unnecessary for Qt to do the synthesis because the platform already does. So QTBUG-51618 is fixed, but QTBUG-47007 requires us to remove the tablet->mouse synthesis from all platform plugins, because the plugin does not know whether the tablet event was accepted or not, so it does not have enough information to decide whether to synthesize a mouse event. Synthesis has been unconditional until now, which contradicts what the documentation says: the mouse event should be sent only if the tablet event is NOT accepted. We can now gradually make this promise come true. [ChangeLog][QtCore][Tablet support] A synthetic mouse event will no longer be sent after every QTabletEvent, only after those which are not accepted (as documented). Task-number: QTBUG-47007 Task-number: QTBUG-51618 Change-Id: I99404e0c2b39bbca4377be6fd48e0c6b20338466 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
| * | toCurrencyString() - Add missing documentationDan Cape2016-04-081-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | Documentation was missing for the new toCurrencyString() function that adds a precision value. Change-Id: I16c10cdd18dfc37839fccb907470b0942f100e5d Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
| * | Re-generate QLocale data from CLDR v29Konstantin Ritt2016-04-084-5315/+5697
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * A bunch of fixes and additions to the locale data * Add new scripts from Unicode 8.0 and 9.0 * Map some potentially useful languages and territories [ChangeLog][QtCore] QLocale data updated to CLDR v29 Change-Id: I759ccb27fe19be2722be913c5c2e6aa5f36e5c14 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
| * | QStringRef: add missing {c,}r{begin,end}()Marc Mutz2016-04-072-18/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most containers have them in Qt 5.7, so add them to QStringRef, too. Brush up the docs, use the const_iterator typedef in the API, for consistency with QString's docs. [ChangeLog][QtCore][QStringRef] Added reverse iterators, rbegin(), rend(), crbegin(), crend(). Change-Id: I3d2884a1b2faae02c610ab3871552b65bc6e2521 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-078-61/+105
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/access/qftp.cpp src/widgets/itemviews/qheaderview.cpp src/widgets/itemviews/qlistview.cpp tests/auto/network/access/qftp/tst_qftp.cpp Change-Id: I9f928f25d45d8944dd60bb583f649fc1615bc5d9
| | * QStringRef: fix some QStringRef <> const char * relational operatorsMarc Mutz2016-04-061-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Their implementations were swapped. Found while extending tst_qstringapisymmetry, which only exists in dev, so test will be added to dev once this change has merged up. [ChangeLog][QtCore][QStringRef] Fixed relational operators against (const char*) to return the correct result. Change-Id: I3f331037571b9a543a6885802836b768143d1c1a Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
| | * Remove empty first lines of files.Friedemann Kleint2016-04-061-1/+0
| | | | | | | | | | | | | | | | | | | | | They might upset licensing related tools. Change-Id: I858d21fc418ba16959c88847b559b11bea29ed6b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
| | * Explain QTimeZonePrivate::isValidId a bit more carefully.Edward Welbourne2016-04-061-17/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Its "rules" are actually guidelines, its suggested regex was wrong, its actual implementation was fuzzier than its documentation suggested and the exception it tacitly permitted should be distinguished from the stricter rules it otherwise appears to implement. There was also a redundant check ('-' had been handled earlier in the chained if). Explain why the situation is tricky, fix the regex mentioned (making it more readable, too) and note what might be worth doing a little more fussily, without actually changing code behavior. Change-Id: I93fa0da0640a134e5d84011b435a186576824063 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| | * Qt Meta macros: Allow tools to define annotationsOlivier Goffart2016-04-062-25/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This might be useful for IDE or other tools to be made aware of Qt macros. This is inspired to what QtCreator[1] and moc-ng[2] does. But they are forced to redefine or inject code at precise location which might be difficult. This is going to make it easier to use libclang in qdoc. With this change, the tooling can just predefine the macro QT_ANNOTATE_FUNCTION and QT_ANNOTATE_CLASS to get what they need. Example with libclang: "-DQT_ANNOTATE_CLASS(type,...)=static_assert(sizeof(#__VA_ARGS__),#type);" "-DQT_ANNOTATE_CLASS2(type,a1,a2)=static_assert(sizeof(#a1,#a2),#type);" "-DQT_ANNOTATE_FUNCTION(a)=__attribute__((annotate(#a)))" "-DQT_ANNOTATE_ACCESS_SPECIFIER(a)=__attribute__((annotate(#a)))" "-DQ_CLASSINFO(name,value)=static_assert(sizeof(name,value),\"qt_classinfo\");" "-DQ_REVISION(v)=__attribute__((annotate(\"qt_revision:\" QT_STRINGIFY2(v))))" [1] qt-creator/cplusplus/wrappedQtHeaders/QtCore/qobjectdefs.h [2] https://code.woboq.org/mocng/src/qobjectdefs-injected.h.html Change-Id: I88fcb28f1dbb3d26ea82f10e9948e68a18c795e9 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> Reviewed-by: Kevin Funk <kevin.funk@kdab.com> Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
| | * QDateTimeParser: Avoid repetition in sectionMaxSizeEdward Welbourne2016-04-051-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The format to use was computed, every time round a loop, in both branches of a ?: choice, duplicating code and potentially computation. Pull it out into a const computed once before the loop. A conditional return 2 is pointless for the #if-branch which returns 2 unconditionally, so move it into the #else. Change-Id: Ia583e958e24f9f37b92cb3f2a173bc07e88bcd06 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| | * QDir: use QString::splitRef on all platformsAnton Kudryavtsev2016-04-051-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... to avoid unnecessary allocations with both case sensitive and case insensitive paths. Optimize 4413254ff603fa19f4fa22d4936e69f4a6dbbc2b Change-Id: I4288831d641f7a0ee67f2efd2f5d4f023df0d39c Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
| | * Fix UB (shift of negative number) in qHash(QModelIndex)Marc Mutz2016-04-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found by UBSan: itemmodels/qabstractitemmodel.h:426:28: runtime error: left shift of negative value -1 Fix by casting the lhs of the left-shift operator to uint before shifting. Since Qt assumes two's complement repre- sentation of signed integers, this should yield the same result as the old code, but without UBs. It is critically important that the result is identical to the old code (modulo the compiler exploiting the UB, which this patch aims to prevent even in future compilers), because the function is inline, and changing the hash value would mean changing the layout of a QHash<QModelIndex,.> between users compiled against the old and new libraries. Change-Id: I7b826a34fb78b02021e40c3f85fd11af398dbec4 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| * | Add support for ImhAnchorRectangleJan Arve Sæther2016-04-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the following API: * QInputMethod::anchorRectangle() * QPlatformInputContext::setSelectionOnFocusObject() This will be used for determining how to display selection handles. Change-Id: If57e3fd58ff0f1ba7899f7dd62bfa9c006028667 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
| * | Move QThread::currentThreadId() down to the loop using it.Erik Verbruggen2016-04-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This prevents the call from happening in case no C++ signal is connected. Change-Id: I32027df446391f3fc979528738a106223042d632 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | qdoc: Remove Q_QDOC for int type() in qmetatype.hMartin Smith2016-04-082-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It probably wasn't necessary in the first place, but it certainly isn't needed now. Also changed a pair of internal qdoc comments on static functions that are not declared outside the .cpp file. Now they are no longer qdoc comments. This change does not require clang in qdoc. Change-Id: I39df3eb1e3f57ba1da93f27892d0c3af8f9481ef Task-number: QTBUG-52454 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | qdoc: Remove Q_QDOC for qRound() and qRound64()Martin Smith2016-04-083-29/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These uses of Q_QDOC cause clang to report syntax errors. They are used to hide function return values as qreal instead of using double and float. The decision is to be more transparent and use double and float in the docs instead of qreal. This change does not require clang in qdoc. Change-Id: I65b3afb693b1eff486b0b45b8d972fec96953c5f Task-number: QTBUG-52454 Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* | | Unify naming of LIBS/CFLAGS for 3rd party librariesLars Knoll2016-04-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Most libs use QMAKE_LIBS/CFLAGS, but some have other naming conventions. Unify them into using QMAKE_LIBS/CFLAGS. Change-Id: I39b188adc1f9a223a83b294c5315c3095a9c68de Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | | QChar: optimize comparison with QString{,Ref}Marc Mutz2016-04-052-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of relying on the QString relational operators to implicitly convert the QChar to a QString, add relational operator overloads that compare the QChar without first turning it into a QString, saving one memory allocation per comparison, and allowing to mark the operation as nothrow. Consequently, in tst_QStringBinOps, verify now that all relational operations are noexcept. The added overloads make QChar ==/!= int comparisons ambiguous. De-ambiguate by providing a constrained template that matches int and nothing but int (otherwise, the QChar and the int versions would compete for a QChar::SpecialCharacter argument, and end up creating new ambiguities). This solution may not be perfect, but it can be easily extended should more ambiguities crop up. The existing overload deals with all patterns found in qtbase. Change-Id: I4156d918e9b9134c1da684b8b69e0ee526ad24e3 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/devLaszlo Agocs2016-04-05201-1717/+2966
|\ \ \
| * | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-04-05201-1717/+2966
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/corelib/ipc/ipc.pro src/plugins/platforms/xcb/qxcbbackingstore.cpp tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp Change-Id: Ia006e10ff1732fe78f90138c41f05b59b49486cf
| | * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-044-22/+54
| | |\| | | | | | | | | | | | | Change-Id: I35ca979395620e104e50b06366d0869433a4ffc2
| | | * QVariant: Fix flags for type-erased associative iterator keyStephen Kelly2016-04-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The flags here are passed to a private QVariant constructor, and they really represent a boolean - IsPointer or not. Because the flag for the key_type was incorrectly populated with the flag for the value_type, memory would be corrupted when using a mapping type whose value_type is a pointer, but whose key type was not, such as QMap<QString, int*> This typo has been there since the concept was introduced in commit v5.2.0-alpha1~807 (Add container access functionality for associative containers in QVariant., 2013-04-05). Task-number: QTBUG-52246 Change-Id: I9ecb13c603015eed2dc2ca43947fa0ecd6be8b5a Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| | | * Enable cmake auto tests for -no-guiKai Pastor2016-03-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change disables tests which require QtGui. Change-Id: Ib647afd086f54536054cb4c0cde5696d762ee8c4 Reviewed-by: Stephen Kelly <steveire@gmail.com> Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
| | | * Fix debug message to match the method's nameLorenz Haas2016-03-251-1/+1
| | | | | | | | | | | | | | | | | | | | Change-Id: Ieaf7366663beeecec3240353d045fb19e2ae99ee Reviewed-by: Louai Al-Khanji <louai.al-khanji@theqtcompany.com>
| | | * Fix qSetMessagePattern to have many time/backtrace partsM. Moellney2016-03-251-20/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous implementation overwrote multiple 'time' parts in the qSetMessagePattern with the last setting in the pattern line. %{time}%{time process}%{time boot} ended up to be output as if %{time boot}%{time boot}%{time boot} was set. This fix keeps the arguments of each individual 'time' part. The same holds for multiple 'backtrace' parts. The previouse implementation overwrote multiple 'backtrace' arguments with the arguments of the last occurrence. This fix keeps the individual arguments for the 'process' parts. The individual arguments are applied in qFormatLogMessage. A new test to verify the individual 'time' arguments application is added, too. Task-number: QTBUG-51944 Change-Id: Ib757614a482c5f31ed0a61b550daa2eea4b907b4 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| | * | QTimeZonePrivate: avoid unnecessary allocationsAnton Kudryavtsev2016-03-312-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... by replacing QString::split() with QString::splitRef() and using the new overloaded functions: - QLocalePrivate::languageToCode(QStringRef) - QLocalePrivate::languageToCode(const QChar*, int) Change-Id: I2884bdc6d3e27963ce121d659a5e092b10b4ef8c Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>