Commit Graph

83 Commits

Author SHA1 Message Date
Tor Arne Vestbø
ec3d09bd9c cmake: Enable Objective-C++ language for standalone test projects
Amends 8450ab8dec.

Task-number: QTBUG-93020
Change-Id: Ied86754dbcd216a73cc77135c2c45303463d28d2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-01 20:42:30 +02:00
Alexandru Croitor
d4b7acec4b CMake: Make corelib tests standalone projects
Add the boilerplate standalone test prelude to each test, so that they
can be opened with an IDE without the qt-cmake-standalone-test script,
but directly with qt-cmake or cmake.

Boilerplate was added using the following scripts:
https://git.qt.io/alcroito/cmake_refactor

Manual adjustments were made where the code was inserted in the wrong
location.

Task-number: QTBUG-93020
Change-Id: I28b6d3815c5f43d2c33ea65764f6f3f8f129eaf3
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-05 15:09:32 +02:00
Marc Mutz
af32768f18 QDebug: add getter/setter for noQuotes
There were setters (quote(), noquote()), but, unlike
space()/nospace(), there was no getter.

Add the getter, and, for symmetry, a parametrized setter, too.

[ChangeLog][QtCore][QDebug] Added setQuoteStrings()/quoteStrings() to
access and manipulate the quote()/noquote() state.

Change-Id: I1b73138819b4d02726a6ef862c190206431ccebc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-05 12:56:55 +02:00
Thiago Macieira
a2551c45d4 Move the formatting of <chrono> durations to QDebug & QtTest
[ChangeLog][QtCore][QDebug] Added pretty formatting of C++ <chrono>
durations.

[ChangeLog][QtTest] Added pretty formatting of C++ <chrono> durations
for QCOMPARE expressions.

Change-Id: I3b169860d8bd41e9be6bfffd1757cc087ba957fa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-05-06 17:54:23 +00:00
Tor Arne Vestbø
06499383ca Use LANGUAGE OBJCXX rather than COMPILE_FLAGS "-x objective-c++"
We sometimes use Objective-C++ code in files with a .cpp extension,
to avoid the churn of adding a foo_mac.mm file. Instead of manually
telling the compiler to build these files in Objective-C++ mode, we
use CMake's intended mechanism, which means genex constructs such as
$<$<COMPILE_LANGUAGE:OBJCXX> will work for these files as well.

Pick-to: 6.5 6.2
Change-Id: If295c3f34f6bee9f4d9f877f519c9c7770665fee
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-04-13 14:36:26 +02:00
Marc Mutz
52c7f699ac QDebug: fix std::string/view stream operators; add u8 versions
Make them templates, for two reasons:

- so they can accept std::pmr types and, in general, any basic_string
  with custom allocators and char_traits

- to break overload ambiguities with the Qt string view types

Also, add the missing C++20 char8_t overloads.

Also, avoid creation of a QString in the sizeof(wchar_t) == 2 case
(Windows). Add a comment to optimize for the sizeof(wchar_t) != 2 case
later.

Found in API review.

Pick-to: 6.5
Change-Id: I30139520f582a38863a0936f8eca4b1ed33e37c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-03-02 06:33:35 +01:00
Friedemann Kleint
97bfacf1e2 tests: Remove remains of qmake conversion from CMakeLists.txt files
Pick-to: 6.5
Change-Id: I8d106554bb86ac1ec9bb7a4083de4c376bcbab1d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-02-17 21:56:49 +01:00
Marc Mutz
1c6bf3e09e Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:

    const std::string o = "object";

    auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };

    auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
        auto exprOfDeclaredType = [&](auto decl) {
            return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
        };
        return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
    };

    auto renameMethod = [&] (ArrayRef<StringRef> classes,
                            StringRef from, StringRef to) {
        return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
                            callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
                        changeTo(cat(access(o, cat(to)), "()")),
                        cat("use '", to, "' instead of '", from, "'"));
    };

    renameMethod(<classes>, "count", "size");
    renameMethod(<classes>, "length", "size");

except that the on() matcher has been replaced by one that doesn't
ignoreParens().

a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.

Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().

Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-11-03 14:59:24 +01:00
Ville Voutilainen
e08f05ac6e QDebug: Support standard strings and string views directly
[ChangeLog][QtCore][QDebug] QDebug now supports printing
std::strings and std::string_views (and their wide, u16, and
u32 variants) directly.

Task-number: QTBUG-96878
Change-Id: I7baf4fe688bfff50580b1cee9417af13949374cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-27 14:12:11 +03:00
Lucie Gérard
32df595275 Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-23 23:58:42 +02:00
Lucie Gérard
fb1b20eab3 Add license headers to cmake files
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.

Existing copyright statements remain intact

Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-03 17:14:55 +02:00
Alexandru Croitor
4d22405e48 CMake: Don't use PUBLIC_LIBRARIES for tests and test helpers
Change-Id: I9b7404e1d3a78fe0726ec0f5ce1461f6c209e90d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-07-28 14:46:53 +02:00
Marc Mutz
2cfabed1ff Long live QDebug op<< QMetaType!
It's needed in QtHttpServer.

[ChangeLog][QtCore][QDebug] Can now stream QMetaType.

[ChangeLog][QtCore][QMetaType] Can now be streamed through QDebug.

Change-Id: I974d77d678137715472a3907ab1e50ba2dbaa087
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-09 06:40:08 +02:00
Lucie Gérard
05fc3aef53 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-16 16:37:38 +02:00
Tor Arne Vestbø
aa0a53fc19 Don't declare type 'id' in the global namespace in a public header
It's not necessary, and it breaks the qttools build (where we have a
global variable named 'id'), and thus will most certainly build a lot
of existing user code.

Amends e47c22480f.

Change-Id: I97a91c2cb23fdae65143cf14c81570cf88d529d5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-27 00:16:26 +02:00
Joerg Bornemann
ad2da2d27a Remove the qmake project files
Remove the qmake project files for most of Qt.

Leave the qmake project files for examples, because we still test those
in the CI to ensure qmake does not regress.

Also leave the qmake project files for utils and other minor parts that
lack CMake project files.

Task-number: QTBUG-88742
Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-01-07 15:32:28 +01:00
David Skoland
27d96b4789 Replace QtTest headers with QTest
Complete search and replace of QtTest and QtTest/QtTest with QTest, as
QtTest includes the whole module. Replace all such instances with
correct header includes. See Jira task for more discussion.

Fixes: QTBUG-88831
Change-Id: I981cfae18a1cabcabcabee376016b086d9d01f44
Pick-to: 6.0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-12-22 15:20:30 +01:00
Karsten Heimrich
e9b92c926d QDebug: add op<<(QUtf8StringView)
[ChangeLog][QtCore][QDebug] Added streaming of QUtf8StringViews.

Task-number: QTBUG-88029
Change-Id: Ifcb001cfebddd79ce1cdbfef5bcc19f7c56679ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-07 09:35:11 +01:00
Karsten Heimrich
7cad91a7df QDebug: add op<<(QByteArrayView)
[ChangeLog][QtCore][QDebug] Added streaming of QByteArrayViews.

Task-number: QTBUG-88029
Change-Id: I66f5cc45a0438dbaacb1754cb3c669b3717f528b
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-11-07 09:35:11 +01:00
Fabian Kosmale
b83225fcc3 qDebug: Avoid implicit QVariant conversion
This commit restricts operator<<(QDebug lhs, QVariant rhs) to only work
if rhs is actually of type QVariant (instead of any type convertible to
QVariant). This is especially important as
a) we check in QMetaType whether (slightly simplified) QDebug{} <<
   std::declval<T>() is valid, and if so, register a function which
   simply uses the operator.
b) In QVariant, we ask the metatype system for the contained types
   registered debug function and then use it.
If a type now does not have its own operator<< for QDebug, but is
implicitly convertible to QVariant containing itself, this would lead to
an infinite recursion, when trying to use qDebug with that type. The
registered function in a) would just convert the type to QVariant, and
then ask the QVariant to print itself.
Disallowing implicit conversions in qDebug in general was considered
(i.e. adding template<typename T> operator<<(T) = delete in QDebug ),
but discarded as it breaks too much code relying on conversions.

Fixes: QTBUG-87122
Change-Id: Ib709297670cbc6cc307efd0dfd8e5b0279df9414
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-13 08:06:18 +02:00
Alexandru Croitor
403213240c CMake: Regenerate projects to use new qt_internal_ API
Modify special case locations to use the new API as well.
Clean up some stale .prev files that are not needed anymore.
Clean up some project files that are not used anymore.

Task-number: QTBUG-86815
Change-Id: I9947da921f98686023c6bb053dfcc101851276b5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-09-23 16:59:06 +02:00
Karsten Heimrich
2766322de3 Move QStringRef and remains to Qt5Compat
Export some private functions from QUtf8 to resolve
undefined symbols in Qt5Compat after moving QStringRef.

Task-number: QTBUG-84437
Change-Id: I9046dcb14ed520d8868a511d79da6e721e26f72b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-20 00:58:13 +02:00
Lars Knoll
3ef8ec2ee1 Constrain the data stream operators for containers
Check that we can successfully instantiate the data
stream operator for a container before we actually try.

This is required so we can automate registration of debug
stream operators with QMetaType.

Change-Id: Ib100a5242470d7fc8067058cc4d81af2fa9354b0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-15 14:43:30 +02:00
Lars Knoll
8ad9e81694 Constrain the debug stream operators for containers
Check that we can successfully instantiate the debug
stream operator for a container before we actually try.

This is required so we can automate registration of debug
stream operators with QMetaType.

Change-Id: I3943e7a443751d250c33b2ca1b9cf29207cfe6c4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-15 14:43:23 +02:00
Thiago Macieira
f2abfb39d7 QDebug: add operator<<(const char16_t *)
Avoids the conversion from UTF-8 for uses that are not dumping a string.

Mass conversion of Qt sources left for future opportunity.

Fixes: QTBUG-85811
Change-Id: I4ca4a35b687b46c39030fffd1626ae6c3294cacf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-04 15:13:09 -07:00
Alexandru Croitor
e9a328bc0e CMake: Regenerate tests with new qt_ prefixed APIs
Use pro2cmake with '--api-version 2' to force regenerate
projects to use the new prefixed qt_foo APIs.

Change-Id: I055c4837860319e93aaa6b09d646dda4fc2a4069
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-07-09 09:38:35 +02:00
Marc Mutz
23849826b4 Sweep of int-ish → char-ish types near calls to QString::fromU*()
The fromUtf16(ushort*) and fromUcs4(uint*) overloads are going
to be deprecated. Use the newer fromUtf16(char16_t*) and
fromUcs4(char32_t*) overloads.

As a drive-by, use std::end()/std::size() where applicable.

Change-Id: I5a93e38cae4a2e33d49c90d06c5f14f7cb7ce90c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-05-12 05:43:37 +00:00
Mitch Curtis
981c1fe15f QDebug::toString(): use nospace()
The intended use cases for toString() are the situations where you
can't use operator<<, such as QVERIFY2, Q_ASSERT_X, etc., which means
that it will often be used as an argument to e.g. QString::arg(), where
the user has control over the structure of the message. For that
reason, adding an extra space to the end is not necessary and just gets
in the way.

This amends 658b9697f9.

Change-Id: I0695e6809026a0f92ed783899da80de4fa2a1684
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-02-28 10:16:15 +01:00
Mitch Curtis
658b9697f9 Add QDebug::toString()
This template function streams the given object into a QDebug instance
that operates on a string, and then returns that string.

This function is useful for cases where you need the textual
representation of an object for debugging, but cannot use operator<<.
A good example of this is when writing tests where you want to provide
a useful failure message involving details about an object, but must
provide it in a string to e.g. QVERIFY2.

[ChangeLog][QtCore][QDebug] Added static template toString() function,
which streams the given object into a QDebug instance that operates on
a string, and then returns that string.

Fixes: QTBUG-82309
Change-Id: I8411394e899dedad19cec788d779a4515d52ba11
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-02-22 14:16:59 +01:00
Alexandru Croitor
76590ce220 Regenerate tests/auto/corelib/io
Change-Id: Ic1d1b5c0deb90800c7219fb8cce4e77e0db145b8
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-11-12 17:24:44 +00:00
Alexandru Croitor
c7ec7cd2a1 Merge branch 'wip/qt6' into wip/cmake
Change-Id: I50ac36b8803c296998149e98cc61e38687cdd14b
2019-08-15 16:53:19 +02:00
Alexandru Croitor
7947032e2d Regenerate coreliob/io tests
With a few special cases to make the tests pass.
Biggest one is the qlockfile_test_helper.

Also a few tests have some problems and have not been
ported yet: qfileselector, qresourceengine, qprocess.

Change-Id: I91a5210b13e7a0697774d909449a71f46af0a0ba
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-15 10:57:01 +00:00
Jędrzej Nowacki
d87cd5cb2e Regenerate CMakeLists for tests/corelib/io
Only qdir, qlockfile, qprocess and qresourceengine were manually
disabled, otherwise all other builds fine on linux.

Change-Id: I09fd0ffffb778057d6bf9c25cad1fcd73fb7e530
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-12 12:17:02 +00:00
Marc Mutz
adab531771 Port from QStringViewLiteral to u""
Now that all our supported compilers know char16_t, we no longer need
QStringViewLiteral, whose only purpose in life was to turn u"" into
L"" for MSVC < 2015.

Change-Id: I25a094fe7992d9d5dbeb4a524d9e99e043dcb8ce
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-29 11:17:28 +03:00
Lars Knoll
e3b55616e2 Prefix QTextStream operators with Qt:: in tests
Change-Id: I852f016fcb619a9e634deee6efb1fe7930d974c8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-05-03 09:36:36 +00:00
Allan Sandfeld Jensen
1c623bc6d1 Fix QMetaObject naming of class enum flag
Adds an enumName to QMetaEnum to carry the name of the enum since for
flags that doesn't match the name of the Qt type, but is needed if the
flag is scoped.

Change-Id: I1c0f77eb9e40e6fd1eb6a59bea77caf0f33fcf43
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2018-08-11 07:59:15 +00:00
Marc Mutz
8092a01f84 QDebug: add op<<(QStringView)
[ChangeLog][QtCore][QDebug] Added streaming of QStringViews.

Change-Id: Id81fae223b60188d541b255b67bc316f9f1b6bef
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-03-24 20:43:03 +00:00
Liang Qi
cbe332405a Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	configure
	mkspecs/macx-ios-clang/features/default_pre.prf
	mkspecs/macx-ios-clang/features/sdk.prf
	mkspecs/unsupported/freebsd-g++46/qplatformdefs.h
	src/widgets/styles/qgtkstyle.cpp
	tests/auto/corelib/io/qdiriterator/qdiriterator.pro
	tests/auto/corelib/io/qfileinfo/qfileinfo.pro

Change-Id: Ia943555d1e59234a66f7dc65bdfda838e40001b5
2016-06-10 23:27:10 +02:00
Marc Mutz
5a15545ee2 QDebug: fix streaming of QChars
Commit 9ef3ff30 introduced a new function, putUcs4(), to
output QChar, char16_t, char32_t as a, possibly escaped,
character literal, but got the order of stream modifiers
wrong. Instead of applying the field width to the 'ucs'
streaming, it applied it to the prefix '\u'. The same
problem exists for the pad char, leading to the result
   '00\ue4'
for a QChar containing
  ä (LATIN SMALL LETTER A WITH DIAERESIS)

Fix by reordering the elements streamed so that the
prefixes come last.

Added a test.

Change-Id: I6eaa0586501b9e780aaa3bb5dcec0e5c2f86a219
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-08 18:29:38 +00:00
Thiago Macieira
cfe891eeb8 Add Intel copyright to files that Intel has had non-trivial contribution
I wrote a script to help find the files, but I reviewed the
contributions manually to be sure I wasn't claiming copyright for search
& replace, adding Q_DECL_NOTHROW or adding "We mean it" headers.

Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-21 22:44:21 +00:00
Jani Heikkinen
f776595cc1 Updated license headers
From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some
exceptions, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/

Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one
(in those files which will be under GPL 3 with exceptions)

Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-21 18:55:18 +00:00
Friedemann Kleint
76cf88157f Tests: Remove CONFIG += parallel_test.
The keyword no longer has a meaning for the new CI.

Change-Id: Ibcea4c7a82fb7f982cf4569fdff19f82066543d1
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-05 07:16:50 +00:00
Friedemann Kleint
51e501fa8d Remove QT_DISABLE_DEPRECATED_BEFORE=0 from tests not using deprecated API.
Change-Id: I1955320e7639760b4383a53f37a506c8055933ef
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
2015-09-01 16:57:46 +00:00
Frederik Gladhorn
77da617dc8 Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
	doc/global/qt-cpp-defines.qdocconf
	src/3rdparty/forkfd/forkfd.c
	src/corelib/codecs/qtextcodec.cpp
	src/corelib/kernel/qmetatype.cpp
	src/corelib/tools/qset.qdoc
	src/gui/accessible/qaccessible.cpp
	src/gui/image/qpixmapcache.cpp
	src/opengl/qgl.cpp
	src/tools/qdoc/generator.cpp
	src/widgets/kernel/qwidget.cpp
	tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp

Change-Id: I4fbe1fa756a54c6843aa75f4ef70a1069ba7b085
2015-08-06 10:54:01 +02:00
Thiago Macieira
644ac04af0 Change how QDebug escapes QStrings in the output
[ChangeLog][Important Behavior Changes] QDebug output for QStrings
changed compared to Qt 5.5.0 to more closely match the output of
previous Qt versions. Like Qt 5.5.0, QDebug will escape non-printable
characters, the backslash and quote characters, but will no longer
escape the printable characters.

Task-number: QTBUG-47316
Change-Id: I52dd43c12685407bb9a6ffff13f62ef68cbc80c5
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
2015-08-06 04:53:38 +00:00
Olivier Goffart
f01f1943e4 Fix compilation error while instantiating operator<< explicitly
Task-number: QTBUG-47375
Change-Id: Ibd260de88c174c1aa3833a56b153b8b74d337338
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-26 19:14:47 +00:00
Friedemann Kleint
3994ea1979 Add a verbosity setting to QDebug.
Add setters for an int verbosity to QDebug. The streaming operators
can check on the setting and output more information accordingly.

[ChangeLog][QtCore][QDebug] How verbose a single debug output should be
can now be fine-tuned by setting a verbosity on the debug stream.

Change-Id: I77001fcf1ef090a580d1a137bb5a667fc1bf1e1b
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
2015-03-13 13:24:36 +00:00
Jani Heikkinen
83a5694dc2 Update copyright headers
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.

Outdated header.LGPL removed (use header.LGPL21 instead)

Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing
combination. New header.LGPL-COMM taken in the use file which were
using old header.LGPL3 (src/plugins/platforms/android/extract.cpp)

Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license
combination

Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe
Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
2015-02-11 06:49:51 +00:00
Thiago Macieira
62b752b3a2 Do the same for qDebug of QByteArray and QLatin1String
QLatin1String are actually Unicode, so print them with \uXXXX sequences.
QByteArray are binary (arbitrary), so print as hex. Since hex escape
sequences in C are not limited in length (\x00000F is a valid hex
sequence), we need to insert "" if the next character is a valid hex
digit.

[ChangeLog][QtCore][QDebug] Similarly, printing of QByteArrays whenever
"noquote" is not active now prints the arrays in a format consumable in
C++, with all non-printable characters printed in hex escape sequences.

Change-Id: Ibd0c1a97cbac98610c65c1091bfbcf5581c835db
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-01-11 03:40:43 +01:00
Thiago Macieira
2c01d402e1 QDebug: pretty-print QStrings and QStringRefs
[ChangeLog][QtCore][QDebug] Printing of QStrings and QStringRefs
whenever "noquote" is not active now prints the strings in a format that
can be copied back to C++ code. All characters that aren't printable in
US-ASCII are escaped (this includes printable Unicode characters outside
of US-ASCII). Pretty-printing will not respect QTextFormat padding or
field widths.

Change-Id: I169a8a0508e24693f5652f0129defe7f709e5d08
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-11 03:40:38 +01:00