Commit Graph

32315 Commits

Author SHA1 Message Date
Thiago Macieira
870964895b Don't disable Q_REQUIRED_RESULT with Clang and ICC
They're not affected by the GCC bug noted in the comment.

Change-Id: I7814054a102a407d876ffffd14b69e8a8e2527f1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-04-20 05:40:27 +00:00
Thiago Macieira
47c9b66a8b Disable precompiled headers for small modules
Creating a precompiled header exclusively for a one- or two-file module
is wasteful. The time that it takes to build the precompiled source is
on the same order as a regular compilation, so enabling precompiled
headers for those modules just makes the build slower.

Also make it possible to override the precompiled header by just setting
PRECOMPILED_HEADER to empty.

Change-Id: I0e1a09998253489388abfffd14b5f221288c4826
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-04-20 05:39:47 +00:00
Thiago Macieira
255d291efd MSVC: Enable standards-conforming mode
Let's not allow any new code that uses non-conforming syntaxes. With
GCC and like, we already use -std=c++11 instead of -std=gnu++11 for that
very reason.

Change-Id: I4a7dc1fe14154695b968fffd14aba9f8cea69c47
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-04-20 05:39:27 +00:00
Giuseppe D'Angelo
e70e8dd6a9 qgrayraster: use a cast to void to mark a variable as unused
Do not use a self-assignment, as that may trigger compiler warnings.

Casting to void is also what Q_UNUSED is doing these days, but we can't
use it here because qgrayraster.c does not include qglobal.h.

Remove a 15-years old comment related to the self assignment.

Found by clazy.

Change-Id: I8cc92b7a1b0b5fb13824959740243e17606ec753
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-20 04:44:24 +00:00
Tor Arne Vestbø
924b02aecb Revert "Initialize QLoggingRegistry rules on first use, not qApp construction"
This reverts commit 47cc9e23a3.

We use QCoreApplication::applicationDirPath in the logging initialization to find
a possible qtlogging.ini file. Because QCoreApplication::applicationDirPath requires
a QCoreApplication instance this leads to a qWarning, which in turn leads to a
recursive call to the logging initialization, and in turn to a recursive mutex deadlock.

Task-number: QTCREATORBUG-18031
Change-Id: Ic75e1e8c062eb647991725378489bf87c9648cca
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-04-19 22:59:43 +00:00
Elvis Angelaccio
8043202114 QLineEdit: fix broken test
Commit 288bfb0bbd added a test that uses QLineEditIconButton, which
requires QT_BUILD_INTERNAL to be defined in order for the findChild()
call to work as expected.

Change-Id: Ieda18f4e26a91322e8a83c14f8d1fbbe4313ecf0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-04-19 22:59:41 +00:00
Olivier Goffart
97850b952c Fix UB in QWidgetEffectSourcePrivate::detach
Delete the QGraphicsEffect from the QWidget destructor instead of from
the QWidgetPrivate destructor. The destructor of QGraphicsEffect still
access methods of the QWidget, but the QObjectPrivate being destroyed
from ~QObject, the pointer is no longer a QWidget.

Fix warning with UB sanitizer in tst_QWidget::setGraphicsEffect

qwidget_p.h:900:23: runtime error: member call on address 0x000001d822c0 which does not point to an object of type 'QWidget'
0x000001d822c0: note: object is of type 'QObject'
 00 00 00 00  b0 46 5f 40 e5 7f 00 00  00 23 d8 01 00 00 00 00  f0 e6 00 44 e5 7f 00 00  00 00 74 47
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'QObject'
    #0 0x7fe54767db76 in QWidgetEffectSourcePrivate::detach()
    #1 0x7fe548f29815 in QGraphicsEffect::~QGraphicsEffect()
    #2 0x7fe548f2a1b7 in QGraphicsBlurEffect::~QGraphicsBlurEffect()
    #3 0x7fe548f2a208 in QGraphicsBlurEffect::~QGraphicsBlurEffect()
    #4 0x7fe5475cd463 in QWidgetPrivate::~QWidgetPrivate()
    #5 0x7fe5475ce62c in QWidgetPrivate::~QWidgetPrivate()
    #6 0x7fe5400d0dda in QObject::~QObject()
    #7 0x7fe54763d411 in QWidget::~QWidget()
    #8 0x7fe54763d7f4 in QWidget::~QWidget()
    #9 0x4cc309 in QScopedPointerDeleter<QWidget>::cleanup(QWidget*)
    #10 0x4cc309 in QScopedPointer<QWidget, QScopedPointerDeleter<QWidget> >::reset(QWidget*)
    #11 0x4cc309 in tst_QWidget::setGraphicsEffect()

Change-Id: I19c049e979cfce2adda908af8336cb4adac8f6c4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-19 13:25:19 +00:00
Olivier Goffart
cdb7e81572 Fix UB in QLayout::childEvent
We can't just static_cast a child to QLayout, because the child might
not be a QLayout, and even if it was, we might be called from the
QObject destructor so we would not be a layout anymore.
Instead we can just qobject_cast the deleted object to a QLayout and
remove it from the layout with removeItem.
This would not take in account the case where we would be called because
the QLayout gets destroyed, so we handle this case from ~QLayout by
removing ourself from the parent.

Note that the comment in ~QLayout was wrong, as the layout gets destroyed
explicitly from ~QWidget, not from ~QObject.

Change-Id: I49c6f17a76f207b9d750b6e5d987469498b96b31
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-19 13:25:14 +00:00
Tor Arne Vestbø
f368cd8868 macOS: Initialize window geometry early on, instead of when creating NSWindow
We don't need to defer to NSWindow creation before determining the initial
window geometry, and we don't need to redetermine each time we re-create
an NSWindow for a QCocoaWindow.

Change-Id: Ie13380830b44e96670ff16513f29deef5f5ae313
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-04-19 12:50:46 +00:00
Marc Mutz
58d2927861 QXmlStream: optimize PrivateTagStack::addToStringStorage()
De-duplicate the QString/Ref code paths by using QStringView instead.
Keep the old overloads so we can centrally apply the qToStringView-
IgnoringNull() optimization.

Replace insert(p, ..) where p = size() with append(..). The code
ensures in the lines before that the insertion position is the end of
the string.

Port the few QLatin1String arguments to addToStringStorage() to
QStringViewLiteral. I also considered adding a QLatin1String()
overload, but the test size increased, so the function wasn't pulling
its own weight.

This version saves 360B in text size on optimized GCC 6.1 Linux AMD64
builds.

Change-Id: I4b759fddc38b1f97a7218954e756cc19400922e9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-19 12:31:50 +00:00
Marc Mutz
e9fd074cec Use qToStringViewIgnoringNull() where applicable
Saves just over ¼KiB in QtCore text size on optimized GCC 6.1 Linux
AMD64 builds, iow: qToStringViewIgnoringNull() saves ~40B per use.

Change-Id: I3278306d5ce594e8ccd0f58b8f8d0319637d1b2b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-19 12:31:40 +00:00
Marc Mutz
ba5db13c8d QStringView: add internal qToStringViewIgnoringNull()
As long as a null QString still returns non-null data(), QStringView's
QString constructor needs to call isNull(). That's a branch we often
can do without, so add an internal function that bypasses this
correctness check.

It's internal, since we might have a Q6String that returns nullptr
data() when null, which will remove the need for this function.

What the QStringView(QString) ctor does will also have to be
re-evaluated come Qt 6, but for now, keep the public QString-
QStringView conversion correct.

Change-Id: I35dc7383bc3bd018f46aeec429185135a38ddcef
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-04-19 12:31:33 +00:00
Nico Vertriest
30d825f5f2 Doc: Fix link errors
qimage.cpp:2127: warning: Can't link to 'isDetached()'
qmatrix4x4.cpp:1933: warning: Can't link to 'operator()()'

Change-Id: I93a2ead9650faf139040173f8d3b24cfa1e730ae
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-04-19 12:27:01 +00:00
Marc Mutz
b3e66c76aa QUuid: de-duplicate uuid → string formatting
The code was duplicated for QChar and char characters. Keep only the
char version, and use QString::fromLatin1() to convert to QString.

This does not perform more allocations. It just copies 38 bytes more
than before.

Saves 788B in text size on optimized GCC 6.1 Linux AMD64 builds.

Change-Id: I1a65c8128eb2097e11527961618d54ea362e1b80
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-19 11:07:11 +00:00
Oliver Wolff
32b92b9e21 winrt: Fix keyboard modifier states
CoreWindow::GetAsyncKeyState returns flags and not enums so checking
equality does not give the needed result.

As seen in qwindowskeymapper.cpp key events that only contain a modifier
key should not have the key itself as a modifier when calling
handleExtendedKeyEvent.

With the current approach the modifier states are the same as
on desktop Windows.

Task-number: QTBUG-58750
Change-Id: Ie0f3e1d3e8294e1a6b41c9223a7a5153306579f6
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-04-19 10:27:35 +00:00
Oliver Wolff
ad0249cc79 winrt: Fix QKeyEvent::isAutoRepeat
CorePhysicalKeyStatus::KeyStatus does not give the information we are
after so we have to keep track of "auto repeat" state of the keys
ourself.

Task-number: QTBUG-59232
Change-Id: I22aa185780e5fa1f7f3c23c2deb2a0dde0c4a582
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-04-19 10:27:32 +00:00
Allan Sandfeld Jensen
ee3ac3a3bf Fix PNGs saved from QImage transform of 8-bit images
Fixes two separate errors. QImage::transform was incorrectly adding
colors to the color-table of the returned image when the converted image
would not be indexed, and qpnghandler was looking at non-empty color-
table instead of color format.

Task-number: QTBUG-43708
Change-Id: Ife14b6428ca65ac7d3a0b36a89a73e56d64586b4
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-04-19 10:08:41 +00:00
Samuel Gaist
d5cecfe8fd Migrate Windows QPA backend to use QRegularExpression
This patch updates the Windows QPA backend code to use QRegularExpression
in place of the deprecated QRegExp.

Change-Id: Ib45c374578bed5b9f2771df1ca04cc09cab6e7c9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-04-19 09:25:12 +00:00
Elvis Angelaccio
288bfb0bbd QLineEdit: Make the clear button always the leftmost button
QLineEditIconButton currently draws a fully transparent pixmap in its
paintEvent() function, when the line edit is empty. This does not work
when there is another trailing QAction that is visible even when the
line edit has no text, as reported in QTBUG-59957.

To fix this issue, make sure the clear button is always the leftmost
button.

Task-number: QTBUG-59957
Change-Id: I8a4f96aae07856aa0e1053ebb338ba9bdf052a16
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-04-19 08:49:49 +00:00
Timur Pocheptsov
254f35ce98 QNetworkReplyHttpImpl - check 'isOpen' twice
A signal emitted after the first 'isOpen' check on QNetworkReply can
trigger a slot that aborts/closes our reply. So before we can append
any data to reply's buffer, we have to re-check that we're still open.

Task-number: QTBUG-59909
Change-Id: I781d5a4fd5fc30d485af63f45cf36c254378af64
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-04-19 08:13:32 +00:00
Stephan Binner
59d9ee0aa4 Fix build for -no-feature-cssparser
Change-Id: I78b66e8a98458736c69c4955390a98f8889968ea
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-04-19 08:00:39 +00:00
Stephan Binner
b3066656e5 Fix warning for -no-feature-graphicseffect
Change-Id: I0be9e4293dfcef3c144f4e998ea071336c4d56d3
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-04-19 08:00:26 +00:00
Stephan Binner
45f7d35f7b Fix warning for -no-feature-gestures
Change-Id: Iaadc4e27ee2a75a8c053de4438ef74daaa48ee64
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-04-19 08:00:16 +00:00
Stephan Binner
dde83fdeeb Fix warnings for -no-feature-texthtmlparser
Change-Id: Ie757e4ecb9ced14bd809f56d2d3d09274fc3bc39
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2017-04-19 08:00:06 +00:00
Rainer Keller
b549a3550c eglfs: Adopt changed function signature in QtGlesStream library
Change-Id: I80fb7e403073fd264e0878d7c638812027282ad8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-04-19 07:28:05 +00:00
Rainer Keller
f9aaf0e6d5 eglfs: Use description property as screen name
Change-Id: I2322ffcb28c646b289ee718b9c3946bc0a44bd3c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-04-19 07:27:33 +00:00
Friedemann Kleint
2381332b0d Doc: Hide QPA classes
Mark QPlatformGraphicsBuffer and QSystemTrayIcon as internal.

Change-Id: I39e5b4f635fca21ab0544cd840a113514b6b1e99
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-04-19 07:25:05 +00:00
Friedemann Kleint
c5dafb177f Add debug output for QScrollPrepareEvent and QScrollEvent
Change-Id: If283cecbefdf20c80ce00f689003f6a0ed9fe42b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-04-19 06:29:50 +00:00
Giuseppe D'Angelo
2d504c6709 QJsonValue: implement copy-assignment via copy-and-swap
Now we have a swap() member, remove the comment.
Amends bbb440bab2.

Change-Id: I3640d544bbd0927109460d843252c8e5f0aefaf5
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-04-19 06:19:27 +00:00
Giuseppe D'Angelo
8a375341cf QJson*: value semantics cleanup
Re-add the move operations, add a swap(), mark as shared
(we're already using them in containers).

QJsonValue is slightly tricky, because it has an anonymous union,
which can't be easily moved in C++. Use the implementation of
the copy constructor as inspiration for the move.

[ChangeLog][QtCore][JSON] QJsonArray, QJsonDocument, QJsonObject
and QJsonValue now have move operations and a swap() member function.

Change-Id: Idfb94a93370ace96100efbd6559ef05b4c5adc39
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-19 04:50:26 +00:00
Tor Arne Vestbø
47cc9e23a3 Initialize QLoggingRegistry rules on first use, not qApp construction
Allows categorized logging before QCoreApplication has been created,
which otherwise would silently fail to output anything because the
category would never be enabled, despite QT_LOGGING_RULES being set.

Change-Id: Ia733105c5b6f28e22af511ced5271e45782da12b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-18 21:09:43 +00:00
Friedemann Kleint
9595622e36 QGraphicsBlurEffect: Fix for high DPI scaling
Preserve the device pixel ratio in the various helper functions
and when drawing.

Task-number: QTBUG-60026
Change-Id: Ieac9360b00044b6aedd0d3e1ad6e3b16d436f20f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-04-18 20:27:36 +00:00
Albert Astals Cid
6462f299ed Make platform menu tag/setTag not be pure virtual
Reasons:
 * Tag means nothing to the platform, tag is something
   the Qt side code will store and then restore, but it's meaningless
   for the platform, since it can be either the pointer to an
   action (qmenu.cpp) or an item count (qcombobox.cpp)
 * Since it's meaningless to the platform you don't know what
   to do when trying to implement a platform, this shows in how
   the field was being initialized, some initialized to this,
   some initialized to 0

On a followup commit we will remove the virtual tag but first
need to fix up other QPAs that don't live in the main repo

Change-Id: I15ac83f3bf7e4c741153d31ac761dbbe6f4b1b52
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-04-18 14:31:52 +00:00
Nico Vertriest
fc2f0fb390 Doc: add missing doc for parameters
qhstspolicy.cpp:105: warning: Undocumented parameter 'flags' in QHstsPolicy::QHstsPolicy()
qhstspolicy.cpp:105: warning: No such parameter 'includeSubDomains' in QHstsPolicy::QHstsPolicy()
qnetworkaccessmanager.cpp:732: warning: Undocumented parameter 'knownHosts' in QNetworkAccessManager::addStrictTransportSecurityHosts()

Change-Id: I24217d328df12febab30e19e2abd351e87007959
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-04-18 14:18:36 +00:00
Friedemann Kleint
8b62673d9f QGraphicsDropShadowEffect: Fix for high DPI scaling
Preserve the device pixel ratio.

Task-number: QTBUG-60026
Change-Id: Ie818c582fe2c7b11ceb347b39cfbf7ea49361021
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-04-18 13:08:43 +00:00
Leena Miettinen
84fb8c5ec9 Doc: Remove broken link to QWindowSystemInterface::registerTouchDevice()
Mention that it is a private function. Also mention using
QTest::createTouchDevice() for adding simulated touch screens
to autotests.

Task-number: QTBUG-26647
Change-Id: I08c12225768e76b1b9e3fc0fda00af86d44ca766
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Bo Thorsen <bo@vikingsoft.eu>
Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>
2017-04-18 12:57:45 +00:00
Edward Welbourne
df252fc205 Tidy up QDateTimeParser in assorted petty ways
A bit-field was necessarily equal to either zero or its (single-bit)
mask; so comparing to the mask was superfluous.

A local value set and then conditionally over-ridden could easily be
made const by using the condition in a ?: assignment.

A use of qMin() lent itself to turning into a simple conditional
assignment.

Change-Id: I541d98044b23b8c51e6169f617a5841ba8fffc55
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-18 12:56:33 +00:00
Edward Welbourne
e764f34583 QDateTimeParser: simpler return, clearer comment
skipToNextSection() returned via a local temp that served no purpose.
The accompanying comment didn't quite explain what it set out to.

Change-Id: I31581323df374653db9c2558a3bd63409aafb178
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-18 12:56:09 +00:00
Edward Welbourne
5bc814ac69 QDateTimeParser: simplify switch by exploiting fall-through
Several cases all fell together; their code tested away one of them;
so putting it last and falling through to it avoids the need to test.

Change-Id: I0bf555710604a56faa61b60bfe5484d5c5a1ee6b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-04-18 12:56:01 +00:00
Friedemann Kleint
db2de20c59 QGraphicsColorizeEffect: Fix for high DPI scaling
Preserve the device pixel ratio.

Task-number: QTBUG-60026
Change-Id: I91a1bda6ce4defd064ec7edfcea40ff192a9068f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-04-18 12:27:57 +00:00
Nico Vertriest
f26be29ea8 Doc: add missing specs about parameters
qopengltexture.cpp:3476: warning: Undocumented parameter 'layerCount' in
QOpenGLTexture::setCompressedData() and QOpenGLTexture::setData()
qimage.cpp:2127: warning: Undocumented parameter 'format' in QImage::reinterpretAsFormat()

Change-Id: I17feb2256a29f3bb722d2de3a83b390abff85a35
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-04-18 11:33:21 +00:00
Nico Vertriest
28ea26e574 Doc: rephrase parameter description to avoid qdoc error message
Change-Id: I79d446289b4450d2fcce097cf46d2cf7b6d969da
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-04-18 10:37:50 +00:00
Richard Moe Gustavsen
7243b7cbf2 qmacmime: modernize QMacPasteboardMimeTiff
Since QMacPasteboardMimeTiff was moved out of the cocoa
plugin and into platformsupport, we take the opportunity to
give the code some overhaul as well.

Change-Id: I7d5425d336ba41474698915008b2086e98ea49dc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-04-18 10:19:04 +00:00
Richard Moe Gustavsen
fb8ec15110 darwin: add tiff support to clipboard for all darwin platforms
This will add copy/paste/dnd support for QPixmap and QImage
to all darwin platforms (and not just macOS, as it is today).

Task-number: QTBUG-57428
Change-Id: Iefc876c0a347077322f195b55c49f2c1c4b4a34b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-04-18 10:18:54 +00:00
Marc Mutz
0a807c2ab6 QStringView: plaster API with Q_REQUIRED_RESULT
There's no reason to use it only on some functions with return values
and not others.

Change-Id: If50a669f49e9e2f71173dea94465a5de58a7783e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-18 09:43:39 +00:00
Marc Mutz
a21a9efacb QLatin1String: add chopped(), chop(), and truncate()
[ChangeLog][QtCore][QLatin1String] Added chopped(), chop(),
truncate().

Change-Id: I69b31aae560e94a120d7e8a36e06ea957ccd2003
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-18 09:43:32 +00:00
Marc Mutz
fc8cc2573c QStringView: add chopped(), chop(), and truncate()
Change-Id: I33925f5b2b3e0904f47f18f3cbab480d7f844734
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-18 09:43:26 +00:00
Marc Mutz
d176808eef QByteArray, QString, QStringRef: Add chopped()
We have two functions to get a substring without doing some
calculations involving size():

- mid(p):    mid(p, size() - p)
- right(n) : mid(size() - n, n)

(left does not involve size(), so isn't in that set). What was missing
was a name for

- f(n): mid(0, size() - n)

As an action, it's called chop(), so call the transformation version
chopped().

I made chopped(n), n < 0 or n > size(), undefined, because QString(Ref)
::left() is broken[1], while the QByteArray implementation is not. This
is the only way to get consistent behavior among the three classes.

I's also the correct thing to do.

[1] instead of returning the empty string for negative indexes, it
returns the whole string.

[ChangeLog][QtCore][QString/QStringRef/QByteArray] Added chopped(n), a
const version of chop(n).

Change-Id: I6c2c5b16e0060fa924ced5860f21f2d0f23bd023
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2017-04-18 09:43:18 +00:00
Tor Arne Vestbø
46976eea18 Add debug operators for font database structs for easier debugging
Change-Id: Ice1b27ff93de2d369dc6b66c72a64eb05da5639c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-18 09:40:41 +00:00
Liang Qi
18934bcb0c Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
	src/corelib/global/qglobal.cpp

Change-Id: I375fa4afa662fa411a15f212ebd5f2f0dffdba7f
2017-04-18 10:46:22 +02:00