Commit Graph

31927 Commits

Author SHA1 Message Date
Marc Mutz
0c8b5446d4 Port QResourceRoot::mappingRootSubdir() to QStringSplitter
The code here performs a std::mismatch() on the normalized parts of
'root' and 'path', returning whether 'path' is a prefix of 'root'. If
'path' is a proper prefix of 'root', returns the first 'root' part
after 'path', in '*match'.

Instead of using QString::splitRef(), perform the splitting as we go,
using this class' own tool, QStringSplitter.

The goal here is to avoid the heap allocation caused by the QVector
return of splitRef(), of course. But even though using QStringSplitter
means the splitting is now purely inline, text size in optimized GCC 7
Linux AMD64 builds increases by only 24B.

Change-Id: I396cc6a30306940220c9e783c31506e6ac17b784
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-03-30 15:08:11 +00:00
Friedemann Kleint
4fd5273f61 hellovulkanwidget example: Add a widget showing debug output
Add a tab widget for vulkan info and debug log.

Change-Id: I0428bb5b6f847d0e94d62e846d34e4cb69eda5b6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-03-30 15:04:12 +00:00
Marc Mutz
2cc1ff3bc2 Optimize qIsEffectiveTLD()
TLD lookup is performed in up to three steps, which are decribed in a
code comment. For the purposes of this patch, it suffices to mention
that the last two steps involved a QStringBuilder expression.

Avoid having to build these strings by distinguishing between the
lookups using an enum instead of a string prefix. Since qt_hash()
calls can now be chained, form the hash value by hashing the prefix
character and the domain (part) separately.

Also perform the expensive fromUtf8() call only when the string prefix
(if any) matched. Once we have nothrow UTF-8/UTF-16 comparison
operators, qIsEffectiveTLD() will no longer allocate memory, and run
at full speed. Not there, yet, though.

I have full confidence that the optimizer will have field day with
this, inline all three containsTLDEntry() calls, and constant-fold the
checks inside the loop. GCC does, so I didn't try to do it by hand.

Change-Id: I1a7647ff52b6742310928ad859d851d1f0c6bdc3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-30 13:28:53 +00:00
Marc Mutz
cb2246ad15 Allow to chain qt_hash() calls
There are some callers of qt_hash that first build a string just to hash it.
By allowing to pass an initial value for 'h', we can chain qt_hash() calls
to avoid having to allocate memory just to hash a two-part string.

Change-Id: Ifaca82d47b2fb8c707912342c3ddd84f91e70267
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-30 13:27:51 +00:00
Marc Mutz
58f9629a48 QResource: use QStringView
Saves 240B in QtCore text size on optimized GCC 7 Linux AMD64 builds.

Change-Id: Ifa7b8735027575fbe381896dce608b80ec458ee9
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2017-03-30 04:38:38 +00:00
Marc Mutz
8d44bb2c54 Add qHash(QStringView)
[ChangeLog][QtCore] Added qHash(QStringView).

Change-Id: I69c9203cf301fe586e924168381884aab2e19e5c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2017-03-30 04:38:26 +00:00
Marc Mutz
35b897218c Replace internal qt_hash(QString(Ref)) functions with one taking QStringView
Change-Id: I49d07689e642d26b4bceda5cace738aadd828ce0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2017-03-30 04:38:10 +00:00
Marc Mutz
a1421e4787 QStringView: add some relational operators
This is not the complete set, since we don't yet have qCompareStrings()
for UTF-8 strings, but relational operators are so important that we
need _something_ before we have _everything_.

Change-Id: I213b741e5b91f09aa1f0c6c21f64d764fceb27a1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2017-03-30 04:37:54 +00:00
Edward Welbourne
b4c85e8a2a Document M_PI and friends in <QtMath>
These symbols should at least be mentioned in the documentation.
Also comment on the option of using template variables for them once
we haev support for C++14

Change-Id: Ia40f9b89d9d8a38536a2e51ae3f174b8f16ca7d6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-03-29 16:07:14 +00:00
Marc Mutz
8d49df2172 QLocale: add QStringView overload of number parsing functions
This ports all to<Integer>() functions in QLocale to QStringView.

Change-Id: Idc3f026d5afdf51abab670b54ea96d2361cdc350
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-29 15:05:25 +00:00
Marc Mutz
46351b4e60 QColor: port to QStringView
... leveraging the existing support for QLatin1String, which is the
char equivalent of QStringView.

The only noteworthy changes here are the port of the low-level
functions to size_t and that the internal template function,
setColorFromString(), can now take its argument by value, since only
views are ever passed to it anymore.

In the test, used new QTest::addRow() to format test names, and
introduced temporaries to avoid re-calculating the same input values
for every check.

Change-Id: Ia3c59e5c435ff753f34993a8d85c0c0b4e8e2b22
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-29 12:29:52 +00:00
Marc Mutz
7180236063 QStringView: improve manual overload management
We want to prevent

  QStringView(QChar|QLatin1String|QByteArray|const char*)

from compiling as QStringView(QString(...)), so I added = delete'ed
ctors for these types to QStringView. However, that makes QStringView
participate in overload resolution for these types. Even if the
QStringView ctor will always fail to compile, the presence of these
ctors alone makes calls to functions overloaded on QString and
QStringView ambiguous:

   f(QStringView);
   f(QString);
   f(foo);        // ambiguous
   f(QChar('f'))    // ambiguous
   f(QLatin1String(foo)); // ambiguous
   f(QByteArray(foo));    // ambiguous

Fix by making the QString and QStringRef constructors templates
constrained to accept only these two types. This should also help to
move the QStringView definition to before the QString one (as soon as
we get rid of or start to ignore QString::Null), simplifying a lot of
code in qstring.h down the line.

This should also fix MSVC's accepting of two user-defined conversions
which caused static non-compile-tests to fail in the initial
QStringView patch, and which were therefore removed. This patch brings
them back.

Change-Id: I95ac38c0d31cd8c726f7e952017569d32e484413
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-29 12:29:35 +00:00
Laszlo Agocs
e9c06b25af Fix clang doc parsing in generation qvulkanfunctions.h
Change-Id: Ic2ac2168af30a3420bdf9181cc4dc5f0a4d8587e
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-03-29 12:23:02 +00:00
Laszlo Agocs
c72b821b59 Add the Vulkan cube example
Features a little bit more than a cube, though.

Change-Id: I636d4875ba9ccf722ed3caab97f14570be785748
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-03-29 10:58:06 +00:00
Marc Mutz
e7a7931ba1 QtGlobal: add qssize_t
It replaces Posix' ssize_t in cross-platform code. Most importantly,
it allows QStringView users to refer to QStringView::size_type by
a shorter, less intimidating name.

Change-Id: I2128fefd2ffdd258b0b55cd90802a23c6bc033f6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-29 07:36:33 +00:00
Marc Mutz
9349ec2921 Long live qCompareStrings()!
These free functions are designed to solve the problem that we
currently have QString::compare(QString, QString), but we have no
QString::compare(QStringRef, QString), even though we have
QString::compare(QStringRef). A compare(QString, QStringRef) only
exists in QStringRef.

This makes writing generic code tedious and error prone.

Notably absent are comparisons involving char* and QByteArray. These
will be added when we add QUtf8String, the UTF-8 counterpart to
QLatin1String.

Change-Id: I2dd7c4b1a1e0883ef0091396ee8c190012f4efba
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-29 04:30:44 +00:00
Marc Mutz
8c779f9760 QLocalePrivate: port number parsing to QStringView
This ports all functions in qlocale_p.h to QStringView that can be
ported with the QStringView features we already have.

Prerequisite for QStringView::to<Integer>(), and
QLocale::to<Integer>(QStringView).

Change-Id: I52112dc199cdf3a8545e722399b1c9cceaf797e1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2017-03-29 04:30:10 +00:00
Marc Mutz
3fc09372fb QScriptItem: reduce boilerplate code
The class does not need to be exported, as it is all-inline, and
non-polymorphic.

The class also does not need a default ctor, except that QVector
requires it, so make the default ctor private and grant QVector
friendship.

Add constexpr and noexcept.

Mark as primitive instead of movable.

Change-Id: Ia5d11de8eb993cb080002804e11176dc5226a04c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-29 04:28:48 +00:00
Edward Welbourne
d37e70c4bc QDateTimeParser: rename some confusingly-named variables
The parse() method's so-called "currentValue" is a caller-supplied
const that isn't (because it can't be) updated to reflect what's
parsed, albeit parse() passes it to other methods that presume it is
(I'll fix this in a later commit).  Renamed to reflect that it
actually just supplies defaults for any fields not parsed from the
string.  Then newCurrentValue is in fact the date-time we finally end
up having parsed, so rename it to reflect that.

Change-Id: Ic6add2673b5b245606dbb6415d84c18fc085e456
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-28 18:59:09 +00:00
Edward Welbourne
1d18414646 QDateTimeParser: tidy up reading of numeric parts of a date
Make some variables more local.
Make a loop simpler (and run it earlier).

Change-Id: I28c0c933b2a6599973d70d66105da6046189d8eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-28 18:58:32 +00:00
Richard Moe Gustavsen
4b62d7ba9e iOS: add support for using the input panel as a trackpad
With iOS 10 you can, with some versions of iPad/iPhone (e.g
iPad pro), start a trackpad gesture by using two finger swipe
on the input panel. This will let you move the cursor around
in the text edit.

This patch will implement the missing function that makes this
available also on Qt/iOS.

[ChangeLog][iOS] Support added for using the input panel as
a trackpad using two-finger swipe.

Task-number: QTBUG-59403
Change-Id: I456f5841e10d1e04218aafc78db87671f1a39ca9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-03-28 13:28:39 +00:00
Marc Mutz
239e862ff7 QStringView: document utf16() and why it's the way it is
Change-Id: If141308f4a35a10ff86b0c5259bc4df849bba36a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-28 11:27:45 +00:00
Marc Mutz
2c265d2700 QString: clean up internal string comparison functions
String comparison drew on a large number of internal functions such as
qMemEquals, ucstr{n,}{i,}cmp, and QString::compare_helper, all with
wildly different calling conventions. E.g. ucstrncmp took its
arguments as QChar*, while ucstricmp required ushort*. A complete
cleanup of these functions is left for another patch. This patch, as a
first step, centralizes calls to these functions.

Introduce two helpers, qt_compare_strings(QStringView, QStringView, cs)
and qt_compare_strings(QStringView, QLatin1String, cs) and replace all
uses of said lower-level functions with calls to these two functions.

I'm using QStringView instead of the more traditional (QChar*,int)
pairs, since we get two major benefits:

1. The onus of checking for valid arguments is put on the callers
   (creating QStringViews with negative sizes is UB), allowing these
   functions to be noexcept, even though the implementation still
   calls functions taking (ptr, size) or (ptr, ptr) tuples. Duly add a
   few asserts where we construct QStringViews from (ptr, size) pairs
   passed in through exported API.

2. Since QStringView can be constructed from both ushort* and QChar*,
   we no longer have to cast at the call sites. Much of the
   simplification of the code is due to reduced casts.

The Windows 64-bit ABI stipulates that no values greater than the
register width can be passed in registers (no register pairing as with
all other ABIs), but a) that is their problem, b) it does not seem to
matter within a TU, c) MS is known to introduce new calling
conventions all the time (like __vectorcall in MSVC2013), so maybe
they will introduce a __faststructcall at some point and d) giving up
on the above-mentioned two benefits for an unknown runtime cost means
we're falling prey to premature optimization.

As a consequence of the cleanup, qMemEquals() and ucstrnicmp(ushort*,
ushort*, int) can already be removed.

Port the ucstr{i,}cmp() functions to QChar/char to avoid casting in
their only callers, qt_compare_strings().

Port ucstrcmp from int to size_t indices to avoid MSVC warnings when
passing QStringView::size() to them.

Change-Id: I4a8add0fc773dc0e1225a3b9a1c1248341a1720f
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-28 11:27:40 +00:00
Liang Qi
71a2d4fa3d Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev 2017-03-28 11:20:40 +00:00
Liang Qi
b48a13fd68 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	examples/examples.pro
	tests/auto/corelib/tools/qchar/tst_qchar.cpp
	tests/auto/other/qaccessibility/accessiblewidgets.h

Change-Id: I426696c40ab57d14dc295b8103152cede79f244c
2017-03-28 09:28:31 +02:00
Tobias Koenig
6c32927f8c Improve PDF/A-1b support in QPdfWriter
Add new enum QPrinter::PdfVersion to switch QPdfWriter
into PDF/A-1b mode. In that mode
    - meta data are embedded in XMP format
    - a color profile for sRGB is embedded and an OutputIntent defined
    - the ID key is added to the document trailer dictionary
    - a CIDSet entry is added to the font descriptor
    - transparency is removed from pens, brushes and images

Change-Id: Ia8a24d83609b239e716aefc1ba05f07320dbd290
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-28 07:02:05 +00:00
Daniel Teske
3398d9d40c Fix clipping of graphics effects in high dpi mode
Consider this pseudo code:
setSystemClip(region);
setSystemTransform( scale 2x );
setSystemTransform( scale 2x );

The second call to setSystemTransform should be a noop. Yet, with
the current code in setSystemTransform, the region would be scaled
twice by 2x and thus the clipping would be incorrect.

Fix that by saving the original untransformed clip and in
setSystemTransform recalculate the effective transform.

This is also a better fix for QTBUG-44067 /
sha: 083a945c166b325298a43ba591b1338d1b0f99b6, since with this patch
the order in which system clip, viewport and transform are set does
no longer matter.

Task-number: QTBUG-57257
Task-number: QTBUG-55698
Change-Id: Ibc232822e97ab116f7173a0cc50bba5a367619d8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-03-28 05:23:53 +00:00
Andy Shaw
9292ea17a0 Use unique table name for the sqlite_enableRegexp test
This change amends 2a3297c726.

Task-number: QTBUG-59317
Change-Id: Ia08b83785f67105a1c7e71c1f4081f1bc755d756
Reviewed-by: Liang Qi <liang.qi@qt.io>
2017-03-27 09:07:02 +00:00
Kimmo Ollila
15fe60cfda Workaround GHS compiler bug
This temporary workaround allows to compile with GHS toolchain and
should be removed when GHS provides patch to fix the compiler issue.

Change-Id: I0d0eac8054e6ba2f448fed3d3c80a518e0d2af97
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-27 09:00:15 +00:00
Friedemann Kleint
e8d03c5599 Bump copyright year
Task-number: QTBUG-59648
Change-Id: Ie2d08515f4ad177bab338210a0a3e52f5519dcc3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-27 07:38:36 +00:00
Liang Qi
d5df0e9949 Merge "Merge remote-tracking branch 'origin/5.8' into 5.9" into refs/staging/5.9 2017-03-27 09:21:47 +00:00
Liang Qi
7702fe8602 Merge remote-tracking branch 'origin/5.8' into 5.9
Change-Id: Icdd71e9713725bda9c305e338f5c8b41a92ed8e8
2017-03-27 10:42:08 +02:00
Shawn Rutledge
1e7795ef60 Add documentation for TabletTrackingChange enum value
Amends 6aaf853222

Change-Id: I2c264db235ea552ce6b4eb003d7daeeb2cecde6f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-03-27 08:32:56 +00:00
Andy Shaw
197b55c939 iOS: Hide the overlay when the keyboard is hidden
If the keyboard is hidden via the hide keyboard button then the edit
menu should also hide with it. This ensures it behaves in the same way
as native applications on iOS then.

Change-Id: I4c714dd5c5cb27d8eaf310e2911dc38feb1cb74e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-03-27 07:21:32 +00:00
Laszlo Agocs
dfef2e3f3e Clarify the front face winding order in the Vulkan examples
After applying the correction matrix the front face is CW, not CCW.

The examples work either way but fix them up to avoid reader confusion.

Change-Id: I491e6dc17c21897a59f36d32061e937f2b6c4c9d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-03-26 22:40:18 +00:00
Laszlo Agocs
92dce210a2 QVulkanWindow: Add missing device wait after user code
In a multi-threaded setup it is not unlikely that
releaseSwapChainResources() will wait for and submit any remaining
frame building. Hence a wait is necessary also after invoking the user's
implementation.

Change-Id: I3c963c05c1c3981980da5e4ff9c572df24a1e473
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-03-26 22:40:14 +00:00
Marc Mutz
9a9195c806 Make QLocalePrivate::codeTo*() take QStringViews
... and remove now-superfluous overloads.

Adapt the sole user of the (QChar*, int) overload to construct a
QStringView first, which removes the ugly cast at the call site.

Change-Id: Ie5249d4b1b82d471896548e8a7d83c130ae28130
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-03-26 06:44:36 +00:00
Marc Mutz
59928d23fc Port QLocalePrivate::*ToCode() to QLatin1String
The returned data is in US-ASCII (or else Latin-1), and resides in
consecutive memory. We can therefore return it in a QLatin1String,
which, however, will in general not be NUL-terminated.

Many users use the return value as part of a QStringBuilder
expression, and those which are not are not pessimized further by
this change.

The caller in qtimezoneprivate_icu looks as if it could simply zero
-terminate the return value and use it as-is, as opposed to
converting to UTF-8, but I left the code equivalent to the original
just the same.

Change-Id: I0e628af8c1320fcff8d0aacf160e859681d2b85a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-26 06:44:29 +00:00
Kimmo Ollila
1dd54b5647 Increase the maximum recursive template depth on INTEGRITY
Set the limit to 128 instead of the default 64 by adding
QMAKE_CXXFLAGS += --pending_instantiations=128. This is
needed by QMetaType::typeName array implementation.

Change-Id: I3fd13967f862f492210572cfe7ee9ffc5e7c9745
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-25 15:45:58 +00:00
Marius Kittler
38550c562d json encoder: Harmonize number serialization with ES6
Ensures that numbers representable as 64-bit integer
are not printed using exponent notation.

Some JSON implementations such as the one of the Go
standard library expect this in the default
conversion to int.

Change-Id: Ic3ac718b7fd36462b4fcabbfb100a528a87798c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-25 14:26:30 +00:00
Olivier Goffart
94e6e8dfc6 tst_moc: fix include guards
Change-Id: I465c035cc741f94cb6737e86e33fbd1589ddaa8e
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-25 12:53:09 +00:00
Marc Mutz
d8e2db0173 QDir: replace QLVA<QChar> with QVLA<ushort>
... as used in qstring.cpp, too. QChar is only marked as movable, not
primitive, as it should have been and ushort is, and there's some hope
that the template instantiations can be shared across TUs.

Saves a rather disappointing 148B in text size on optimized GCC 7
Linux AMD64 builds.

Change-Id: Ic9558a4d83611a6461cd5540c9090cbd4c4f2f4e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-25 08:03:10 +00:00
Marc Mutz
5ca7d56aca QVarLengthArray: fix compilation with GCC 7
This fixes a warning-turned-Werror in qdistancefield.cpp:

  In member function ‘void QVarLengthArray<T, Prealloc>::realloc(int, int) [with T = bool; int Prealloc = 256]’,
      inlined from ‘void makeDistanceField(QDistanceFieldData*, const QPainterPath&, int, int)’ at ../../include/QtCore/../../../../qt5/qtbase/src/corelib/tools/qvarlengtharray.h:275:10:
  ../../include/QtCore/../../../../qt5/qtbase/src/corelib/tools/qvarlengtharray.h:390:19: error: ‘void* memcpy(void*, const void*, size_t)’: specified size between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
               memcpy(ptr, oldPtr, copySize * sizeof(T));
               ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Apparently GCC cannot rule out that copySize may be negative in the
call to memcpy. Put GCC on the right track by adding a Q_ASSUME.

Change-Id: I63e3801e52ebe2a7f77e3a97ef03ec3869319c8c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-03-25 08:02:31 +00:00
Eric Lemanissier
610a9e8f31 SQLite: Disable mutex on connections
By default SQLite opens DB in Serialized mode, allowing connections to be used
from several threads simultaneously: https://www.sqlite.org/threadsafe.html
According to Qt documentation, database can only be used from one thread.
This change opens sqlite dabases in "Multi-thread" mode, so that one does not
pay for useless mutex locking for each DB access

Change-Id: Ife61f1a648d74c91d3b27a2ce0059d052ccc62b2
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-25 06:18:07 +00:00
Thiago Macieira
e19fda916a Fix some warnings found by QNX's compiler
-Werror is now disabled for that compiler, but it doesn't hurt to fix.

io/qstandardpaths_unix.cpp:149:32: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
qtestcase.cpp:2330:31: error: narrowing conversion of '(ms / 1000)' from 'int' to '_Timet {aka unsigned int}' inside { } [-Werror=narrowing]

Change-Id: Id92f4a61915b49ddaee6fffd14aea2c1e686e8f2
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
2017-03-25 04:51:01 +00:00
Thiago Macieira
e26bcc4d5d Disable -Werror for QNX's compiler
The compiler is mostly GCC in disguise, but the libraries are not. Since
the toolchain is not open, it's difficult to fix issues in it.

Task-number: QTBUG-59671
Task-number: QTBUG-59672
Change-Id: Id92f4a61915b49ddaee6fffd14aea2639153f073
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-03-25 04:50:44 +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
Marc Mutz
00a8be85d1 Long live QStringView!
QStringView is a simple container for (const QChar*, int) and (const
char16_t*, size_t). It acts as a replacement interface type for const
QString and const QStringRef, and enables passing all kinds of
string-like types to functions otherwise expecting const QString& -
without the need to convert to QString first.

The use of this new class is guarded by a macro that enables three
levels of QStringView support:

 1. offer QStringView, overload some functions taking QString with
    QStringView

 2. like 1, but remove all overloads of functions taking QStringRef,
    leaving only the function taking QStringView.  Do this only where
    QStringRef overloads tradionally existed.

 3. like 2, but replace functions taking QString, too.

This is done in order to measure the impact of QStringView on code
size and execution speed, and to help guide the decision of which
level to choose for Qt 6.

This first patch adds QStringView with most of its planned
constructors, but not much more than iterators and isNull()/isEmpty().

Further patches will add support for QStringView to QStringBuilder,
add QStringView overloads of functions taking QString, and add the
complete API of const QString to QStringView.

[ChangeLog][QtCore][QStringView] New class, superseding const QString
and QStringRef as function parameters, accepting a wide variety of
UTF-16 string data sources, e.g. u"string", std::u16string{,_view},
and, on Windows, L"string", std::wstring{,_view} without converting to
QString first.

Change-Id: Iac273e46b2c61ec2c31b3dacebb29500599d6898
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-03-24 18:34:35 +00:00
Edward Welbourne
e5c0371d18 Fix propagation of locale from widget to its children
Fix the condition in QWidgetPrivate::resolveLocale() to decide whether
to propagate locale: make it match setLocale_helper()'s condition when
deciding whether to propagate to descendants.  This lead to a
QDateTimeEdit's calendar popup not getting told what locale to use
correctly, unless we setLocale() on it overtly, which then blocked
propagation of locale changes to it unless QDateTimeEdit manually
propagated the changes.

Fix the documentation of WA_WindowPropagation to mention locale as
also being propagated (which it was in several places, only neglecting
this one in resolveLocale).

[ChangeLog][QWidget][Qt::WA_WindowPropagation] Propagate locale
consistently, along with font and palette, within the widget
hierarchy.  Previously, locale was propagated on ancestral
setLocale(), but not on creation of the descendant.

Task-number: QTBUG-59106
Change-Id: I92270f7789c8eda66a458274a658c84c7b0df754
Reviewed-by: David Faure <david.faure@kdab.com>
2017-03-24 13:57:22 +00:00
Thiago Macieira
9021a748af QStorageInfo: Fix warning about unused variable
Happens on non-Linux, non-macOS Unix systems (got it on FreeBSD).

Change-Id: Ie67d35dff21147e99ad9fffd14acc7308b5ff17e
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-03-23 22:15:27 +00:00