Commit Graph

32343 Commits

Author SHA1 Message Date
Marc Mutz
50faf34442 [doc] QStringView: remove documentation of removed constructor
Change-Id: I3b5ad8deabd67f2327c45fe8aa914c0e7883513c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-06 07:33:14 +00:00
Thiago Macieira
02700cf6c2 Add an extra check for qssize_t's size and type
The definitions of size_t and ptrdiff_t ([support.types.layout] p2 and
p3 respectively) do not specify that they need to be as big as a
pointer. They just need to be big enough to hold the size of the largest
object and the biggest array subscript, respectively, the platform
supports (e.g., 16-bit DOS would have them as 16-bit in all memory
models, except huge).

But we depend on them actually being the size of a pointer in many
places, such as in QArrayData::offset, that stores the linear distance
from the end of the structure to the beginning of the data, wherever it
is in memory.

It's also a good idea to verify that qptrdiff and qssize_t are the same
type.

Change-Id: I9ad33fff8b634979bdbafffd14bbd1223afc58e8
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-05-06 02:57:41 +00:00
Alex Trotsenko
9e1f60053a QWindowsPipeReader: remove code duplication in read()
QRingBuffer::read() implements the same loop.

Change-Id: I480fe07e2400dfaee560f22bdbf07d6cdd013eb2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-05-05 15:45:54 +00:00
Samuel Gaist
ae292be869 Implement key-value iterator
This patch implements an iterator that returns a pair containing both the
key and the value of an entry in QHash/QMap.

[ChangeLog][QtCore][Containers] Added an stl-like iterator to go through
QHash/QMap returning both the key and the value of the element pointed to.
That lets QHash/QMap interoperate better with stl's algorithms like
std::set_union.

Change-Id: Idbf8a8581510b3493648c34ab04c556de9fa4aa7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-05-05 14:25:56 +00:00
Gatis Paeglis
c2c5026891 cleanup: remove redundant QGuiApplicationPrivate::buttons
This variable was introducing during Qt 5.0 Q{Gui}Application
refactoring days (2011 or even before) and since then has been
used interchangeably with QGuiApplicationPrivate::mouse_buttons.

This patch removes the duplicate member variable as it is
redundant and could be a source of potential errors.

Initially I was thinking that ::buttons might be used for
the purpose of QTestLib, but it is not. QTestLib delivers
mouse events directly via qApp->notify() (mouse button state
is update via QGuiApplicationPrivate::mouse_buttons from notify()),
or via window system interface QWindowSystemInterface::handleMouseEvent
(which goes through QGuiApplication::processMouseEvent).
Looking at QGuiApplication, it is clear that ::buttons
and ::mouse_buttons always have the same value, as there
is only one assignment to these members in QGuiApplication:

mouse_buttons = buttons = e->buttons;

And there are no other places that would assign to
QGuiApplicationPrivate::buttons.

Change-Id: Ib60d366bf056a98b15bb4538a569693e7bd022e2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-05-05 13:54:48 +00:00
Marc Mutz
38134ff41e Enable c++17 in the QStringApiSymmetry test
Because it's the correct thing to do.

Change-Id: I1d9fb482ffed6f4c36b4bc25d05cabcd07d87a78
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-05 07:11:57 +00:00
J-P Nurmi
63d08003cf Fusion: draw DPI-scaled arrows
Replace the "hard-coded" fusion_arrow.png with qt_fusion_draw_arrow()
that scales appropriately on high DPI screens.

Task-number: QTBUG-40277
Change-Id: I2c4a134de757a39d7744977bd41accff69810521
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-05-04 16:37:13 +00:00
J-P Nurmi
edcc71be87 Fusion: DPI-scale menu items
The sub-menu arrow indicator is still tiny. The Fusion style uses
a pre-made pixmap (fusion_arrow.png) for drawing the various arrow
indicators for sub-menus, spinboxes, combo boxes, scrollbars etc.
This will be addressed in a separate patch.

Task-number: QTBUG-40277
Change-Id: Id82c564340854e922b3b5f5bcf038ec535ed6cf4
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-05-04 16:37:01 +00:00
Pier Luigi Fiorini
ec6c21717a xcb: Decode EDID blob
Retrieve and parse EDID blob.
Return screen product information from EDID.

[ChangeLog][Platform Specific Changes][Linux/XCB] Add screen product
information from EDID.

Change-Id: Ic54429cdc90c41342c37511bcaebce95c175f517
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-05-04 08:10:31 +00:00
Marc Mutz
b1debc11c1 QStringAlgorithms/private: prefer to trim whitespace from the end
When calculating what to trim in trimmed_helper_positions(), first
trim the end, then the front.

This way, a string that consists of just whitespace will remain
anchored at its front, and we do not run into the memmove case in
trimmed_helper_inplace, which, even though there's zero elements to
move, still calls a potentially-out-of-line function (memmove()).

Change-Id: I7024ffa1f7ae2effb9c5166ec8f30a42b8d51079
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-05-04 07:20:55 +00:00
Jarek Kobus
b53f8bf040 Keep in sync uic sources with qttools module
Change-Id: I680505b8d68f363e6dc86d090632ec9b021ee981
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-05-04 06:55:27 +00:00
Tor Arne Vestbø
58114b5ab0 tst_qscopedpointer: Actually test what test name says it should test
Change-Id: Idda6e34c4438d1695f8268426fe923ad51ff6d10
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-05-03 20:10:00 +00:00
Marc Mutz
2a86c565e8 tst_QStringApiSymmetry: add checks for trimmed()
All good (now).

Change-Id: I666773856a239826e646398a943e7df30bd81671
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-05-03 19:58:02 +00:00
Marc Mutz
96edd0e440 tst_qstringapisymmetry: also check potential rvalue overloads of transformations
For transformations, regardless of whether they're currently
overloaded on rvalue-this or not, check the results of calls to const
lvalues as well as mutable rvalues.

Use the new mixed-type QCOMPARE more.

Change-Id: Ibaa436cd88b40e5c0823c3bbe5b04a9964e7e987
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-05-03 19:57:52 +00:00
Shawn Rutledge
64967461ee QVulkanWindow: fix fatal warning on Clang 4
qtbase/src/gui/vulkan/qvulkanwindow.cpp:1882:42: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
        VkClearColorValue clearColor = { 0.0f, 0.0f, 0.0f, 1.0f };
                                         ^~~~~~~~~~~~~~~~~~~~~~
                                         {                     }
1 error generated.

VkClearColorValue is a union, so it wants to be clear that we are
initializing only one of the union's members, apparently.
(Even though initing more than one wouldn't make sense.)

Change-Id: Id4afa3ddc1b4ce7e24e681fb93c0ee9083c41e08
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-05-03 14:04:49 +00:00
Tor Arne Vestbø
226a20dff8 macOS: Replace deprecated NSOKButton usage with NSModalResponseOK
Change-Id: Ibecda9bcafc1f366315b5aac8c14d50c49ccf10d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-03 13:57:40 +00:00
Marc Mutz
d58c600543 Remove QAddConst
It was added to support qAsConst(). When <type_traits> became mandatory,
porting qAsConst() to std::add_const was forgotten.

Change-Id: Ifb9b54d12554ce19dca4664642a8644f49aeb6af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-05-03 09:21:41 +00:00
Pier Luigi Fiorini
3792ab804d eglfs_kms: Decode EDID blob
Retrieve and parse EDID blob.
Return screen product information from EDID.

[ChangeLog][QPA][eglfs][kms] Add screen product information from EDID.

Change-Id: I766999afd9298e82f6147fdeba5d14757bfb4b03
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-05-02 12:07:05 +00:00
Pier Luigi Fiorini
5f7ab88055 EDID parser library
Add a support library to parse EDID that will be used by platform
plugins.

In order to tell the screen manufacturer from the identifier, the
parsers reads /usr/share/hwdata/pnp.ids or, if it's missing, uses
a lookup table previously generated from that file with a Python script.

Change-Id: Ie021eb68be91f06dc0da54445f88e3533f78d23e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-05-02 09:11:56 +00:00
Gabriel de Dietrich
06713ded60 Introducing AA_CompressTabletEvents
Tablet events compression has been missing since commit
60cd1c6775 in 5.6.1, and there's
no way to bring the old behavior back. Since tablet events are
not taken into account by AA_CompressHighFrequencyEvents on
purpose, we introduce this new flag.

This new flag is conditional to AA_CompressHighFrequencyEvents
being set in order for it to be effective.

[ChangeLog][QtCore][Tablet support] If the application attribute
AA_CompressTabletEvents is set in addition to AA_CompressHighFrequencyEvents,
even the QTabletEvents will be compressed (only on the X11 platform so far).
AA_CompressHighFrequencyEvents does not enable compression of tablet events
by itself, because paint applications typically need to process 
all possible tablet events in order to draw the smoothest curves.

Change-Id: Ie7434ab4f9a4c64f2626c75e661cfd0d6cd22896
Task-number: QTBUG-44964
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Reviewed-by: Wayne Arnold <wayne.arnold@autodesk.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-05-01 04:41:27 +00:00
Robin Burchell
5398aaabfc tuiotouch: Finish categorizing all logging
Better than going half way and not quite finishing, and nicer results.

Change-Id: If6bf005182534f6fbfc13544d4190d3e54a272e9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-04-30 23:18:11 +00:00
Olivier Goffart
9d918495ee Add a few std::move in functions accepting slots
This allows the use of move-only function objects

Task-number: QTBUG-60339
Change-Id: If3595fca338cf7f3039eb566cc02e4e73cd04c86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-29 08:24:24 +00:00
Olivier Goffart
a6c091c2d1 Support move-only function objects in QObject::connect
[ChangeLog][QtCore][QObject] Added connect() support for move-only
function objects.

Task-number: QTBUG-60339
Change-Id: Iae5e48432bb64517b0607b0c2ba23931957f432e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-29 08:24:18 +00:00
Laszlo Agocs
779c00d454 Add a spec for the Asus Tinkerboard
Prioritize DRM/KMS for eglfs. There are now binary drivers for Mali
that enable DRM, GBM and Wayland.

Change-Id: I9ac97f5006f88706854e9160bdafb82f9f8aac5c
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2017-04-28 17:35:03 +00:00
Marc Mutz
3644e722c2 QLatin1String: add startsWith()/endsWith()
[ChangeLog][QtCore][QLatin1String] Added startsWith(), endsWith().

Change-Id: I7f75a5a1f0409f4b9d3e41b73f4fb5d137572b09
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-28 16:41:42 +00:00
Marc Mutz
d21a147e2b QStringView: add startsWith(), endsWith()
Change-Id: I72aef9236daedc3013c62d3f1d737159f85572b8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-28 16:41:36 +00:00
Marc Mutz
5f3d6ce570 QString/Ref: add startsWith/endsWith(QStringView) overloads
[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>
2017-04-28 16:41:26 +00:00
Marc Mutz
cac2fc81b7 Long live qStartsWith()/qEndsWith()!
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>
2017-04-28 16:41:08 +00:00
Jesus Fernandez
99d809bd75 Add move special member functions to QSqlError
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>
2017-04-28 12:50:34 +00:00
Nikita Krupenko
7ef398e8fa QFileDevice/QFileInfo: Add fileTime() and setFileTime()
[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>
2017-04-27 18:44:15 +00:00
Marc Mutz
8d32204592 QStringRef: fix trimmed() returning null strings on empty input
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>
2017-04-27 17:04:32 +00:00
Jesus Fernandez
0803285fe7 Fix resource leak
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>
2017-04-27 16:40:17 +00:00
J-P Nurmi
5dbd040d1c Fusion: desaturate the brown shades
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>
2017-04-27 16:03:15 +00:00
Laszlo Agocs
9a640e7bc6 eglfs_kms_egldevice: Fix type mess in nativeDisplay() virtual
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>
2017-04-27 13:19:32 +00:00
Palo Kisa
bf21f71b43 qhttpthreaddelegate: Fix build with -no-ssl after @70d8460fc20
Just fixing the typo -> misplaced #ifndef guard.

Change-Id: Ib3b0ceb615f45291cb64a0ed6c7f3a370dc506bf
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-04-27 09:31:27 +00:00
Friedemann Kleint
affb6700a4 Windows QPA: Move system tray icon implementation into the plugin
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>
2017-04-27 09:30:41 +00:00
Friedemann Kleint
7849aa6e96 Windows QPA: Add native menus
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>
2017-04-27 09:30:34 +00:00
Friedemann Kleint
121a30ccef QPlatformSystemTrayIcon: Add signal contextMenuRequested()
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>
2017-04-27 09:30:27 +00:00
Marc Mutz
940b36850d QLocaleData: remove unused bool *overflow arguments
... 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>
2017-04-27 04:35:30 +00:00
Marc Mutz
629422607f QCompletionEngine: avoid a node allocation on lookup
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>
2017-04-27 04:35:25 +00:00
Marc Mutz
e63daaa2ac tst_qstringapisymmetry: merge truncate() test into left() test
Less code duplication, since truncate() is the action version of
left().

This is done in preparation of adding more actions for the string
transformations we have.

Change-Id: I55027b5143ad3349d46091ac1cc3d24a9707caee
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-27 04:35:21 +00:00
Timur Pocheptsov
70d8460fc2 QNAM: delay SSL initialization
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>
2017-04-26 19:00:47 +00:00
Thiago Macieira
4ba740b3ba QHash: make it so a zero seed selects a constant algorithm
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>
2017-04-26 15:22:44 +00:00
Marc Mutz
9763b324fd Port internal qt_starts/ends_with to QStringView
... 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>
2017-04-26 09:13:07 +00:00
Marc Mutz
309b4b877f tst_qstringviewapisysmmetry: add a check for startsWith()/endsWith()
All good.

Can't check QByteArray::startsWith(), as it is lacking the
Qt::CaseSensitivity parameter.

Change-Id: I7f2379e520617c14514fc66d8fb3413cfb7c9147
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-26 09:12:54 +00:00
Marc Mutz
e8085de216 QString: add internal qt_compare_strings(QL1S, QSV)
... 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>
2017-04-26 09:12:05 +00:00
Marc Mutz
979f9f4d34 QLatin1String: fix qt_compare_strings(QLatin1String, QLatin1String) for null 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>
2017-04-26 09:11:27 +00:00
Giuseppe D'Angelo
5677b70eee QThread: terminate on exceptions leaving run()
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>
2017-04-26 06:25:44 +00:00
Marc Mutz
164392548e Disentangle string-related headers
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>
2017-04-25 13:47:15 +00:00
Marc Mutz
0cfcebb955 QThread: fix headersclean with C++17
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>
2017-04-25 08:11:05 +00:00