summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* QString/Ref: add startsWith/endsWith(QStringView) overloadsMarc Mutz2017-04-282-2/+65
| | | | | | | | | | [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-282-2/+39
| | | | | | | | | | 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-2719-4/+430
| | | | | | | | | | | [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-271-2/+0
| | | | | | | | | | | | | | | | | | | 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-271-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>
* 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-261-9/+23
| | | | | | | | | | | | 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>
* 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-261-0/+2
| | | | | | | | | | | | | | | | | | | 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-243-3/+20
| | | | | | | | | [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>
* Add support for scoped enums to QMetaObjectBuilderMichael Brasser2017-04-242-3/+36
| | | | | | Change-Id: I7b3c3973ff4396a854014f5b2b671b71007e80da Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QtBase: use new QStaticByteArrayMatcher where applicableMarc Mutz2017-04-243-9/+21
| | | | | | | | | | | | | | | | | Even for compilers that don't yet support C++14 constexpr, this should improve performance of searches a lot, if, indeed, Boyer-Moore still is an optimization over linear searching at all in these days of hardware prefetchers and deep CPU pipelines, because the setup cost is only incurred once. As function-statics, we also don't care about startup ordering and cost. It's a pity that the platform that would benefit the most - Windows - doesn't have constexpr support, yet. Change-Id: I827df135854fd6fbd6546e248dc37ef0fbaf1792 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* eglfs_kms: Use eglGetPlatformDisplay when availableLaszlo Agocs2017-04-243-1/+32
| | | | | | Task-number: QTBUG-60330 Change-Id: Ibbd74ae00d17fdc6ee9c86e758788dcca15ea4ff Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* QThread: add static create functionGiuseppe D'Angelo2017-04-242-0/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the spirit of std::thread, which takes a function to call and its parameters, and runs it in a new thread. Since the user might want to connect to signals, move QObjects into the new thread, etc., the new thread is not immediately started. Although technically all of this _should_ be implementable in pure C++11, there is nothing in the Standard to help us not reinvent all the plumbing: packing the decay'd parameters, storing them, invoking the function over the parameters (honoring INVOKE/std::invoke semantics). std::function does not do the job, as it's copiable and therefore does not support move-only functors; std::bind does not have INVOKE semantics. I certainly do not want to reimplement all the required facilities inside of Qt. Therefore, the full blown implementation requires C++17 (std::invoke). In order to make this useful also in pre-C++17, there are two additional implementations (C++11 and C++14) that support just a callable, without any arguments passed to it. The C++11 implementation makes use of a class to store and call the callable (even move-only ones); basically, it's what a closure type for a C++14 lambda would look like. An alternative implementation could've used some of the existing facilities inside QObject::connect implementation that store a functor (for the connect() overload connecting to free functions), namely: the QtPrivate::QFunctorSlotObject class. However: * QFunctorSlotObject does not support move-only callables (see QTBUG-60339); * QFunctorSlotObject itself is not a callable (apparently by design), and requires to be wrapped in a lambda that calls call() on it; * the moment QTBUG-60339 is solved, we'd need the same handwritten closure to keep QFunctorSlotObject working with move-only callabes. So: just use the handwritten one. The C++14 implementation is a simplified version of the C++11 one, actually using a generalized lambda capture (corresponding to the handwritten C++11 closure type). All three implementations use std::async (with a deferred launch policy, a nice use case for it!) under the hood. It's certainly an overkill for our use case, as we don't need the std::future, but at least std::async does all the plumbing for us. [ChangeLog][QtCore][QThread] Added the QThread::create function. Change-Id: I339d0be6f689df7d56766839baebda0aa2f7e94c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QOffscreenSurface: fix blunderGiuseppe D'Angelo2017-04-231-1/+1
| | | | | | | | | | | 7be9653f1288d32bc732262b01ba910f6a321ecd added a new constructor taking the parent QObject. However, it broke code building an object and passing 1 parameter to the constructor (the call is now ambiguous). Disambiguate. Task-number: QTBUG-60342 Change-Id: I3a36f01ebb52c7aaa4c4cdf5e2c5f37c1255bc8a Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Fix casts and null pointer style in QProcessPrivate::startProcessJoerg Bornemann2017-04-231-4/+5
| | | | | | | | Using C++ casts fixes clang warnings, and using nullptr indicates what's a pointer and what's a flag. Change-Id: I17c44689f42b9af2c5ff1d9a7e3781a2243f257f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Support setCreateProcessArgumentsModifier in QProcess:startDetachedJoerg Bornemann2017-04-232-10/+20
| | | | | | | | | Factor out both CreateProcess calls into one function that also calls the modifier callback for the CreateProcessArguments struct. Task-number: QTBUG-57687 Change-Id: I9d2ef4f2d7cd077aa4c3eba926ab4dfb9e570291 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QPixmap/X11: fix compilation with C++17Marc Mutz2017-04-221-1/+1
| | | | | | | | | | | | | | C++11 deprecated 'register' as a storage specifier, and C++17 removes it. Fixes GCC 7.0 warning-turned-error: nativepainting/qpixmap_x11.cpp:2013:25: error: ISO C++1z does not allow ‘register’ storage class specifier [-Werror=register] Amends 07942adb77f60738a6043665673d51fc7991233b. Change-Id: Ideb674d903e5e6eb5ae92cfc3979ff59b243520c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QCOMPARE: allow mixed-type comparisonsMarc Mutz2017-04-212-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no reason to restrict the LHS and the RHS to the same type like it was done before. That just leads to lots of casting. or use of QVERIFY(. == .) instead of QCOMPARE, with all the disadvantages like no printing of the LHS and RHS values. The rationale given in the documentation for this behavior is incorrect. Ensuring that RHS and LHS have the same type by no means ensures that no implicit conversions take place when calling operator==. Proof: QCOMPARE(QLatin1Char('a'), QLatin1Char('a')); // instantiates qCompare<QLatin1Char, QLatin1Char> // but calls operator==(QChar, QChar) If the intent is to disable implicit conversions of the argument types, then some serious metaprogramming magic would be needed, along the following lines: 1. find out which op== overload is actually chosen 2. find that overload's RHS parameter type, assert it's the same as (possibly cv-qualified) T1. 3. ditto for the LHS parameter type and T2 This is not attempted here. Fix the inconvenience this restriction caused by simply allowing two types. This cannot break existing code, since we didn't actually change anything in the qCompare() overload set. All we do is implement the existing qCompare<T1, T2>() overload. [ChangeLog][QtTest] QCOMPARE can now be used for mixed-type comparisons. Change-Id: I0413dbd3689809852413eaca22827257f1527720 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Docs: Fix some warningsFriedemann Kleint2017-04-218-11/+12
| | | | | | | | | | | | | | | | | | | qtbase/src/corelib/tools/qbytearray.cpp:3043: warning: Can't link to '.' qtbase/src/corelib/tools/qstring.cpp:4522: warning: Can't link to '.' qtbase/src/corelib/tools/qstring.cpp:10331: warning: Can't link to '.' qtbase/src/network/access/qhstspolicy.cpp:105: warning: Undocumented parameter 'flags' in QHstsPolicy::QHstsPolicy() qtbase/src/network/access/qhstspolicy.cpp:105: warning: No such parameter 'includeSubDomains' in QHstsPolicy::QHstsPolicy() qtbase/src/network/access/qnetworkaccessmanager.cpp:732: warning: Undocumented parameter 'knownHosts' in QNetworkAccessManager::addStrictTransportSecurityHosts() qtbase/src/network/access/qnetworkreply.cpp:307: warning: Can't link to 'QNetworkRequest::UserVerifiedRedirectsPolicy' qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: No such enum item 'PdfFormat_1_4' in QPagedPaintDevice::PdfVersion qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: Undocumented enum item 'PdfVersion_1_4' in QPagedPaintDevice::PdfVersion qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: Undocumented enum item 'PdfVersion_A1b' in QPagedPaintDevice::PdfVersion qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: No such enum item 'PdfFormat_A1b' in QPagedPaintDevice::PdfVersion qtbase/src/widgets/kernel/qopenglwidget.cpp:1076: warning: Undocumented parameter 'texFormat' in QOpenGLWidget::setTextureFormat() qtbase/src/corelib/tools/qversionnumber.cpp:460: warning: Command '\snippet (//! [3-latin1-1])' failed at end of file 'qversionnumber/main.cpp' Change-Id: Icc163dd8d94cee7e0858040bf8241a3c1f1d221d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Centralize the check that the floating point implementation follows IEEE754Giuseppe D'Angelo2017-04-212-18/+27
| | | | | | | | | | | | | C++ does not specify which kind of floating point implementation is being used. The C Standard doesn't either, but it includes a normative reference for implementations adoping it (ISO/IEC 9899:2011 Annex F). There are a few existing checks in qfloat16.cpp; move them to qglobal.cpp (next to the other, similar checks), and improve them by actually checking that the radix used for floating point numbers is 2. Change-Id: I704a3a8efeb51014b3be23fb236654d647a6f44f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* xcb: Add experimental legacy support for native X11 paintingLouai Al-Khanji2017-04-2124-8/+8503
| | | | | | | | | | This commit revives the old native QPixmap and QPaintEngine implementations that were present in Qt4. The backing store supports regular raster windows in this commit. Support for render-to-texture widgets and OpenGL compositing will be added in a follow-up commit. Change-Id: I80a9c4f0c42a6f68f571dfee930d95000d5dd950 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QOffscreenSurface: add a constructor taking a parent objectGiuseppe D'Angelo2017-04-212-4/+19
| | | | | | | | Just like all QObject subclasses. Use a delegating constructor call to share the code from the existing constructor. Change-Id: Ia3c893ccc4c94883e61337f8952d80b665c17fbf Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Fix CSS line-height property multiplier value handlingJoni Poikelin2017-04-212-2/+13
| | | | | | | | | | | | | | | CSS style such as "line-height: 1.5;" should be used as a multiplier, but Qt uses it as percentage which makes line spacing way too small. To workaround this, convert it to percent and use as QTextBlockFormat::ProportionalHeight instead. [ChangeLog][QtGui][Important Behvior Changes] Changed CSS line-height property with multiplier to follow CSS spec Task-number: QTBUG-56848 Task-number: QTCREATORBUG-17683 Change-Id: Icc98f7c0d4d07542a220702c287f23fa450ef875 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QStringView: mark as primitive typeMarc Mutz2017-04-211-1/+1
| | | | | | | | | | | | Every bit pattern of a QStringView is a Partially-Formed Object, and QStringViews are trivially copyable. That's what Q_PRIMITIVE_TYPE means, even if the docs are still talking about valid instead of partially-formed objects. Change-Id: I79d4f79fbab0ec2608620e88b6593e26686af304 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QStyleHints: Make showShortcutsInContextMenus a Q_PROPERTYFriedemann Kleint2017-04-201-0/+1
| | | | | | | | | | | | | Fixing qdoc warnings: qtbase/src/gui/kernel/qstylehints.cpp:367: warning: Cannot find 'QStyleHints::showShortcutsInContextMenus' specified with '\property' in any header file qtbase/src/gui/kernel/qstylehints.cpp:378: warning: No documentation for 'QStyleHints::showShortcutsInContextMenus()' Amends change c2c3452ba5b4c32d0c2d5df9193bf89986623ab5. Task-number: QTBUG-49435 Change-Id: I2db52f013c0fc46c80a1200667c19d63a2c9c0c4 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Use new Q_STDLIB_UNICODE_STRINGS and Q_COMPILER_UNICODE_STRINGSMarc Mutz2017-04-202-2/+2
| | | | | | | | | ... instead of the combination with Q_OS_WIN we used so far. This patch adapts ocurrences that are new in 5.10. Change-Id: If392df481713e56c776c2326e0e02324a3a80c89 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use list-initialization moreMarc Mutz2017-04-205-10/+5
| | | | | | | Fixes a few ugly code pieces I added over the years. Change-Id: I5c06b73e858add04ea184120c6df71720baf9be3 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QDateTime: replace home-grown version of qToStringViewIgnoringNull with the ↵Marc Mutz2017-04-201-10/+3
| | | | | | | real thing Change-Id: Ie71ed4f5c9a2bd0b14818f0f3cff4f88c2100546 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QStringView: fix position of Q_REQUIRED_RESULT macrosMarc Mutz2017-04-201-32/+32
| | | | | | | | ... to be compatible with the C++17 [[nodiscard]]. Change-Id: I60fb9b9077e8c59a03a212c73d4e6c814cc0357d Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUuid: add fromString(QStringView/QLatin1String)Marc Mutz2017-04-203-63/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As for the formatting code, de-duplicate the parsing code by only parsing char*s, converting QChars to Latin-1 first in a small buffer. The QUuid(const char*) ctor performed no length checking, relying instead on the checks performed within _q_uuidFromHex(), which includes an implicit check for premature end (because NUL is not a valid token for the parser). The (QString) and (QByteArray) ctors did perform length checking. To the extent possible, this is removed, since it is handled by _q_uuidFromHex(). Failure cases need not be optimized. Only the QLatin1String overload needs to do some checking, because views in general are not NUL-terminated. The QStringView overload can just append a NUL when it converts to Latin-1. The only check I added to _q_uuidFromHex() is that for src == nullptr. It would otherwise be duplicated in several callers. While touching the internal functions, port to passing and returning by value. Saves 1.6KiB in text size on optimized GCC 6.1 Linux AMD64 builds, even though we added new API. Port some users to the new functions. Expand fromString() test. [ChangeLog][QtCore][QUuid] Added fromString(QStringView/QLatin1String). Change-Id: I519339419129550c86e0ea80514865cd6a768f5d Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-20128-817/+1080
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.h src/corelib/tools/qdatetime.h src/corelib/tools/qstring.h src/corelib/tools/qversionnumber.h src/plugins/platforms/android/qandroidplatformintegration.cpp tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp Change-Id: Iefd92a435e687a76cd593099e40d9a9620a1454d
| * Split Q_COMPILER_UNICODE_STRINGS: add Q_STDLIB_UNICODE_STRINGSMarc Mutz2017-04-203-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit bf2160e72cd8840a8e604438cbdc807483ac980a, we can rely on charNN_t support in all compilers except MSVC 2013, and since that commit, we use (in 5.10, not 5.9, yet) !defined(Q_OS_WIN) || defined(Q_COMPILER_UNICODE_STRINGS) when we only need charNN_t, the type, as opposed to its library support (u16string, char_traits<char16_t>, ...). This patch splits the Q_C_UNICODE_STRINGS macro into two, adding Q_STDLIB_UNICODE_STRINGS for when we need std::uNNstring, leaving Q_C_UNICODE_STRINGS for when we need just charNN_t support. In QDebug, when constructing a QChar out of a char16_t, cast to ushort first, since QChar(char16_t) was only officially introduced in Qt 5.10. [ChangeLog][Potentially Source-Incompatible Changes] The internal Q_COMPILER_UNICODE_STRINGS macro is now defined if the compiler supports charNN_t, even if the standard library does not. To check for availability of std::uNNstring, use the new Q_STDLIB_UNICODE_STRINGS macro. Change-Id: I8f210fd7f1799fe21faf54506475a759b1f76a59 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Move Q_REQUIRED_RESULT to its correct positionThiago Macieira2017-04-2028-288/+281
| | | | | | | | | | | | | | | | | | | | | | That's before the return type or static, inline, constexpr or such keywords (if any). Perl Script: s/^(\s+)(.*) Q_REQUIRED_RESULT(;)?(\s*\/\/.*)?$/\1Q_REQUIRED_RESULT \2\3\4/ Change-Id: I7814054a102a407d876ffffd14b6a16182f159e2 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| * Don't disable Q_REQUIRED_RESULT with Clang and ICCThiago Macieira2017-04-202-2/+2
| | | | | | | | | | | | | | They're not affected by the GCC bug noted in the comment. Change-Id: I7814054a102a407d876ffffd14b69e8a8e2527f1 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| * Disable precompiled headers for small modulesThiago Macieira2017-04-209-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Creating a precompiled header exclusively for a one- or two-file module is wasteful. The time that it takes to build the precompiled source is on the same order as a regular compilation, so enabling precompiled headers for those modules just makes the build slower. Also make it possible to override the precompiled header by just setting PRECOMPILED_HEADER to empty. Change-Id: I0e1a09998253489388abfffd14b5f221288c4826 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
| * qgrayraster: use a cast to void to mark a variable as unusedGiuseppe D'Angelo2017-04-201-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not use a self-assignment, as that may trigger compiler warnings. Casting to void is also what Q_UNUSED is doing these days, but we can't use it here because qgrayraster.c does not include qglobal.h. Remove a 15-years old comment related to the self assignment. Found by clazy. Change-Id: I8cc92b7a1b0b5fb13824959740243e17606ec753 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>