summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Add an extra check for qssize_t's size and typeThiago Macieira2017-05-062-0/+8
| | | | | | | | | | | | | | | | | | | | The definitions of size_t and ptrdiff_t ([support.types.layout] p2 and p3 respectively) do not specify that they need to be as big as a pointer. They just need to be big enough to hold the size of the largest object and the biggest array subscript, respectively, the platform supports (e.g., 16-bit DOS would have them as 16-bit in all memory models, except huge). But we depend on them actually being the size of a pointer in many places, such as in QArrayData::offset, that stores the linear distance from the end of the structure to the beginning of the data, wherever it is in memory. It's also a good idea to verify that qptrdiff and qssize_t are the same type. Change-Id: I9ad33fff8b634979bdbafffd14bbd1223afc58e8 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QWindowsPipeReader: remove code duplication in read()Alex Trotsenko2017-05-051-11/+2
| | | | | | | | QRingBuffer::read() implements the same loop. Change-Id: I480fe07e2400dfaee560f22bdbf07d6cdd013eb2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Implement key-value iteratorSamuel Gaist2017-05-057-0/+410
| | | | | | | | | | | | | This patch implements an iterator that returns a pair containing both the key and the value of an entry in QHash/QMap. [ChangeLog][QtCore][Containers] Added an stl-like iterator to go through QHash/QMap returning both the key and the value of the element pointed to. That lets QHash/QMap interoperate better with stl's algorithms like std::set_union. Change-Id: Idbf8a8581510b3493648c34ab04c556de9fa4aa7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* cleanup: remove redundant QGuiApplicationPrivate::buttonsGatis Paeglis2017-05-053-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This variable was introducing during Qt 5.0 Q{Gui}Application refactoring days (2011 or even before) and since then has been used interchangeably with QGuiApplicationPrivate::mouse_buttons. This patch removes the duplicate member variable as it is redundant and could be a source of potential errors. Initially I was thinking that ::buttons might be used for the purpose of QTestLib, but it is not. QTestLib delivers mouse events directly via qApp->notify() (mouse button state is update via QGuiApplicationPrivate::mouse_buttons from notify()), or via window system interface QWindowSystemInterface::handleMouseEvent (which goes through QGuiApplication::processMouseEvent). Looking at QGuiApplication, it is clear that ::buttons and ::mouse_buttons always have the same value, as there is only one assignment to these members in QGuiApplication: mouse_buttons = buttons = e->buttons; And there are no other places that would assign to QGuiApplicationPrivate::buttons. Change-Id: Ib60d366bf056a98b15bb4538a569693e7bd022e2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Enable c++17 in the QStringApiSymmetry testMarc Mutz2017-05-051-0/+1
| | | | | | | Because it's the correct thing to do. Change-Id: I1d9fb482ffed6f4c36b4bc25d05cabcd07d87a78 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fusion: draw DPI-scaled arrowsJ-P Nurmi2017-05-043-138/+87
| | | | | | | | | Replace the "hard-coded" fusion_arrow.png with qt_fusion_draw_arrow() that scales appropriately on high DPI screens. Task-number: QTBUG-40277 Change-Id: I2c4a134de757a39d7744977bd41accff69810521 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fusion: DPI-scale menu itemsJ-P Nurmi2017-05-041-16/+22
| | | | | | | | | | | The sub-menu arrow indicator is still tiny. The Fusion style uses a pre-made pixmap (fusion_arrow.png) for drawing the various arrow indicators for sub-menus, spinboxes, combo boxes, scrollbars etc. This will be addressed in a separate patch. Task-number: QTBUG-40277 Change-Id: Id82c564340854e922b3b5f5bcf038ec535ed6cf4 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: Decode EDID blobPier Luigi Fiorini2017-05-043-1/+74
| | | | | | | | | | | | Retrieve and parse EDID blob. Return screen product information from EDID. [ChangeLog][Platform Specific Changes][Linux/XCB] Add screen product information from EDID. Change-Id: Ic54429cdc90c41342c37511bcaebce95c175f517 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QStringAlgorithms/private: prefer to trim whitespace from the endMarc Mutz2017-05-041-5/+3
| | | | | | | | | | | | | | When calculating what to trim in trimmed_helper_positions(), first trim the end, then the front. This way, a string that consists of just whitespace will remain anchored at its front, and we do not run into the memmove case in trimmed_helper_inplace, which, even though there's zero elements to move, still calls a potentially-out-of-line function (memmove()). Change-Id: I7024ffa1f7ae2effb9c5166ec8f30a42b8d51079 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Keep in sync uic sources with qttools moduleJarek Kobus2017-05-042-3108/+1664
| | | | | | Change-Id: I680505b8d68f363e6dc86d090632ec9b021ee981 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* tst_qscopedpointer: Actually test what test name says it should testTor Arne Vestbø2017-05-031-1/+1
| | | | | Change-Id: Idda6e34c4438d1695f8268426fe923ad51ff6d10 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QStringApiSymmetry: add checks for trimmed()Marc Mutz2017-05-031-0/+68
| | | | | | | | All good (now). Change-Id: I666773856a239826e646398a943e7df30bd81671 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_qstringapisymmetry: also check potential rvalue overloads of transformationsMarc Mutz2017-05-031-14/+59
| | | | | | | | | | | | For transformations, regardless of whether they're currently overloaded on rvalue-this or not, check the results of calls to const lvalues as well as mutable rvalues. Use the new mixed-type QCOMPARE more. Change-Id: Ibaa436cd88b40e5c0823c3bbe5b04a9964e7e987 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QVulkanWindow: fix fatal warning on Clang 4Shawn Rutledge2017-05-031-1/+1
| | | | | | | | | | | | | | | qtbase/src/gui/vulkan/qvulkanwindow.cpp:1882:42: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces] VkClearColorValue clearColor = { 0.0f, 0.0f, 0.0f, 1.0f }; ^~~~~~~~~~~~~~~~~~~~~~ { } 1 error generated. VkClearColorValue is a union, so it wants to be clear that we are initializing only one of the union's members, apparently. (Even though initing more than one wouldn't make sense.) Change-Id: Id4afa3ddc1b4ce7e24e681fb93c0ee9083c41e08 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* macOS: Replace deprecated NSOKButton usage with NSModalResponseOKTor Arne Vestbø2017-05-031-4/+4
| | | | | Change-Id: Ibecda9bcafc1f366315b5aac8c14d50c49ccf10d Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Remove QAddConstMarc Mutz2017-05-031-5/+1
| | | | | | | | | It was added to support qAsConst(). When <type_traits> became mandatory, porting qAsConst() to std::add_const was forgotten. Change-Id: Ifb9b54d12554ce19dca4664642a8644f49aeb6af Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* eglfs_kms: Decode EDID blobPier Luigi Fiorini2017-05-027-4/+66
| | | | | | | | | | Retrieve and parse EDID blob. Return screen product information from EDID. [ChangeLog][QPA][eglfs][kms] Add screen product information from EDID. Change-Id: I766999afd9298e82f6147fdeba5d14757bfb4b03 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* EDID parser libraryPier Luigi Fiorini2017-05-027-0/+2689
| | | | | | | | | | | | Add a support library to parse EDID that will be used by platform plugins. In order to tell the screen manufacturer from the identifier, the parsers reads /usr/share/hwdata/pnp.ids or, if it's missing, uses a lookup table previously generated from that file with a Python script. Change-Id: Ie021eb68be91f06dc0da54445f88e3533f78d23e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Introducing AA_CompressTabletEventsGabriel de Dietrich2017-05-013-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | Tablet events compression has been missing since commit 60cd1c67759642018ef93cc45a90714729100d9d in 5.6.1, and there's no way to bring the old behavior back. Since tablet events are not taken into account by AA_CompressHighFrequencyEvents on purpose, we introduce this new flag. This new flag is conditional to AA_CompressHighFrequencyEvents being set in order for it to be effective. [ChangeLog][QtCore][Tablet support] If the application attribute AA_CompressTabletEvents is set in addition to AA_CompressHighFrequencyEvents, even the QTabletEvents will be compressed (only on the X11 platform so far). AA_CompressHighFrequencyEvents does not enable compression of tablet events by itself, because paint applications typically need to process all possible tablet events in order to draw the smoothest curves. Change-Id: Ie7434ab4f9a4c64f2626c75e661cfd0d6cd22896 Task-number: QTBUG-44964 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io> Reviewed-by: Wayne Arnold <wayne.arnold@autodesk.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* tuiotouch: Finish categorizing all loggingRobin Burchell2017-04-303-23/+24
| | | | | | | Better than going half way and not quite finishing, and nicer results. Change-Id: If6bf005182534f6fbfc13544d4190d3e54a272e9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add a few std::move in functions accepting slotsOlivier Goffart2017-04-295-14/+21
| | | | | | | | This allows the use of move-only function objects Task-number: QTBUG-60339 Change-Id: If3595fca338cf7f3039eb566cc02e4e73cd04c86 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Support move-only function objects in QObject::connectOlivier Goffart2017-04-293-3/+45
| | | | | | | | | [ChangeLog][QtCore][QObject] Added connect() support for move-only function objects. Task-number: QTBUG-60339 Change-Id: Iae5e48432bb64517b0607b0c2ba23931957f432e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add a spec for the Asus TinkerboardLaszlo Agocs2017-04-282-0/+60
| | | | | | | | Prioritize DRM/KMS for eglfs. There are now binary drivers for Mali that enable DRM, GBM and Wayland. Change-Id: I9ac97f5006f88706854e9160bdafb82f9f8aac5c Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QLatin1String: add startsWith()/endsWith()Marc Mutz2017-04-283-1/+81
| | | | | | | | | [ChangeLog][QtCore][QLatin1String] Added startsWith(), endsWith(). Change-Id: I7f75a5a1f0409f4b9d3e41b73f4fb5d137572b09 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QStringView: add startsWith(), endsWith()Marc Mutz2017-04-284-1/+79
| | | | | Change-Id: I72aef9236daedc3013c62d3f1d737159f85572b8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QString/Ref: add startsWith/endsWith(QStringView) overloadsMarc Mutz2017-04-283-3/+74
| | | | | | | | | | [ChangeLog][QtCore][QString/QStringRef] Added startsWith(), endsWith() overloads taking QStringView. Change-Id: Ice6332492d19fd7477d5ac43ecbf6b70175b23ca Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Long live qStartsWith()/qEndsWith()!Marc Mutz2017-04-282-0/+92
| | | | | | | | | | | | | | | | | Following the established pattern of implementing non-mutating string algorithms as free functions over views with a public qFoo() and a static qt_foo() split, add qStartsWith() and qEndsWith(), calling the existing qt_{starts,ends}_with_impl() templates. [ChangeLog][QtCore][QStringAlgorithms] Added qStartsWith(), qEndsWith(). Change-Id: Ic95c2a9c13883a99f1a96319083fb249f20de5f1 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add move special member functions to QSqlErrorJesus Fernandez2017-04-283-2/+60
| | | | | | | | | | Also mark as shared-come-qt6 and add member-swap. [ChangeLog][QtSql][QSqlError] Added swap(). Coverity-Id: 168223 Change-Id: Iaad4dee383900b9d11856e860b0647780a81a505 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QFileDevice/QFileInfo: Add fileTime() and setFileTime()Nikita Krupenko2017-04-2727-4/+582
| | | | | | | | | | | [ChangeLog][QtCore][QFileDevice] Added fileTime() and setFileTime(). [ChangeLog][QtCore][QFileInfo] Added fileTime(). Task-number: QTBUG-984 Change-Id: I84dfb05b9454a54e26b57b78edee5773dc4c5c3c Initial-patch-by: Raphael Gozzo <raphael.rg91@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QStringRef: fix trimmed() returning null strings on empty inputMarc Mutz2017-04-272-3/+3
| | | | | | | | | | | | | | | | | | | The QString API symmetry test strikes again, showing that this is inconsistent with both QString and QByteArray, which both return empty for empty inputs. The fix actually makes the implementation simpler. Extend the QStringRef test to cover null inputs, too. I can't merge the trimmed() test in the API symmetry test until everything is actually consistent. [ChangeLog][QtCore][QStringRef] trimmed() now returns an empty string-ref for an empty input. Before, it would return a null one. Change-Id: I6b35c5f498053c4e15a4a9dd465bc696258e7393 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
* Fix resource leakJesus Fernandez2017-04-271-0/+1
| | | | | | | | | CID 178811 (#1 of 1): Resource leak (RESOURCE_LEAK) 25. leaked_storage: Variable dptr going out of scope leaks the storage it points to. Change-Id: I3354fe46cfb08701f387f65aaaa5c4f235079501 Coverity-Id: 178811 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fusion: desaturate the brown shadesJ-P Nurmi2017-04-2773-3/+3
| | | | | | | | | | | | | The reference images in tst_qframe had to be updated to match the palette. [ChangeLog][QtWidgets][QFusionStyle] The default palette used by the platform agnostic Fusion style has been desaturated. Previously the window background color, and other colors derived from it, were brown shades. Now these colors are neutral gray that fit better on any desktop. Change-Id: Id6a05e05563b8cbc8f378ee415a64b8f99012b60 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* eglfs_kms_egldevice: Fix type mess in nativeDisplay() virtualLaszlo Agocs2017-04-271-2/+2
| | | | | | | | | EGLNativeDisplayType is void* on NVIDIA systems but the backend may get compiled on others where it is something else. The function definition does not match the proto on these so it is time to correct this. Change-Id: I569d9f8f3fcba7b2a4672d83606dfdc7bb18a1f0 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* qhttpthreaddelegate: Fix build with -no-ssl after @70d8460fc20Palo Kisa2017-04-271-1/+1
| | | | | | | Just fixing the typo -> misplaced #ifndef guard. Change-Id: Ib3b0ceb615f45291cb64a0ed6c7f3a370dc506bf Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Windows QPA: Move system tray icon implementation into the pluginFriedemann Kleint2017-04-279-533/+580
| | | | | | | | | | | | | | The system tray icon implementation relied on QMenu. After the introduction of QPlatformSystemTrayIcon::contextMenuRequested(), the code can be moved into the plugin, making use of native menus when enabled or falling back to QMenu. This enables the SystemTrayIcon QML Type to work. [ChangeLog][QtGui][Windows] A native system tray icon is now available for SystemTrayIcon. Change-Id: I0fdbfb5cbb815c1ea6fb19305a9bceb9c5bcc034 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Windows QPA: Add native menusFriedemann Kleint2017-04-2714-1/+1349
| | | | | | | | | | | | | | | | | | | | | Add simple Win32-API based menus (not owner-drawn). Native menus are implemented using Win32 API and are simpler than QMenu-based menus in for example that they do allow for placing widgets on them or changing properties like fonts and do not provide hover signals. They are mainly intended for Qt Quick. By default, they will be used if the application is not an instance of QApplication or for Qt Quick Controls 2 applications. In addition, the command line option -platform windows:menus=native will unconditionally activate them and -platform windows:menus=no turns them off. [ChangeLog][QtGui][Windows] Native menus have been implemented. Task-number: QTBUG-55967 Change-Id: I439a7d949745debea3eb0e5789cf42288a0d526f Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* QPlatformSystemTrayIcon: Add signal contextMenuRequested()Friedemann Kleint2017-04-274-1/+31
| | | | | | | | | | | Add a signal passing the global position of the context menu. For platforms that do not provide native menus, QSystemTrayIcon will show a QMenu based menu. Change-Id: I799e4a84ca38e00ea33f3c842ea4ca43ecb8c83f Reviewed-by: J-P Nurmi <jpnurmi@qt.io> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QLocaleData: remove unused bool *overflow argumentsMarc Mutz2017-04-273-25/+12
| | | | | | | | | | | | | | | | | | ... from bytearrayToDouble() and bytearrayToLongLong() (bytearrayToUnsLongLong() didn't have one). The only user, QIntValidator, always checked them in conjunction with 'ok'. Since 'overflow' was true only if 'ok' was false, too, there's no point in carrying both. We can bring this code back with QParsedNumber, when it will not cost anything anymore. I actually was hoping that the overflow argument would inform the design of QParsedNumber, but it turned out to be unused, leading to this commit instead. Change-Id: I841d0d1cc36c13c5425ac0338323721d90b3b24c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCompletionEngine: avoid a node allocation on lookupMarc Mutz2017-04-272-17/+34
| | | | | | | | | | | | | | | | | | | | | | | In matchHint() and lookupCache(), instead of checking for the existence of 'parent' in 'cache', a new entry was created, if needed. However, the remainders of the functions could only fail in that case, so don't allocate an empty map node here at all. Wherever something sensible is added to the cache, there will have to be an insertion of the same node anyway, so there's no point doing that work here. Allows to mark these functions const. Also passed the QString argument by const-reference instead of by value. Done-with: Anton Kudryavtsev <a.kudryavtsev@netris.ru> Change-Id: Ia873f246869a68eecaef83ce4a6b6369187456be Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* tst_qstringapisymmetry: merge truncate() test into left() testMarc Mutz2017-04-271-44/+24
| | | | | | | | | | | Less code duplication, since truncate() is the action version of left(). This is done in preparation of adding more actions for the string transformations we have. Change-Id: I55027b5143ad3349d46091ac1cc3d24a9707caee Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QNAM: delay SSL initializationTimur Pocheptsov2017-04-266-22/+43
| | | | | | | | | | | | | | | | | | | It's really unfortunate that even a plain 'http' request results in (Open)SSL initialization; this is apparently done by QSslConfiguration's default constructor and we have several classes including QSslConfiguration as a data-member. There are different problems reported because of this, from crashes (a broken OpenSSL on Windows) to long initialization times, which is not acceptable if no 'https' request was actually executed. This patch-set is replacing data-members of type QSslConfiguration with smart-pointers and delays (Open)SSL initialization. Task-number: QTBUG-59750 Change-Id: Id1d375e689dbd2d134abbb0572a9e804d595110e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QHash: make it so a zero seed selects a constant algorithmThiago Macieira2017-04-262-13/+27
| | | | | | | | | | | | That's the only value for which we will guarantee a stable result across Qt versions and across invocations of the same application on different architectures is zero. For any other value, we reserve the right to change the algorithm. We'll now print a warning when we detect that. Task-number: QTBUG-47566 Change-Id: I27b55fdf514247549455fffd14b1135e10d24ab4 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
* Port internal qt_starts/ends_with to QStringViewMarc Mutz2017-04-262-102/+66
| | | | | | | | | | | | | | | | | | | | | | | ... and add a version taking a QChar needle. Back the implementation with a template function. Mark the slightly surprising behavior that null.startsWith(empty) == false but null.startsWith(null) == true even though empty == null, for review come Qt 6. Saves 0.5KiB in text size on optimized GCC 7.0 Linux AMD64 builds. Change-Id: I2576472d22ccf22ec89911eaed25188f9f7b654f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* tst_qstringviewapisysmmetry: add a check for startsWith()/endsWith()Marc Mutz2017-04-261-0/+235
| | | | | | | | | | | All good. Can't check QByteArray::startsWith(), as it is lacking the Qt::CaseSensitivity parameter. Change-Id: I7f2379e520617c14514fc66d8fb3413cfb7c9147 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QString: add internal qt_compare_strings(QL1S, QSV)Marc Mutz2017-04-261-1/+6
| | | | | | | | | | | | ... and adapt qCompareString(QLatin1String, QStringView) to call it instead of performing the negation itself. This function will be needed for QLatin1String::startsWith(QStringView). Change-Id: I8f19dfe0c5274a80c88b43d05f9efda8a91eac46 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QLatin1String: fix qt_compare_strings(QLatin1String, QLatin1String) for null ↵Marc Mutz2017-04-262-0/+42
| | | | | | | | | | | | | | | | | | | strings qstrcmp sorts null strings before empty ones, while the Qt string classes consider them equal. The qt_compare_strings() overload for QLatin1String was using qstrcmp(), but is supposed to implement the semantics that Qt string classes use, so we need to add an extra check. Was uncovered by tests for QLatin1String::startsWith(), but added a new test for qCompareStrings() now, which is a bit more complicated than desired, due to the lack of QUtf8String. Change-Id: I0493c4491df928a68861a1bc7f0962f1c870a416 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QThread: terminate on exceptions leaving run()Giuseppe D'Angelo2017-04-263-58/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Align ourselves to the Standard Library and call std::terminate if an exception leaves the thread entry point (that is, run()). On platforms using pthreads, thread cancellation needs to be taken in special consideration, since it looks like it was supported before. On Glibc, and when using C++, pthread_cancel and pthread_exit are implemented by throwing a special kind of exception that can be caught, but must always be rethrown. That exception is then used to activate the cancellation clean-up handlers. (This is non-Standard C++ behavior.) So: mimic what libstdc++'s std::thread does to support Glibc's pthread cancellation. At this time, it looks like libc++ has no support for this, and when used in combination with Glibc a thread cancellation results in a crash (also because it does not seem to terminate() when exceptions leave the thread). [ChangeLog][QtCore][QThread] An exception escaping from QThread::run() will now result in immediate and abnormal program termination. The same applies if an exception leaves a slot connected directly to the QThread::started() or QThread::finished() signals. Change-Id: I73cc93cf06c57018e149a578cc9d4cd0d6fc00ef Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Disentangle string-related headersMarc Mutz2017-04-256-104/+222
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's starting to hinder QStringView development (QString::append(QStringView), e.g.). - qbytearray.h includes qstring.h, but is included by qstring.h -> remove qstring.h include from qbytearray.h - the QStringLiteral definition is used from both qstring.h and qstringview.h -> extract into its own header, move QStringViewLiteral definition there, too - the qCompareStrings(), qConvertTo*() functions are used by QString and QStringView -> also extract into own header, included from qstring.h and qstringview.h - QStringView::toString() depends on QString, which depends on QStringView -> move QStringView::toString() definition to qstring.h, after the definition of QString -> move qstringview.h up to all the other includes in qstring.h This is starting to look like a DAG again, and allows to remove the unholy #ifndef QSTRING_H # include <qstring.h> #endif hack from qstringview.h. [ChangeLog][Potentially Source-Incompatible Changes][QByteArray] qbytearray.h no longer includes qstring.h. In particular, this means that in order to use QStringBuilder with QByteArray, you need to include both qbytearray.h and qstring.h now (or <QByteArray> and <QString>, resp.). Change-Id: I7f8acf9c11bc1731266cd25c6eda9fb36723f364 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QThread: fix headersclean with C++17Marc Mutz2017-04-251-2/+2
| | | | | | | | | | GCC's -Wshadow complained about the re-use of 'args' as the parameter for the lambda. Fix by renaming it to largs (lambda-args) instead. Change-Id: Ia9e65b82b98ee56181d754868354988399496eef Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QtTest: add support for printing QStringViewsMarc Mutz2017-04-244-9/+28
| | | | | | | | | [ChangeLog][QtTest][QCOMPARE] Now supports printing QStringViews in case of test failures. Change-Id: I4dc2542cd1013fd63c094c249e721d7102387bde Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>