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>
The fix for dangling pointers in 524f39 caused some problems when the
QByteArray was implicitly converted to const gchar*. This is fixed
by wrapping the QString in question in qUtf8Printable where possible
and removing the former convenience method.
Task-number: QTBUG-59692
Change-Id: I5abcf42e1c23b12c7a5c4c195d801f377fe9d138
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Apply white text only for macOS style.
Amends 2c0033983b
Task-number: QTBUG-59784
Change-Id: I9e66e929699efd715ed4565394f1aba763aeb32a
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
GCC bug 68949 causes tst_QGraphicsGridLayout and tst_QGraphicsLinearLayout
to fail on 5.2.x/5.3.x: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68949.
This change adds aggregate initialization to QSizeF arrays to work around
the bug. The bug was discovered when compiling and running tests on ARM
with GCC 5.3.0.
Change-Id: I9ecf7b032b6ca1477c29dca3bd7d0ec8d69a0454
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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>
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>
Change-Id: I6b1239941f8fd13eec72b0874d15d821d717ddf3
Reviewed-by: Stephan Binner <stephan.binner@basyskom.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Change-Id: Ia384c2b48a6eaccb424cdde00240ebcfa6fd24c6
Reviewed-by: Stephan Binner <stephan.binner@basyskom.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Change-Id: Id1f04f9ff6da9bec07068d4ebed15f8bd29105af
Reviewed-by: Stephan Binner <stephan.binner@basyskom.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Change-Id: I352c011b21624ae9fb9db5a608e8c2b2491a05cd
Reviewed-by: Stephan Binner <stephan.binner@basyskom.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Change-Id: Ib0eae1858880e3fe2b6c6abd94c7ea0bbc2649a2
Reviewed-by: Stephan Binner <stephan.binner@basyskom.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
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>
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>
QEMU does not support all syscalls needed for udp socket testing.
Skipped tests that can't pass on QEMU.
Change-Id: I40882207a47cfafbc3becb3dff8e7cead9676255
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Previously we were always setting SpdyWasUsedAttribute for SPDY/HTTP/2/HTTP/1.1
(true/false) which is confusing. Now if HTTP2AllowedAttribute was set to true on
a request, we set HTTP2WasUsedAttribute. Otherwise, as we did before, we're setting
SpdyWasUsedAttribute.
Change-Id: I0c44cfb5469fef0c12719baa951197ee2accee4a
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This seems to give pretty good result when EnableHighDPIScaling is NOT set.
But this seems to be worse when it's set.
Task-number: QTBUG-58959
Change-Id: I8de5a6c3c8b6146b1cb8f89676463206af404083
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Make it possible to blacklist the (newly created)
quitOnLastWindowClosedMulti() if all else fails.
Task-number: QTBUG-59088
Change-Id: I8c143a2017e7aefaf6cad6ada9c1464d40c952e7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
qtquickcontrols2-customize.qdoc:28: warning: Can't link to 'Creating C++ Classes'
Change-Id: I7e8e84d7a0d03a84f32d860bc646640e5cf6258f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
... 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>
Only test for xcb specific sub-features if xcb is available in
the first place - not the case with Boot2Qt builds.
Change-Id: Iad49648ce1c8781d0c7bb2b2dcd4b7834434d51d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
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>
If the mode is not GTK_FILE_CHOOSER_ACTION_SAVE or
GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER , a GTK warning will
be generated which makes Qt WebEngine's Glib error handler
assert. Doing so only when showing the dialog is too late.
This patch moves the actual file selection to a private method
that can be called from both selectFile and applyOptions in
order to prevent overwriting the file chooser action potentially
multiple times.
Task-number: QTBUG-59692
Change-Id: Ied939248cdc3a0b4c9e8239ab61ba617a46b8496
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
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>
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>
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>
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>
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>
Make some variables more local.
Make a loop simpler (and run it earlier).
Change-Id: I28c0c933b2a6599973d70d66105da6046189d8eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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>
Also use canonical contact url.
Change-Id: I43f8c6a2c4949ee0e054045bccc17d82575b072c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
The workaround introduced in 38a55c7 to explicitly call viewDidChangeFrame()
was not ideal for a multitude of reasons. Instead we can just initialize the
NSView with a NSZeroRect frame, which will ensure that whatever geometry
we set from the Qt side will result in geometry change and expose events.
The only case where we will not receive an expose event is if the QWindow
is requested to be 0x0 sized, but that wouldn't warrant an expose event
anyways. Also, it's not possible to initialize a QWindow to 0x0 from the
Qt side, as that will trigger QPlatformWindow::initialGeometry() to pick
the default size (160x160 in the case of macOS).
Task-number: QTBUG-58963
Change-Id: Ia84de7edcfdf26b90e4e93186fabe8b5c7382caa
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
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>
Instead of the never-ending blacklisting of "broken" drivers, simply switch
to always choosing a byte ordered QImage format with OpenGL ES, and keep
on using the (one and only) spec-mandated GL_RGBA/GL_UNSIGNED_BYTE combo.
There is nothing broken with not supporting BGRA for glReadPixels even when
GL_EXT_read_format_bgra (an out of date, pre-2.0 extension that got folded
into the spec to begin with) is present. We do not have a good way to tell
if BGRA_EXT is supported for glReadPixels or not, so just skip the whole
problem altogether.
Task-number: QTBUG-59283
Task-number: QTBUG-59303
Change-Id: I9f0605380923bd3b3ffdeb80f5c172d3e4cc7927
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
qcocoawindow.mm: we can replace QHash::values() with std::vector
since CoW is needless here and std::vector is more cache-friendly.
Also replace foreach with range-based for.
qitemeditorfactory.cpp: QHash::values() is used as auxiliary container
to create QSet. Replace it with std::vector since CoW is needless here
and apply sort-unique idiom to remove duplicates.
Also avoid needless allocations.
Change-Id: If34c7016977ceb7fab68e9298bf2e1944af79139
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Clang does not like Q_FALLTHROUGH in 'default' label, the diagnostics is:
'fallthrough annotation does not directly precede switch label'.
Accodring to their docs: "The fallthrough (or clang::fallthrough) attribute
is used to annotate intentional fall-through between switch labels. It can
only be applied to a null statement placed at a point of execution between
any statement and the next switch label." - obviously, there is no 'next
switch label' in our case.
Change-Id: Ia7dba4cb965a85d229d44b04b69633a8f07d4a0c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
documentation of QMAKE_DEVELOPMENT_TEAM and
QMAKE_PROVISIONING_PROFILE
Change-Id: Id5854862e44387e31db40f574d85f88512c27f0c
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>