Commit Graph

10195 Commits

Author SHA1 Message Date
Robin Burchell
2af04860f6 qtimezoneprivate_tz: Apply a cache over the top of timezone data
Constantly re-reading the timezone information only to be told the exact
same thing is wildly expensive, which can hurt in operations that cause
a lot of QTimeZone creation, for example, V4's DateObject - which
creates them a lot (in DaylightSavingTA).

This performance problem was identified when I noticed that a
QDateTime binding updated once per frame was causing >100% CPU usage
(on a desktop!) thanks to a QtQuickControls 1 Calendar (which has a
number of bindings to the date's properties like getMonth() and so
on).

The newly added tst_QTimeZone::systemTimeZone benchmark gets a ~90%
decrease in instruction count:

--- before
+++ after
 PASS   : tst_QTimeZone::systemTimeZone()
 RESULT : tst_QTimeZone::systemTimeZone():
-     0.024 msecs per iteration (total: 51, iterations: 2048)
+     0.0036 msecs per iteration (total: 59, iterations: 16384)

Also impacted (over in QDateTime) is
tst_QDateTime::setMSecsSinceEpochTz(). The results here are - on the
surface - less impressive (~0.17% drop), however, it isn't even
creating QTimeZone on a hot path to begin with, so a large drop would
have been a surprise.

Added several further benchmarks to cover non-system zones and
traverse transitions.

Done-With: Edward Welbourne <edward.welbourne@qt.io>
Task-number: QTBUG-75585
Change-Id: I044a84fc2d3a2dc965f63cd3a3299fc509750bf7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-20 16:58:09 +02:00
Timur Pocheptsov
05dd80871c tst_QMenu: make QSKIP message truthful
Since the test was refactored and QCursor::setPosition() replaced
with QTest::mouseMove(), the test is completely crippled on macOS,
since it relies on the parts in widget's code, ifdefed with condition
!Q_OS_OSX and commented as "Cocoa tracks popups". Yes it does,
but not for "fake" events generated by QTest. The original test
was introduced when fixing different problems on non-Apple platform(s)
anyway. Let's make QSKIP message saying the truth.

Task-number: QTBUG-63031
Change-Id: If54f195ccc0d4409cc2e7f4ae0b0fbf43989b286
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-03-18 10:02:29 +00:00
David Faure
97422abcfc QTreeView: don't call model.index(-1, 0) when using spanning items
drawTree() does
    QPoint hoverPos = d->viewport->mapFromGlobal(QCursor::pos());
    d->hoverBranch = d->itemDecorationAt(hoverPos);
and itemDecorationAt does
    const QModelIndex index = q->indexAt(pos);
which might very well be an invalid index.

Change-Id: I7db98871543bd7e1c57fcc475d2646757bf2bb42
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2020-03-16 10:44:26 +01:00
Shawn Rutledge
7d20f86958 Stabilize and rename tst_qmessagebox::expandDetails_QTBUG_32473
This has been flaky on OpenSuSE; if the stored geom.topLeft() is 0,0
it apparently means the window manager (probably kwin) didn't get around
to decorating and repositioning the dialog by the time
qWaitForWindowExposed() returns.  Because we check later to see whether
it moved, we need to be certain of its initial position.

Waiting for the extra "fleece" widget to be shown was based on the
theory that by the time the X server has processed messages related
to that new window, the WM should be done processing the consequences
of the resized dialog window.  But there's no such guarantee, so let's
try removing that.  On the other hand, removing the delay does open
us up to miss a regression (maybe the dialog gets moved after we have
checked that it didn't move).

Rename because we don't name autotests after bugs.

Amends 26ddb586ac

Task-number: QTBUG-32473
Change-Id: I6bbfe2b4baaee389db0d4112f0fec3b7cb9da554
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2020-03-12 18:46:44 +01:00
Timur Pocheptsov
c668fd940d Fix 'out of process' autotests
We are, arguably, not testing QProcess and its ability to start or finish,
we test QUdpSocket. If, for some reason (as we discovered on some
specific machines recently) the process does not start or does not produce
any output (canReadLine), we QSKIP instead of failing. Also, all those
QCOMPARE will bypass the part there we stop processes - so must be
RAII-protected.

Fixes: QTBUG-82717
Change-Id: Idfb0d4a483d753f336b3827875eeaf51c79270e2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-03-11 18:23:24 +00:00
Allan Sandfeld Jensen
bd3c82f8db Fix non-trivial soft-hyphen line breaks
The effect of the soft-hyphen needs to be updated once the final the
break point has been found.

This change cleans the logic by using two variables keeping track of
soft-hyphen at current evaluated position and at last confirmed break
point. Also adds tests for supression of soft-hyphens in the tight
WrapAnywhere case.

Fixes: QTBUG-35940
Fixes: QTBUG-44257
Change-Id: I7a89a8ef991b87691879bb7ce40cec4a3605fdd5
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-03-10 21:58:21 +01:00
Volker Hilsheimer
d678827f11 Un-blacklist QElapsedTimer::elapsed test
The test was fixed and metrics show no flaky failures anymore.

Task-number: QTBUG-58713
Change-Id: I50c0844db099f45bb5b7ca51a510bf0318554c44
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-04 10:04:54 +01:00
Thiago Macieira
ef92ac5636 QLibrary: stop setting errorString after resolve()
resolve() is technically thread-safe if the library has been loadaed. We
don't promise that, but it's there. More importantly, because
QLibraryPrivate is shared among QPluginLoader and QLibrary that point to
the same file, we can't thread-safely set the error string.

[ChangeLog][Important Behavior Changes] QLibrary::resolve() will no
longer set or clear the error string based on the success of finding the
symbol. The error string will reflect the result of loading the library.

Change-Id: I46bf1f65e8db46afbde5fffd15e1a4f4c2713c17
Reviewed-by: David Faure <david.faure@kdab.com>
2020-03-03 14:36:30 -08:00
Christian Ehrlicher
8c883c8da3 QDom: use correct precision when converting float/double values
d7cb21ac08 change the way a double is
converted which resulted in less precision.
Fix it by explictily setting the precision in QString::setNum()

Task-number: QTBUG-80068
Change-Id: I1fd9d00837155ceb707e84bfeb9deff03b5ab57e
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-03 22:08:18 +01:00
JiDe Zhang
4f370d36ec xcb: Fix logic for minimized state
When _NET_WM_STATE_HIDDEN is not contains in the _NET_WM_STATE
window property, the window should not be considered to be minimized

According to
https://specifications.freedesktop.org/wm-spec/1.3/ar01s05.html
_NET_WM_STATE_HIDDEN should be set by the Window Manager to indicate
that a window would not be visible on the screen if its desktop/viewport
were active and its coordinates were within the screen bounds. The
canonical example is that minimized windows should be in the
_NET_WM_STATE_HIDDEN state. Pagers and similar applications should use
_NET_WM_STATE_HIDDEN instead of WM_STATE to decide whether to display a
window in miniature representations of the windows on a desktop.

For mutter/GNOME Shell, without _NET_WM_STATE_HIDDEN, window manager
will not reply XCB_ICCCM_WM_STATE_ICONIC settings in WM_CHANGE_STATE
client message.

Task-number: QTBUG-76147
Task-number: QTBUG-76354
Task-number: QTBUG-68864
Done-With: Liang Qi <liang.qi@qt.io>
Change-Id: Ic9d26d963979b7f0ef4d1cf322c54ef8c40fa004
Reviewed-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-03-03 22:08:18 +01:00
Volker Hilsheimer
4a1de178c9 Try again to make QDeadlineTimer test robust against context switches
Instead of comparing to absolute values, compare the result from
QDeadlineTimer with the reference clock types from std::chrono. Pass
the test as long as we are within 10% of that reference.

In addition, handle the case where QTest::qSleep sleeps for more than
10% longer or shorter than what is requested, and if so, abort the
test.

Change-Id: If8b77aea55a8c5c53e96427b2fff2f78281d0f82
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-02-28 15:15:42 +01:00
Shawn Rutledge
7447e2b337 QTextMarkdownImporter: fix use after free; add fuzz-generated tests
It was possible to end up with a dangling pointer in m_listStack.
This is now avoided by using QPointer and doing nullptr checks before
accessing any QTextList pointer stored there.

We have 2 specimens of garbage that caused crashes before; now they don't.
But only fuzz20450 triggered the dangling pointer in the list stack.
The crash caused by fuzz20580 was fixed by updating md4c from upstream:
4b0fc03077

Change-Id: I8e1eca23b281256a03aea0f55e9ae20f1bdd2a38
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
2020-02-28 09:31:59 +01:00
Volker Hilsheimer
715468df40 Fix flaky QElapsedTimer::elapsed test case
Much of this test case was testing that the machine it runs on didn't
take more than an expected amount of time, which is an assumption that
won't hold in a virtual environment where the hypervisor might decide
to not allocate any CPU time to the machine at certain times.

Instead, take the samples that we want to compare with once, then
use them as reference for further comparisons.

Also, split the test in two, with the comparison operators and msecsTo
test moved into a separate test function.

Change-Id: I7db12b8e02552f4d63af933c1b0fee9d62b591eb
Fixes: QTBUG-58713
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-02-27 10:36:57 +01:00
Volker Hilsheimer
6324873543 Stabilize task255529_transformationAnchorMouseAndViewportMargins
This test doesn't test whether window activation works, so there is
no reason to fail the test if it doesn't. Instead, abort the test, so
that we can record it as a skipped test.

Change-Id: Ia44308ef17f110d40c6455d7ee85d90914face4f
Fixes: QTBUG-22455
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Levon Sargsyan <levon.sargsyan@qt.io>
2020-02-27 10:24:09 +01:00
Allan Sandfeld Jensen
25677ec4b2 Fix bounding box of zero-width entities in QFontEngineFT
Freetype can give us non empty bounds for zero-width characters,
this change just makes us skip metrics of characters already found to
not contribute to text advance. The coretext and windows
font-engines already uses the already calculated advance.

Change-Id: I82b3521a4fb92614be509be5982cd5ab9c1eb7de
Fixes: QTBUG-58854
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-02-27 08:59:08 +00:00
Volker Hilsheimer
8b9a025373 Make QDeadlineTimer test more resilient against VM starvation
Flaky fails in this test suggest that the VM on which the
test is executed does not get CPU resources allocated for enough time
to make this test pass. This change makes the test more resilient by
taking the measurements as quickly as possible.

In addition, use a sanity-check based on std::chrono APIs to abort the
test completely if we see that the clock has advanced too far to make
the following tests meaningful.

Change-Id: Ie6ac4ffb52f20e7774014f8222c9cd8f54d8a263
Fixes: QTBUG-64517
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-02-26 23:26:23 +01:00
Marc Mutz
e5acaa12e3 QObject: treat T* -> bool conversions as narrowing
Following wg21.link/LWG3228, it was found that a proper variant fix
requires that T* -> bool conversions be treated as narrowing
conversions in subclause wg21.link/dcl.init.lst. wg21.link/P1957R2 was
accepted in Prague 2020 as a DR and retroactively applies to older C++
standards.

Since we hard-code the algorithm of [dcl.init.lst], we can and must
add this manually.

[ChangeLog][QtCore][QObject] For the purposes of
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT, pointer
(incl. pointer-to-member) to bool conversions are now considered
narrowing. This matches the resolution of a defect report in C++
itself.

Change-Id: Ifa9a3724c9c8ccd3dd6614928dbbe37477591dc1
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2020-02-26 07:48:47 +00:00
Friedemann Kleint
3c4078ca02 tst_QSettings: Fix leaking registry key
On Windows, the test was leaking a registry key
HKEY_CURRENT_USER\Software\tst_QSettings_trailingWhitespace
Fix by using .ini-Format in the temporary directory created by the test.

Amends e66a878838.

Task-number: QTBUG-22461
Change-Id: If141a9e72e8faebc3fc46b94dab7b4b728a75292
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-02-25 20:16:20 +01:00
Liang Qi
4403ec3bc1 tests/xcb: fix tst_QWidget::updateWhileMinimized() on mutter/GNOME Shell
Task-number: QTBUG-68862
Change-Id: I6247867ae4ec126ab0549741f2d2d491a7f2e8a0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-02-25 18:58:17 +01:00
Christian Ehrlicher
875420f1c2 QAbstractItemView: Make sure to update the editor geometries
QAbstractItemView::setIndexWidget() does not trigger a relayouting when
a new widget is set. This results in a wrong editor geometry under some
circumstances. Fix it by triggering a delayed relayout.

Fixes: QTBUG-81763
Change-Id: I75d0e19bd5e56d63effe4990d782d202fb39e3e6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-02-23 10:48:53 +01:00
Timur Pocheptsov
c58ee54a70 tst_qtcpsocket::bind - amend the recent fix
0. The recent patch fixed the case when we can suddenly (meaning from
a particular version of Darwin) bind on a port number 1. Unfortunately,
it's not the case for IPv4 and while fixing one test case, the patch broke
another - so this patch addresses this.
1. Unfortunately, binding on a fixed port 1 on macOS made the test flaky
- we run this 'bind' several times and sometimes OS thinks port is already
bound (because of the previous test case) - closing the connection seems
to fix this problem (thus this patch do this also).
2. As a bonus a proper resource management added (aka RAII) where we would
previously leak a socket in case some QCOMPARE failed.

Fixes: QTBUG-81905
Change-Id: I90c128a332903bb44ab37de4775ca00d390dc162
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-02-22 03:36:54 +01:00
Volker Hilsheimer
962a3d8a98 Stabilize QFileSystemModel::dirsBeforeFiles test
Make the test operate in its own temporary directory, so that entries
left behind by other test functions don't impact this test.

Also, call QFileSystemModel::sort explicitly; it would otherwise only
be done once through a single-shot timer, and the test processes events
until the model is populated, which might not process that delayed
sorting. Since dirsBeforeFiles tests the sorting algorithm and not
the sorting logic, best to do this explicitly.

In case of sort failure, print diagnostics.

Done-with: Friedemann Kleint <Friedemann.Kleint@qt.io>
Fixes: QTBUG-75452
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 4e796e0b0d)
Change-Id: I144b68a17280a38cc7d6daf7ec343eea4453623d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-02-22 02:52:44 +01:00
Volker Hilsheimer
1ce3585305 Detect double timer during single timeout in registerTimer test, and skip
We observe this happening on macOS in the CI system, and it might happen
if a VM doesn't get CPU cycles for long enough time so that two timers
time out. Then event processing will process two timer events, and we
overwrite the timerIdFromEvent with the second event.

Instead, skip the test when this happens.

This is an ammendment to 5c520f4b0a

Fixes: QTBUG-71751
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 67491e2df5)
Change-Id: I30eef8cfc94988e6cad500dd5e6722488c2985be
2020-02-22 02:52:36 +01:00
Volker Hilsheimer
c3951470ca Discover the conditions under which registerTimer is flaky, and skip
On macOS, the registerTimer test case fails frequently, and blocks
valid integrations. With this change we try to detect the condition
and skip the test.

Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5c520f4b0a)
Change-Id: I97644b5b4654b4c96fbc99858bbf191e6edb5977
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-02-22 02:52:24 +01:00
Nicolas Guichard
f9086ebd01 QShaderGenerator: Allow more expressions in input nodes
Currently QShaderGenerator will crash when encountering some expressions
in input nodes.

For example, this node prototype would make it crash:
"VERTEX_COLOR": {
  "outputs": ["color", "alpha"],
  "rules": [
    "headerSnippets": ["in vec4 vertexColor;"],
    "substitution": "vec3 $color = vertexColor.rgb;
                     float $alpha = vertexColor.a;"
  ]
}

Change-Id: I37abb8099d376843a4cb13228140467dc1b8f60c
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2020-02-20 08:00:20 +01:00
Nicolas Guichard
39994e0705 QShaderGenerator: Don't crash when a node has multiple outputs
It was already possible to declare a node prototype with multiple
outputs, but trying to assign to all those outputs was not possible and
instead resulted in a crash.

It is now possible to declare nodes like this without crashing:
"SEPERATE_XYZ": {
  "inputs": ["vector"],
  "outputs": ["x", "y", "z"],
  "rules": [
    {
        "substitution": "float $x = $vector.x;
                         float $y = $vector.y;
                         float $z = $vector.z;"
    }
  ]
}

Change-Id: I748e77e84c9120dc688c573eee33dc13c6bfbace
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2020-02-20 08:00:14 +01:00
Nicolas Guichard
7981dbfaf3 QShaderGraph: don't generate statements with undefined inputs
This fixes the shader generation for graphs like this one:

                 Function0 ------> Output0
            (with unbound input)

   Input ------> Function1 ------> Output1

With those graphs, createStatements will not return any statement for
nodes Function0 and Output0.

Change-Id: Iec32aa51623e176b03ae23e580f06d14df80a194
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2020-02-19 17:39:51 +01:00
Nicolas Guichard
49dbe760e4 Fix QShaderGenerator crashing when a node port name prefixed another one
QShaderGenerator didn't handle substitutions like
`vec4 $color = mix($color1, $color2, $fac);`

Note that `$color` is a prefix to `$color1` and `$color2`. For the
substitution `QByteArray::replace` was used so if `$color` was handled
first and replaced by `v1`, `$color1` and `$color2` were never correctly
replaced and instead became `v11` and `v12` which caused a crash later
on.

Change-Id: Idaf800fdac468f33c323eb722701da5f8eb918d6
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2020-02-19 08:47:58 +01:00
Nicolas Guichard
27d35a3ed0 QShaderGraph: Fix statement creation for graphs with dangling branches
For graphs like this one:

Input ----> Function1 ----> Output
      \
       ---> Function2
         (unbound output)

We would have generated only 2 statements, for Function1 and Output.

This change fixes this by treating Function2 like an output.
Therefore it generates 4 statements: Input, Function1, Output and
Function2.

Change-Id: Iaada40b9b949d771806dd47efad4f7ef2a775b48
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2020-02-17 14:35:56 +01:00
Edward Welbourne
1c0b69eac5 Only read the first BOM as a BOM; the rest are ZWNBS !
QUtf32::convertToUnicode() was forgetting to set headerdone when it
dealt with the header (for contrast, Utf16::convertToUnicode() does).

Fixes: QTBUG-62011
Change-Id: Ia254782ce0967a6cf9ce0e81eb06d41521150eed
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-02-14 19:13:37 +01:00
Thiago Macieira
210fd52e0d Autotest: adapt to certain OSes always allowing binding to low ports
Apple changed on macOS 10.14 (Mojave). Windows has always allowed.

Fixes: QTBUG-81905
Change-Id: I572733186b73423b89e5fffd15f12fee3f03c055
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-02-13 15:11:21 -08:00
Thiago Macieira
5ff37f13ee QTcpSocket::bind: fix issue found by BLACKLIST
The comment in QNativeSocketEnginePrivate::fetchConnectionParameters()
talked about IPv6 v4-mapped addresses. However, toIPv4Address also
converts the unspecified address (::), which resulted in QAbstractSocket
saying that it had bound to QHostAddress::Any instead of
QHostAddress::AnyV6

Change-Id: I572733186b73423b89e5fffd15f138579c5c0c50
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-02-13 15:11:11 -08:00
Marc Mutz
6b9a1824a4 Extend tst_qstringapisymmetry for member compare()
There were a few surprises:

- QByteArray::compare() are missing noexcept (will add)
- ibid., called with non-ascii content and CaseInsensitive fails
  (this was discussed on the ML, with tentative agreement that
  it's a feature, not a bug; waiting for QUtf8String(View) for a
  fix, then).
- As was the case when we did this exercise with the relational
  operators, QString(Ref)/QChar is not noexcept (will fix)

These have been QEXPECT_FAIL'ed.

Not much of the cartesian product is implemented at all, yet.  These
have been #ifdef'ed with NOT_YET_IMPLEMENTED to see what's still
missing.

Change-Id: I7d9b21e292b98f980aacdc6248e88188f7472ba2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-02-09 17:43:20 +00:00
Wang Chuan
75285b64ad QComboBox: send font change event to popup menu when font changed
The font change in QComboBox might cause incorrect appearance of popup
menu since it doesn't notify popup menu to relayout itself

Fixes the issue by send font change event to the item view of popup
menu when received a font change event in QComboBox

Fixes: QTBUG-75846
Change-Id: I4821015cca95a7e233a22262596a6fbf27f10aef
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-02-07 09:18:47 +08:00
Friedemann Kleint
e9efd96e62 uic/Python: Add imports for Q(Date)Time, QKeySequence
Those types are used as properties of Q(Date)TimeEdit,
QKeySequenceEdit.

Fixes: PYSIDE-1215
Change-Id: I8b9ffebb8229fff447aa7dd6bee6e037d708333c
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2020-02-06 17:46:21 +01:00
Morten Johan Sørvig
d29aaf598a tst_qnetworkreply: Print proxy warning to stderr instead of stdout
This way we produce valid xml also for the no-proxy case.

Change-Id: I5a277255d22c3814fe463c0cd013c04ddc6ad919
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-02-05 15:01:10 +00:00
VaL Doroshchuk
9ecc595d71 widgets: Don't create winId when the widget is being destroyed
When QWidget is being destroyed, its winId is cleared, and
a QEvent::WinIdChange is sent. If a listener of this event
reacted by calling winId() again, we might crash.

A crash can be observed when this child widget is destroyed in dtor of its parent.
E.g. here is a hierarchy of widgets:
1:QWidget
 2:QObject
 3:QWidget
  4:QWidget

If a listener subscribed for WinIdChange events from (4),
and there is a connection to destroy (4) when (2) is destroyed.

This will lead to infinite loop:

1. QWidget::~QWidget
2. QWidget::destroy
3. QWidgetPrivate::setWinId(0)
4. QCoreApplication::sendEvent(q, QEvent::WinIdChange);
5. eventFilter
6. QWidget::winId
7. QWidgetPrivate::createWinId (this=0x555555957600) at kernel/qwidget.cpp:2380
8. QWidgetPrivate::createWinId (this=0x55555596b040) at kernel/qwidget.cpp:2387
9. QWidget::create (this=0x5555558f2010, window=0, initializeWindow=true, destroyOldWindow=true) at kernel/qwidget.cpp:1163
10. QWidgetPrivate::createWinId (this=0x55555596b040) at kernel/qwidget.cpp:2387
11. QWidget::create (this=0x5555558f2010, window=0, initializeWindow=true, destroyOldWindow=true) at kernel/qwidget.cpp:1163
12. QWidgetPrivate::createWinId (this=0x55555596b040) at kernel/qwidget.cpp:2387

Fixes: QTBUG-81849
Change-Id: Ib4c33ac97d9a79c701431ae107bddfb22720ba0d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-02-05 11:05:24 +01:00
Friedemann Kleint
6baed76654 uic/Python: Set form object name correctly
Add missing "not" for the isEmpty() check.

Fixes: PYSIDE-1210
Change-Id: I3798d483df9d077300ff69dc5d3a8d08812f534e
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2020-02-05 10:37:02 +01:00
Edward Welbourne
41b2c477b7 Take care of NULL data from QStringView in QCollator
Back-ends need to catch NULL data so as not to call system APIs with
invalid pointers.

[ChangeLog][QtCore][QCollator] Fixed a regression introduced in 5.14.0
that caused QCollator not to operate with default-constructed QStrings
and print a warning on Windows.

Fixes: QTBUG-81673
Change-Id: I2eafe1e188b436afcca3cf2ecdf98bba707c44c9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-02-05 10:23:43 +01:00
Edward Welbourne
71fa90a37c Enable system locale to skip digit-grouping if configured to do so
On macOS it's possible to configure the system locale to not do digit
grouping (separating "thousands", in most western locales); it then
returns an empty string when asked for the grouping character, which
QLocale's system-configuration then ignored, falling back on using the
base UI locale's grouping separator. This could lead to the same
separator being used for decimal and grouping, which should never
happen, least of all when configured to not group at all.

In order to notice when this happens, query() must take care to return
an empty QString (as a QVariant, which is then non-null) when it *has*
a value for the locale property, and that value is empty, as opposed
to a null QVariant when it doesn't find a configured value. The caller
can then distinguish the two cases.

Furthermore, the group and decimal separators need to be distinct, so
we need to take care to avoid cases where the system overrides one
with what the CLDR has given for the other and doesn't over-ride that
other.

Only presently implemented for macOS and MS-Win, since the (other)
Unix implementation of the system locale returns single QChar values
for the numeric tokens - see QTBUG-69324, QTBUG-81053.

Fixes: QTBUG-80459
Change-Id: Ic3fbb0fb86e974604a60781378b09abc13bab15d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-02-03 15:34:02 +01:00
Giuseppe D'Angelo
2d265dce58 Markdown importer: properly set hyperlinks
The "title" in markdown is the tooltip, not the name attribute of
a link. Also, tell the char format that it's an anchor.

Change-Id: I2978848ec6705fe16376d6fe17f31007cce4b801
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-02-03 14:58:06 +01:00
Edward Welbourne
90fbd086c6 Pass QDate and QTime by value in manual calendar test code
They're value types, pass them as such.

Change-Id: I78e93165d431ac4eff145f47a9385d6bf5cd0c15
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-01-31 14:02:53 +01:00
Morten Johan Sørvig
17affdfbcb Blacklist failing tests on macOS 10.14
These tests fail locally, and have been reported to
fail on the CI system.

Change-Id: Ia76bb15c288af4171ebe47b3c30f3651a63df3f2
Task-number: QTBUG-75786
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-01-30 13:47:27 +00:00
Giuseppe D'Angelo
78edc18057 QGraphicsProxyWidget: fix handling of proxy focus
If a widget inside a QGPW has a proxy focus, the code would keep
sending focus in events to the proxy even if the proxy was already
focused. Amend the check in place to prevent this from happening.

Change-Id: Id28d3bfe4f396da5c9477df713441ca7d506662f
Fixes: QTBUG-51856
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-01-29 19:57:02 +01:00
Liang Qi
54b1f1d199 Merge remote-tracking branch 'origin/5.14.1' into 5.14
Conflicts:
	mkspecs/features/create_cmake.prf

Done-With: Artem Pisarenko <artem.k.pisarenko@gmail.com>
Change-Id: I2ecb9fdca06fe687be8ab3457a58dd81e5e81c4c
2020-01-28 09:16:11 +01:00
Andy Shaw
bb42b7d8b2 Make sure the focus is passed on correctly when back-tabbing
When the tested widget has a focus proxy, then we should check if the
current focus widget is not the same as that focus proxy before setting
it to be the widget that gets focus. This ensures that when back-tabbing
from a widget like QDoubleSpinBox that it will not get stuck inside that
widget and will back-tab to the next correct one.

Fixes: QTBUG-81097
Change-Id: I3f689c7715da7f3ce8c3d2f616041528f5778a2f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-01-25 08:10:32 +01:00
Giuseppe D'Angelo
4d8a515a23 QXmlStreamReader: early return in case of malformed attributes
There's no point at keep raising errors after encountering the
first malformed attribute.

Change-Id: Idb37e577ea96c3bd850b3caf008fe3ecd57dd32e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-01-23 19:44:09 +01:00
Tor Arne Vestbø
92918e567a Flatten version-specific blacklisting on macOS to all macOS versions
We don't know which versions these blacklistings actually apply on
unless we actually get macOS 10.14 and 10.15 into the CI and running
tests, so let's start with that, and then granularize the blacklists
after that.

Task-number: QTBUG-75786
Change-Id: Id79642afa50cb20efa2cd209286b6933918d3a4a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-22 17:58:31 +01:00
Tor Arne Vestbø
c31c5d08d8 Blacklist tstPauseAnimation::noTimerUpdates on macOS
Task-number: QTBUG-75786
Change-Id: I89d81a9d0f5f301f325044dee2395d441c0d5970
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-22 17:26:23 +01:00
Tor Arne Vestbø
f047c44e71 Extend blacklisting for a few tests to include all macOS versions
Task-number: QTBUG-75786
Change-Id: I06867de99a19f9e46ac0eeea10a7365a30c49c6d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-22 17:26:23 +01:00