Commit Graph

10500 Commits

Author SHA1 Message Date
Andy Shaw
24b8b2cb6c Stylesheet: Handle tabs with elide mode set correctly
In order for SE_TabBarTabText to correctly calculate the space available
for the text it needs to get the rectangle of the tab directly instead
of relying on the option's rectangle as this may have been modified
before this point. Therefore we introduce QStyleOptionTabV4 to be able
to store the index as part of the option so it can be queried directly.

[ChangeLog][QtWidgets] Added QStyleOptionTabV4 as a subclass of
QStyleOptionTab so that the tab's index information can be obtained.

Fixes: QTBUG-50637
Change-Id: If705f5069fdd14eeccf06bc63dba4e8d2e704359
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2020-01-06 09:37:34 +01:00
Qt Forward Merge Bot
3a010f72b8 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	src/corelib/kernel/qvariant.h

Change-Id: I8f3873e74b9795ac889e7c7ec5de2619bca92160
2020-01-06 07:20:18 +00:00
Robert Loehning
1f87fb359f Fuzzing: Allow linking to other fuzzing engines
oss-fuzz sets the environment variable LIB_FUZZING_ENGINE
to link with AFL or libFuzzer. If this variable is not set,
libFuzzer will be used as before, only that the right qmake
variable will be used for doing so.

Change-Id: If9fe7739a8d2d4a76f4633a75cad3d2e935f3b61
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2020-01-03 18:05:08 +01:00
Friedemann Kleint
3a9251e869 Fix parameter of QJsonObject::const_iterator operator-(const_iterator)
It used to be "iterator", causing a qdoc warning:

src/corelib/serialization/qjsonobject.cpp:1405: (qdoc) warning: clang found diagnostics parsing \fn int QJsonObject::const_iterator::operator-(const_iterator other) const
    error: out-of-line definition of 'operator-' does not match any declaration in 'QJsonObject::const_iterator'

Add a small test.

Change-Id: Id65effffa720ed1e0fb0ee6937dcc4298f3ef363
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-01-03 14:59:20 +01:00
Christian Ehrlicher
21987679de QTime: fix tests with Qt6
In Qt6 there is a behavior change with extra stuff after the seconds -
it's no longer allowed and will result in an invalid QTime.
This was introduced with bf65c27789 but
the autotests were not adjusted for it.

Change-Id: Ia78f4f2a8019e46d9d0e8e8b8918a3ab2d4638e2
Reviewed-by: Liang Qi <liang.qi@qt.io>
2020-01-03 14:55:48 +01:00
Fabian Kosmale
8669b8e60f QVariant: Prefer direct conversion to QVariant{List,Map,Hash}
If a type has both a converter to QVariantList and to
QSequentialIterableImpl registered, we would have chosen the
QSequentialIterableImpl version. In the case of types like QJSValue,
this is more costly. With this change  we therefore uses the direct
conversion if it has been registered.

The same applies to QAssociativeIterableImpl and
QVariantHash/QVariantMap.

Change-Id: I9c0b5068efe4bfbc5e0598a200e6db59201e9974
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2020-01-03 10:59:37 +01:00
Giuseppe D'Angelo
2ced01cbdd QIdentityProxyModel: implement moveRows / moveColumns
It makes sense for it (instead of triggering the QAbstractItemModel
base class implementation, which doesn't do anything). Safe to override
virtuals in this case -- code calling the old version could not do
anything useful, so at least new code gets those functions properly
implemented for free.

Change-Id: Iefe1ff25e15d877435e93ab28289ad2579616f72
Task-number: QTBUG-48076
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: David Faure <david.faure@kdab.com>
2020-01-02 17:48:07 +01:00
Christian Ehrlicher
cf033b32b5 QDateTime: fix tests with Qt6
In Qt6 there is a behavior change with extra stuff after the seconds -
it's no longer allowed and will result in an invalid QDateTime.
This was introduced with bf65c27789 but
the autotests were not adjusted for it.

Change-Id: Iee6a9a7ac6cbb2754a68e082bb7074d17fac9d9c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-01-02 13:07:05 +01:00
Ulf Hermann
a1f4321bbb QTextDocument: Give fontFamily() precedence over fontFamilies()
If the singular fontFamily() is given, then this is obviously the one to
be preferred over any plural fontFamilies(). Make sure it always ends up
first in the list of emitted font families.

Change-Id: I1e3b1ba29721c8298b1a0d4a1e1da49ba5b4e7ac
Fixes: QTBUG-80475
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-01-02 10:30:13 +01:00
Qt Forward Merge Bot
51df9bd251 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I7b6e6c687d8d60b4a54e6b9dada025ef66c53d96
2020-01-02 01:00:07 +01:00
Alexandra Cherdantseva
a63969081c wasm: support all cursor shapes
Every Qt::CursorShape is supported.
Tested in Chrome, Firefox and Safari.

Change-Id: I38c9024dba4af70af789ac84ad7e38f749c847d7
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2019-12-30 14:30:22 +03:00
Tuomas Heimonen
27d1391280 QLocale: Support Indian number formatting
When QLocale::Country is set to QLocale::India numbers are written so that
after first three from the right and then after every second will be comma.
E.g. 10000000 is written as 1,00,00,000

Task-number: QTBUG-24301
Change-Id: Ic06241c127b0af1824104f94f7e2ce6e2058a070
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Teemu Holappa <teemu.holappa@qt.io>
2019-12-30 13:04:23 +02:00
Qt Forward Merge Bot
4054c0d6ed Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	.qmake.conf
	src/plugins/platforms/xcb/qxcbscreen.cpp
	src/widgets/accessible/qaccessiblewidget.cpp

Change-Id: Ib3138e61ba7981610940509a7ff02ba2dd281bf0
2019-12-27 09:29:30 +01:00
Giuseppe D'Angelo
a2ddd96ac8 Introduce QString(View)::isValidUtf16
QString(View)s can be built or manipulated in ways that make them
contain/refer to improperly encoded UTF-16 data. Problem is,
we don't have public APIs to check whether a string contains
valid UTF-16. This knowledge is precious if the string is to be fed in
algorithms, regular expressions, etc. that expect validated input
(e.g. QRegularExpression can be faster if it can assume valid UTF-16,
otherwise it has to employ extra checks).

Add a function that does the validation.

[ChangeLog][QtCore][QStringView] Added QStringView::isValidUtf16.

[ChangeLog][QtCore][QString] Added QString::isValidUtf16.

Change-Id: Idd699183f6ec08013046c76c6a5a7c524b6c6fbc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-20 11:13:22 +01:00
Jordi Pujol Foyo
556712f511 Allow hiding tabs in QTabWidget / QTabBar
Add 2 methods to set/ask if a tab is hidden.

[ChangeLog][QtWidgets][QTabWidget/QTabBar] Tabs can now be
hidden with setTabVisible

Fixes: QTBUG-63038
Change-Id: I7b07ecdb485e1f6c085d03515ef2b73baae889de
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2019-12-20 09:41:09 +00:00
Milla Pohjanheimo
3ea2c18faa Add binary compatibility files for qtbase 5.14 branch
BC files built against 5.14.0 added.

Change-Id: Ifaf79d8ebb057e3bcccd6134868890b3fccf8720
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-12-20 10:41:11 +02:00
Jordi Pujol Foyo
9d6b4d1142 New features for QPdfWriter
Added new API setDocumentXmpMetadata/documentXmpMetadata and
addFileAttachment

[ChangeLog][QtGui][QPdfWriter] New API to provide external document XMP
metadata and attach files to PDF.

Fixes: QTBUG-78651
Fixes: QTBUG-78764
Change-Id: Ic0b37e8d12899f907001db469080594c14c87655
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-12-19 21:23:43 +01:00
Allan Sandfeld Jensen
6227a0d2e2 Add test for invertPixels on indexed formats
It wasn't tested and behaves in a very particular way.

Change-Id: I60a31681e5b221cf9a86df77e410a76ee4c10864
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-12-19 16:16:50 +01:00
Peter Varga
a132e02540 Fix QAccessibleWidget::focusChild() to return focused descendant
This method should not ignore accessibility objects without
corresponding widget. The widget may have parts with their own
QAccessibilityInterface and these can be also focused.

VoiceOver ignores them if they are not returned by focusChild().

QAccessibleTabBar::focusChild() has been implemented to demonstrate
the concept and make tab titles of QTabBar readable by VoiceOver.

Task-number: QTBUG-78284
Change-Id: Id7c62d86154bbd5d47d6bbee8cb7d05268c2e151
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-12-19 08:39:10 +01:00
Christian Ehrlicher
4e04132264 QStringListModel: fix moveRows()
QStringListMode::moveRows() had an issue when the destination was before
the source row.

Change-Id: Icf64e5b4cdd6a39faf3ba4ccc3883196b247ccbd
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: David Faure <david.faure@kdab.com>
2019-12-16 22:12:52 +01:00
Christian Ehrlicher
be9398c8d4 QListModel: fix moveRows()
QListModel::moveRows() had an issue when the destination was before the
source row.

Change-Id: I4ce8b425451f2f53c7eb3b211e9590753dec618a
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: David Faure <david.faure@kdab.com>
2019-12-16 18:44:46 +01:00
Liang Qi
1d00f52fd3 Merge "Merge remote-tracking branch 'origin/5.14' into 5.15" 2019-12-16 12:58:50 +01:00
Allan Sandfeld Jensen
a1a3a7cd8a Avoid crashing when constructing color-space from invalid enum
This is not to be taken as supported and is still undefined behavior,
but I prefer we do not crash.

Change-Id: Icf4f3398bfd57fcbdc611a5a821a1f2de0838330
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-12-16 10:38:17 +00:00
Liang Qi
ee71a9ba81 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	src/network/ssl/qsslsocket.cpp
	src/widgets/kernel/qapplication.cpp

Change-Id: Ib7421cc2df59d0969f89b3fbd65a17ea76ffef3b
2019-12-16 07:05:19 +01:00
Giuseppe D'Angelo
5b4b437b30 WebGradients: redo implementation
The previous implementation was *extremely* expensive. It
relied on loading a binary JSON file from resources (which
involved decompressing it), then extracting information out of
it to build a gradient.  Already-loaded gradients were kept in
a local cache, which had to be mutex protected.

Instead, this patch extends the gradient generator to build
static arrays filled with the web gradient data, sitting in
.rodata.

These arrays are used when building QGradient objects with a
web gradient. No explicit mutex protection is necessary, since
accesses will just read from the arrays.

As benefits, this patch removes:

* the binary json representation from QtGui's resources (~4KB
compressed, ~50KB uncompressed)
* the overhead of reading from the JSON for each used web
gradient;
* the startup costs of registering the webgradients in the
resources;
* all the overhead of mutex locking when building such
gradients;
* all the runtime memory allocations to load, parse and cache
the web gradients (including the memory + CPU spike on first
load due to the uncompression of the JSON data, as well as a
couple of deep copies).

Change-Id: If5c3d704430df76ce8faf55ee75ebd4639ba09c4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-12-14 11:31:46 +01:00
Christian Ehrlicher
0edd2e39ad Let QItemSelectionModel::columnIntersectsSelection honor the parent
QItemSelectionModel::columnIntersectsSelection() should honor the parent
according to the docs. For rowIntersectsSelection() this was fixed a
long time ago but columnIntersectsSelection() was forgotten.

Sync the both functions and use range-based for loops as a drive-by.

Fixes: QTBUG-80644
Change-Id: Iaf08f85e2225204d1e6564fa4bb0bc826352ed53
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-12-14 08:46:37 +01:00
Christian Ehrlicher
4522b17159 QStandardItemModel: do not reset persisten index in setItem()
When an existing item is replaced with a new one in
QStandardItemModel::setItem() then the persitent index is invalidated
which leads to some unexpected behaviors (like e.g the header size and
resize mode are reset).
Therefore we have to make sure that the invalidation does not happen.
This can be achieved by delaying the call to QStandardItem::setModel()
for the old item until the new is properly added. After this, the old
item no longer gets a valid QModelIndex from the model and therefore
can't invalidate the persistent index anymore.

Fixes: QTBUG-13605
Fixes: QTBUG-73000
Fixes: QTBUG-80586
Change-Id: I4e45e6feb81b7287c0859f638d7ab1a576fc2f0f
Reviewed-by: David Faure <david.faure@kdab.com>
2019-12-14 08:46:05 +01:00
Mårten Nordheim
d98a1ef902 Add QMap::insert(const QMap &map)
As opposed to unite(), this inserts one map into the other
without duplicating elements.

Task-number: QTBUG-35544
Change-Id: Ie8ab350b29148851a3176cef1007e8a4ca82c273
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-12-12 15:25:30 +01:00
Milian Wolff
656d6f2a9b Support Q_GADGET QMetaObject super class hierarchies across templates
This patch fixes the QMetaObject::superClass hierarchy for Q_GADGETs
that inherit from a template which in turn inherits another Q_GADGET.
One common scenario where this is applied is for the CRTP. Without this
patch, moc would stop at the template and then sets the superClass
QMetaObject to a nullptr. For QObjects this works, since there moc knows
that every child must by definition inherit QObject. In order to support
this for Q_GADGETs too, we defer the judgment about the availability
of a staticMetaObject in the base class to compile time through the
existing QtPrivate::MetaObjectForType<Base>::value() helper.

[ChangeLog][QtCore][moc] Moc now correctly sets a non-null
QMetaObject::superClass for Q_GADGETs that inherit from a template which
inherits another Q_GADGET.

Change-Id: I103b5efd74ed24172dffce477ca2ed6d0f374d44
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2019-12-12 13:02:52 +01:00
Qt Forward Merge Bot
11d7788c18 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I69238f23882deebeaad46e4fdcf899ab22cc2b8f
2019-12-12 01:01:04 +01:00
Fabian Kosmale
c15d6a155c QVariant: introduce ShouldDeleteVariantData flag
This flag is used in QSequentialIterable and QAssociativeIterable to indicate
that the data pointer in VariantData should be deleted after the variant has
been constructed.

The use case for this is
https://codereview.qt-project.org/c/qt/qtdeclarative/+/284151, where we have
a proxy iterator and cannot easily return a pointer to already owned data, as
it is hard to manage its lifetime in the iterator. In contrast, it is clear
that we can release the memory in the QSequentialIterable functions, as it has
already been copied into the QVariant there.

Change-Id: I2b33497d991cd4f752153e0ebda767b82e4bb851
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2019-12-11 20:12:23 +01:00
Thiago Macieira
0d4dea728f MIME: Make the internal database direct content, not a Qt resource
This saves us from having to bootstrap rcc in regular (non-cross)
compilations, as it can now link to QtCore. Actually un-bootstrapping
rcc is left as an exercise for the reader.

This commit discovered that MSVC cannot handle constexpr arrays bigger
than 256 kB, at which point it simply starts claiming that the constant
expressions using it are not constexpr. ICC has a similar problem at
64 kB, but it tells you why ("note: type "const unsigned char [65537]"
too large for constant-expression evaluation").

Note also that this requires gzip or zstd to be in PATH for compression
to happen. RCC linked to zlib, which is always present due to the
bundled copy. gzip's presence is not likely to be a problem on Unix
systems, but could be for Windows users, especially MSVC ones. If gzip
is not present, QtCore's size will increase by about 1910 kB of
read-only (sharable) data.

Change-Id: I2b1955a995ad40f3b89afffd15a3e65a94670242
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-12-10 15:56:09 -08:00
Edward Welbourne
bf65c27789 Fix more mis-handling of spaces in ISO date format strings
ISO date format doesn't allow spaces within a date, although 3339 does
allow a space to replace the T between date and time. Sixteen tests
added to check this all failed. So clean up the handling of spaces in
the parsing of ISO date-time strings.

[ChangeLog][QtCore][QDateTime] ISO 8601: parsing of dates now requires
a punctuator as separator (it previously allowed any non-digit;
officially only a dash should be allowed) and parsing of date-times no
longer tolerates spaces in the numeric fields: an internal space is
only allowed in an ISO 8601 date-time as replacement for the T between
date and time.

Change-Id: I24d110e71d416ecef74e196d5ee270b59d1bd813
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-10 17:26:02 +01:00
Liang Qi
979b9335e5 Merge "Merge remote-tracking branch 'origin/5.14' into 5.15" 2019-12-10 17:53:06 +02:00
Liang Qi
90210d5d9c Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	tests/auto/network/kernel/qnetworkinterface/BLACKLIST

Change-Id: I1e8866c63b54bcd95fc2a044276ee15b7f60e79a
2019-12-10 13:51:40 +02:00
Timur Pocheptsov
30e32870a0 QCocoaEventDispatcher: make 'interrupt' work
even if we are currently inside processEvents (apparently called manually
and not from QEventLoop::exec()). A carefully crafted application
(see, for example, the linked QTBUG or even updated auto-test)
can trigger itself into failing to exit the current (potentially nested)
event loop. We can harden our Cocoa event dispatcher to detect
such condition and properly propagate 'interrupt' to where it'll
do its job, indeed, interrupting the real event loop (aka [NSApp run]).
This mainly means we have to undo what bool blocker would erroneously do.
Also, long live (as people love to say these days) to another tricky
(somewhat) auto-test (surely, it's not flaky!).

Fixes: QTBUG-79477
Change-Id: I794f0cda23e24d36be67f2bb63d52b74be057c31
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-12-10 11:33:26 +01:00
Eirik Aavitsland
95689c645f Make inputmask 'X' mask character require non-blank input
The implementation for the X mask would accept any printable
character. Since that includes the blank character, there was no
difference in behavior between the requiring X and optional x: both
would allow the input to be unset, i.e. blank.

This change should be seen in conjunction with the doc improvement
da0af1e.

[ChangeLog][QtWidgets][QLineEdit] Inputmask X character now requires non-blank input.

Fixes: QTBUG-76320
Change-Id: I3e0363e9be5c13373a157cce69c99379615b5829
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-12-10 09:36:24 +01:00
Christian Ehrlicher
5231c26a82 tst_QSqlQuery: fix some tests
Fix some tests in tst_QSqlQuery:
 - make sure to use QSql::HighPrecision in tst_QSqlQuery::precision()
   (needed for psql)
 - remove outdated stuff for mysql 3.x
 - psql_bindWithDoubleColonCastOperator: the placeholder are stored as
   named placeholders in psql
 - avoid some useless old-style casts

Change-Id: I54d29a7e24f17d853cce6baa09a67d9278098810
Reviewed-by: Robert Szefner <robertsz27@interia.pl>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2019-12-10 06:27:09 +01:00
Tor Arne Vestbø
c3bd5ffdc8 Don't wrap feature detection macros with QT_HAS_FOO() variants
Using wrappers for these macros is problematic when for example passing the
-frewrite-includes flag to preprocess sources before shipping off to distcc
or Icecream. It will also start producing warnings when compilers implement
http://eel.is/c++draft/cpp.cond#7.sentence-2. See for example
https://reviews.llvm.org/D49091

Both https://clang.llvm.org/docs/LanguageExtensions.html and the SD-6 document at
https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
recommend defining '__has_foo(x) 0' as a fallback for compilers without the
macros, so that's what we go for.

Change-Id: I0298cd3b4a6ff6618821e34642a5ddd6728be767
Reviewed-by: Alex Richardson <arichardson.kde@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-10 00:48:07 +01:00
Tor Arne Vestbø
009abcd7b6 QWidget: React to platform surface being created or destroyed
The platform window may create or destroy its surface from other entry
points than the QWidget API, in which case QWidget needs to sync up
its own state to match. In particular WA_WState_Created and the winId
needs to be recomputed.

Fixes: QTBUG-69289
Fixes: QTBUG-77350
Change-Id: I769e58ead3c2efcf8c451c363108848feade9388
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-12-09 17:43:22 +01:00
Thiago Macieira
c4b0ff4855 tst_QNetworkInterface: don't force an IPv4 link-local address
Windows apparently has special code to deal with those addresses. If all
your network interfaces are up and have acquired addresses, then the
link-local network at 169.254.0.0/16 is unreachable. I had never caught
this because both my Windows VM and my bare metal Windows have inactive
interfaces (like the Bluetooth PAN one) and, when inactive, Windows
assigns a link-local address. But in the CI, the interface(s) were all
up and running, causing this issue.

Unix systems don't treat IPv4 link-local any differently, so they always
worked, so long as any interface was up and there had to be one to reach
the network test server.

This commit reworks the test to add test addresses based on the
addresses found on up & running interfaces (see tst_qudpsocket.cpp). For
IPv4, we flip the bits in the local portion of the address. For IPv6, we
add a node with an address I generated randomly (non-universal), with
the same scope.

Fixes: QTBUG-65667
Change-Id: I568dea4813b448fe9ba6fffd15dd9f482db34991
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-12-07 10:20:27 -08:00
Olivier Goffart
4c3c63d4cb QMetaType: add more static-less API
In prevision to Qt6 which is going to discourrage the use of the integer id,
add some missing API to the staticless QMetaType API:

 - Add a way to construct a QMetaType from a type without calling qMetaTypeId:
   QMetaType::fromType<T>()
 - Add equality operators
 - Add a QMetaType::name() function
 - Add a default constructor (by adding a default parameter to the existing ctor)

Change-Id: I95487c1c31bdf0d773717daa9d5452cbced30673
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-12-07 10:32:29 +01:00
Sona Kurazyan
29adc0eed9 Fix updating the text cursor position after editing
In some cases when editing the text (for example when removing the
selected text, or pasting a text block) the text cursor position is
updated, but its visual x position is not updated. This causes the next
cursor movements to start from a wrong position.

Force the update for those cases.

Fixes: QTBUG-78479
Change-Id: Ia496be62beec58660f5e1695e5aafae09c79684e
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2019-12-06 15:52:35 +01:00
Edward Welbourne
6b5f848ebd Allow lower-case for the T and Z in ISO 8601 date format
Cite RFC 3339 as basis for allowing a space in place of the T, too.
The RFC mentions that ISO 8601 accepts t and z for T and Z, so test
for them case-insensitively. Add a test for this.

Change-Id: Iba700c8d74d485df154d27300aab7b1958e1ccef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-06 14:47:27 +01:00
Edward Welbourne
653c1aab18 Fix handling of trailing space at the end of an ISO date-time
If milliseconds were followed by a space, the space was included in
the count of "digits" read as the fractional part; since we read (up
to) four digits (so that we round correctly if extras are given), a
harmless apce could cause scaling down by too large a power of ten.

Since QString::toInt() ignores leading space, we were also allowing
interior space at the start of the milliseconds, which we should not,
so catch that at the same time.  Added tests, including one for the
rounding that's the reason for reading the extra digit, when present.

Fixes: QTBUG-80445
Change-Id: I606b29a94818a101f45c8b59a0f5d1f78893d78f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-06 14:46:48 +01:00
Edward Welbourne
49063c34d6 Fix crash when a date-time has an invalid time-zone
QDateTime is a friend of QTimeZone, so can access its internals; but
it must check the zone is valid before doing so.

Expanded tst_QDateTime::invalid() and made it data-driven to catch the
failure cases.

Commented on a test-case that caught a mistake in my first attempt at
this, and on QDateTimeParser's surprising reliance on a quirk of
QDateTime::toMSecsSinceEpoch()'s behavior.

Fixes: QTBUG-80146
Change-Id: I24856e19ff9bf402152d17d71f83be84e366faad
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2019-12-06 14:44:18 +01:00
Giuseppe D'Angelo
b19220d17f QByteArray: add a strict mode to fromBase64
QByteArray::fromBase64 was liberal in its input, simply skipping
over invalid characters. As a side-effect of this, it had
no error reporting, meaning it could not be used to convert
fromBase64 _and_ validate the input in one go.

Add more option flags to make fromBase64 strictly validate
its input. Since we want to know whether it has succeeded
or not, and the existing fromBase64 overloads do not
allow for that, introduce a new function that returns
an optional-like datatype.

While at it: base64 decoding can be done in-place; add an
rvalue overload to enable this use case.

[ChangeLog][QtCore][QByteArray] Added the new fromBase64Encoding
function.

[ChangeLog][QtCore][QByteArray] Added new flags to make
fromBase64 / fromBase64Encoding strictly validate their input,
instead of skipping over invalid characters.

Change-Id: I99cd5f2230f3d62970b28b4cb102913301da6ccd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-12-05 21:04:50 +01:00
Friedemann Kleint
843be88e29 Manual High DPI test: Add a page logging all screen change signals to Metrics
Turn the Metrics widget into a QTabWidget and add a tab logging
all changed signals of QScreen.
This is useful when for example debugging issues with lock screens and
laptop hibernation.

Task-number: QTBUG-79248
Task-number: QTBUG-76902
Change-Id: Ie86789fe1514cb3333a5f3def7f613f217fa6802
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-12-05 18:37:00 +01:00
Sona Kurazyan
81459dd9c0 Copy formatting attributes when cloning an empty QTextDocument
When cloning a QTextDocument, the text fragment of the original document
is copied into the new one, which results into copying also the
formatting attributes. However, when the text document is empty, the
corresponding text fragment is also empty, so nothing is copied.

If we want to transfer the formatting attributes for an empty document,
we need to set them explicitly.

Fixes: QTBUG-80399
Change-Id: I382cd0821723436120af47c06ec7bfa849636307
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-12-05 17:34:02 +01:00
Thiago Macieira
1f592da7f1 QCborValue: fix replacing of elements with byte data with ones without
We forgot to reset the flags when replacing the element, so we ended up
with an integer with HasByteData after:

    testMap[0] = QStringLiteral("value");
    testMap[0] = 42;

Fixes: QTBUG-80342
Change-Id: Ia2aa807ffa8a4c798425fffd15dabfa066ea84b0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-12-05 07:59:07 -08:00
Dimitrios Apostolou
75f75e997a docker-compose now brings up the docker images tagged as "latest"
This is so that we can do simple changes to the docker images
in provisioning, without needing to update the tag here.

If a backwards-incompatible change in the docker images needs to be committed
in provisioning and here, it is possible because the images retain their old
unique SHA1 tag, in addition to being tagged as latest. See comment for more
details.

Requires the change in qt5 repository, with commit sha:
e4f9ac5607a329bae045567a339d36469bc4fff6

Task-number: QTBUG-79867
Change-Id: I1bc72edec62487530575d7e113a25afe16d09129
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-12-05 15:40:00 +01:00
Lars Knoll
7b34da9ef1 Add QHash::insert(const QHash &other)
As opposed to unite(), this inserts one hash into the other
without duplicating elements.

Change-Id: Ifc786c48f5dc3ab18c29782e73eac3c1a3ef8981
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-12-05 11:50:32 +01:00
Fabian Kosmale
3359b29c99 QDoubleValidator: Fix thousand separator handling
QDoubleValidator would accept "1,23" as valid in a locale which has ','
as a thousand separator. However, it should have been Intermediate
instead, as there is still one digit missing.

Fixes: QTBUG-75110
Change-Id: I6de90f0b6f1eae95dc8dfc8e5f9658e482e46db3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-12-05 11:30:24 +01:00
Paul Olav Tvete
913146ccd4 RHI: new native texture API
The new version takes/returns a value that can be unpacked and passed to
other functions without knowing which backend is in use.

The old API will be removed in a later change when dependent modules have
been updated

Task-number: QTBUG-78570
Change-Id: I18d928ceef3cb617c0c509ecccb345551a7990af
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-12-05 10:04:46 +01:00
Qt Forward Merge Bot
d025c1a75f Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ia70e81943ef097941339f9ef9ace28592a2eb740
2019-12-04 01:00:07 +01:00
Dimitrios Apostolou
7cf8c993c7 Fix flaky test tst_QFiledialog::clearLineEdit()
Task-number: QTBUG-76989
Change-Id: I3ec7f65500476346e1a8f1017c6452517a660860
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-12-03 19:57:03 +01:00
David Faure
9f79ab360f Fix assert in QTextDocument CSS parser on "border-width: 1pt"
The code was assuming that if the parsing of the value worked,
then it must be a list of 4 variants. But in this case it's just
a single length.

This came from <td> using 4 values for border-width
while other elements use a single value. But the storage
is shared. So the fix is to use 4 values everywhere.
When reading 4 and there's only one, it gets duplicated,
so the caller can just use the first one in that case.

Task-number: QTBUG-80496
Change-Id: I682244b6e3781c4d673a62d5e6511dac263c58e8
Reviewed-by: Nils Jeisecke <nils.jeisecke@saltation.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-12-03 17:54:24 +01:00
Joni Poikelin
8310d636be Fix serializing QUuid with QDataStream with Qt 4 stream versions
Fixes: QTBUG-76103
Change-Id: Iac92c33539940f5f67d014db5240c6dc14bfb772
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-12-03 13:28:22 +02:00
Ulf Hermann
25bcd8f08b Merge "Merge remote-tracking branch 'origin/5.14' into 5.15" 2019-12-03 06:58:19 +01:00
Heikki Halmet
ad1810e321 Blacklist tst_QNetworkInterface::localAddress(linklocal-ipv4) on Windows
This will blacklist this test for ci. Currently blocking enabling tests
for MSVC2019

Task-number: QTBUG-65667
Task-number: QTQAINFRA-2875
Change-Id: I7198490b1529ce2f4409bfa7399031dad7644a06
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-12-03 05:57:26 +00:00
Ulf Hermann
e62d04b933 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	src/corelib/serialization/qcborvalue.cpp

Change-Id: I675a3029955c96e81a33ed9d98b72b55b6784b52
2019-12-03 06:57:05 +01:00
Samuel Gaist
f81f21151d Session management for macOS
This patch aims to implement the session management available on macOS.
Currently applicationShouldTerminate is just a go through that closes
everything and ends the application. The new implementation calls
first appCommitData and cancels the termination properly if required.
This means that if a user wishes to logout, Qt applications can now
cancel that like e.g. answering to Safari asking whether it is ok to
close because of a number of opened tab/window.

Fixes: QTBUG-33034
Change-Id: Id5d7416cb74c762c5424a77c9c7664f0749da7f6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-12-02 18:18:22 +01:00
Mårten Nordheim
f881d00a4f QWindowsFontDatabase: Check preferred family names for all fonts
The code was initially introduced in
9204b8c31e but getting the names were
conditioned on whether or not Windows identified it as a truetype font.
This excluded cases which had preferred names embedded but was not
truetype fonts. To fix that we run the code unconditionally.

[ChangeLog][Windows] Fixed a bug where some fonts would not be
accessible by referencing their typographic name.

Fixes: QTBUG-78556
Change-Id: I8823684b09cce3b1b8722b1e609a5bb49b13da13
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-11-29 09:31:21 +01:00
Andy Shaw
985f491024 QTreeView: Reset the pressed index if the decoration was pressed on
We need to reset the pressed index when the decoration was pressed on
otherwise if the mouse ends up over an already selected item that was
previously clicked on. This prevents it from thinking that the mouse
has been released on this item right after pressing on it.

Fixes: QTBUG-59067
Change-Id: Iab372ae20db3682ab0812661f86533079ba4083c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2019-11-29 06:53:10 +00:00
Allan Sandfeld Jensen
00c869a5c6 Fix lancelot PaintCommands for reuse
Some structures needed to be cleaned for the reuse to be safe.
Reusing it cuts down on the overhead in lancebench.

Also uniqueness of block names are now enforced, and the common pattern
of "end_block blockName" could now be parsed if not always commented
out by begin_block handling.

Change-Id: I0daf6445292383aaab9392550d0842e0a654ad27
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-11-28 19:52:16 +00:00
Timur Pocheptsov
67bbe28d67 tst_qsslcertificate: fix subjectAndIssuerAttributes
Instead of OID as string, OpenSSL returns a human-readable name.
No need to fail then, use such a name in QVERIFY if OID not found.

Fixes: QTBUG-80329
Change-Id: I4392fc9f37367f7c34c05d172db015b44e2a8497
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-11-28 17:12:26 +01:00
Friedemann Kleint
43c8596be5 More polish of the manual High DPI test
The aim is to make it suitable to test for High DPI
bugs, ideally removing the need to provide bug report
examples.

- Add descriptive window titles/output
- Add options to force scaling on/off
- Change the updating of the text to be done in screenChanged()
  and log the signal.
- Rearrange the layout and show the descriptions as labels

Task-number: QTBUG-80323
Change-Id: Ia44c184c2b38cb18045c40b440fe785c6c17925f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-11-28 14:26:25 +01:00
Friedemann Kleint
c94e756f01 Polish the manual High DPI test
- Use C++ constructs like range-based for, member initialization
- Fix formatting in a few places
- Silence clang warnings:
  - Add override
  - Make member variables private

Task-number: QTBUG-80323
Change-Id: I5b0fda06acb6c8054aafa4dd934b763f8493a6b3
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-11-28 14:26:19 +01:00
Edward Welbourne
cfd2f3c46e Work around macOS's inconsistency in naming of India's time-zone
macOS fails to create a zone for the name its own systemTimeZone
claims to have (see new comment). So make sure we do consistently
recognize the name systemTimeZoneId() returns, using systemTimeZone
from which we got its name.

Add minimal testing of system time-zone.

Fixes: QTBUG-80173
Change-Id: I42f21efbd7c439158fee954d555414bb180e7f8f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-11-28 14:16:33 +01:00
Christian Ehrlicher
4422a9bd88 QWidget: don't set WA_PendingMoveEvent when geometry does not change
When the geometry of a hidden widget was set with setGeometry(),
WA_PendingMoveEvent and WA_PendingResizeEvent were set unconditionally
even if the crect already had the correct value. This lead to
unneeded Move/Resize events within sendPendingMoveAndResizeEvents().

Fixes: QTBUG-75475
Fixes: QTBUG-79906
Change-Id: Ibbe03882f039948b6b7c04887420741ed2e9c0f7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-11-27 20:00:45 +01:00
Christian Ehrlicher
e70fe301d9 Widget autotests: replace deprecated QWidget::repaint() calls
Replace QWidget::repaint() with update() + wait until the paint event is
received.

Task-number: QTBUG-80237
Change-Id: I57da7cd8fa119344484b849a88729bca7b48616c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-11-27 19:11:25 +01:00
Laszlo Agocs
64760504e7 rhi: Allow testing QRhiRenderPassDescriptors for compatibility
For Metal and Vulkan this needs actual work because that's where
the concept of renderpass descriptors is relevant. GL and D3D can
just return true always.

The big benefit of this is that Qt Quick can now compare renderpass
descriptors via isCompatible() for its pipeline cache (similarly to
how it is already using isLayoutCompatible() for srbs), and so
renderpass descriptors for layers (Item.layer, ShaderEffect) will
typically be compatible and so can pick up pipelines created by other
layers from the cache.

Also add autotests for shader resource binding and renderpass descriptor
compatibility.

Task-number: QTBUG-80318
Change-Id: I0008bc51c4ee13b0113d2c8caf799e1257f18a18
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-11-27 19:07:36 +01:00
Edward Welbourne
52affd322c Be consistent in the RFC2822Date invalid character tests
The ones we reject used a zero offset while the one that does parse
(though it shouldn't - revised comment) has a one hour offset. Made
them all use that offset and added a partner test that has no invalid
characters, so ensure the success of the invalid character tests isn't
due to falsely rejecting the valid date/time text to which the invalid
characters are added.

Task-number: QTBUG-80038
Change-Id: I6e3dd79b981af6803e60877229c56599cfd719cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-11-27 18:27:43 +01:00
Edward Welbourne
0debb205b2 Permit leading space at start of RFC 2822 Date format
Relevant RFCs explicitly permit such space.

Change-Id: I8eb444e96287368cbbf973c77513b43d1d36f972
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-11-27 18:27:43 +01:00
Edward Welbourne
6566157df3 Make Qt::RFC2822Date's doc match up with its implementation
The qdatetime implementation's rfcDateImpl() uses regexes which did
not match its comments; nor did either the regexes or the comments
match what was documented. A review of relevant RFCs suggests we
should revise this in future, probably at Qt 6.

The documentation also only addressed the formats recognized when
parsing a date-time, without indicating how they are serialised or how
dates and times are handled separately.

Added a note to the tests for the read-only formats, to remind the
reader that the RFCs merely recommend recognising these - be
permissive in what you expect and strict in what you deliver.

Change-Id: I0f0bec752e7a50bde98cceceb7e0d11be15c6a6f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-11-27 18:27:43 +01:00
Laszlo Agocs
f3c37c839c Enable QRhi Metal backend on iOS
While we are at it, remove the Border and MirrorOnce wrap modes that have
not been supported on OpenGL, because they are unsupported with Metal+iOS
as well.

Task-number: QTBUG-78580
Change-Id: I0db94b9d3a6125b3bb5d7b1db5d02a42cd94d2c2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-11-27 09:51:28 +01:00
Friedemann Kleint
d556d7a6b8 Avoid initializing QFlags with 0 or nullptr in tests
Amends qtbase/af2daafde72db02454d24b7d691aa6861525ab99.

Change-Id: Ib5d17611e43e7ab2c63c7f0587f549377f262e32
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-11-26 09:08:51 +01:00
Sona Kurazyan
ccc2133c64 Port QDomDocument to QXmlStreamReader
Reimplement QDomDocument using QXmlStreamReader and switch to the new
implementation starting from Qt 6.

The changes in the behavior are reflected in tests: some test cases
which were marked as "expected to fail" are now passing.

Task-number: QTBUG-76178
Change-Id: I5ace2f13c036a9a778de922b47a1ce35957ce5f6
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2019-11-26 09:07:26 +01:00
Thiago Macieira
bcbefcd645 QCborValue: Extend the constructor to also create extended types
We already did that when parsing from CBOR binary data, so the code was
already present.

[ChangeLog][QtCore][QCborValue] The constructor taking a CBOR tag and a
value to be tagged now attempts to convert to a QCborValue extended
type. For example, if the tag is 0 (UnixTime_t) and the payload is a
number, the resulting object will become tag 1 (DateTime) and the
payload will be the the ISO-8601 date/time string.

Fixes: QTBUG-79196
Change-Id: I6edce5101800424a8093fffd15cdf650fb2fc45c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-11-23 02:14:42 +01:00
Thiago Macieira
8027fb60dd Fix QCborValue::toCbor with non-ASCII URLs
Found while fixing QTBUG-79196.

Change-Id: Ia2aa807ffa8a4c798425fffd15d841657def99af
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-11-23 02:14:39 +01:00
Qt Forward Merge Bot
59a705e371 Merge "Merge remote-tracking branch 'origin/5.14' into 5.15" 2019-11-23 01:00:34 +01:00
Qt Forward Merge Bot
a5e4a67e8b Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I1c68f2f6bc35d344c60a1898b68bf2ca79e54a9d
2019-11-23 01:00:23 +01:00
Christian Ehrlicher
96c27eb710 QList/Table/TreeWidgetItem: Allow reseting values by passing the default value
The convenience functions setBackground(), setForeground() and
setSizeHint() a default constructed value as 'reset'. This means a
default constructed QBrush or QSize is returned in the data() function
which leads to an unexpected background or forground color or size hint.
Therefore check if the passed value is a default constructed value and
set an empty QVariant instead which.

[ChangeLog][QtWidgets][ItemViews] The convenience views
QList/Table/TreeWidgetItem now treat a default constructed QBrush or
QSize as an empty QVariant which allows to reset the values set to it's
default values.

Task-number: QTBUG-76423
Change-Id: I840570bbad3e5fd8c5b4b58903b4fd0066dbdeb7
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-11-22 22:02:15 +01:00
Robert Loehning
924887965c Fuzzing: Update location of testcases in Readme
At the time of writing, they were still planned to be in qtbase.

Change-Id: I27cba2bbd176d930990270ea68f077ec6e0a2d5b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-11-21 13:41:18 +01:00
Allan Sandfeld Jensen
af2daafde7 Deprecate constructing QFlags from a pointer
This was used to support QFlags f = 0 initialization, but with 0 used
as a pointer literal now considered bad form, it had been changed many
places to QFlags f = nullptr, which is meaningless and confusing.

Change-Id: I4bc592151c255dc5cab1a232615caecc520f02e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-11-20 19:43:38 +01:00
Qt Forward Merge Bot
1315133233 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ic4ffd206bdd3ed68fd3d21a93818923e8d3a1e7a
2019-11-20 01:00:51 +01:00
Kari Oikarinen
315c2c468e tst_QScopeGuard: Remove unused lambda capture
qt5/qtbase/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp💯38:
      warning: lambda capture 'caught' is not used [-Wunused-lambda-capture]
        auto cleanup = qScopeGuard([&caught] { s_globalState++; });
                                    ~^~~~~~

Change-Id: I0d9b85896594f3ea35c8003846d4ac7ab5e33d16
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-11-19 18:33:43 +02:00
Christian Ehrlicher
d7cb21ac08 QDom: use QLocale::C when converting a double to a xml attribute
QDomElement::setAttribute(QString, double) did not use QString::setNum()
but qsnprintf(). This is wrong because qsnprintf() is using the current
locale instead QLocale::C. It was also inconsistent to
QDomElement::setAttributeNS() which was already using QString::setNum().

Also fix the documentation which stated that all
QDomElement::setAttribute() format the values according the current
locale.

Fixes: QTBUG-80068
Change-Id: Iabb0b39c0d0723060527542c283a5435f26f31ca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-11-19 17:33:33 +01:00
Qt Forward Merge Bot
587f1cbc5d Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I4e5c8a1fcef443c3383e207102f21d41000ff322
2019-11-19 01:00:12 +01:00
Edward Welbourne
4218c3044d Revert "[macOS] Skip test that triggers a buffer overflow in CoreFoundation"
Allegedly Apple has fixed the bug that made this necessary, so we
should be able to include these two test-cases once more.

This reverts commit ba9585bd02.

Fixes: QTBUG-69875
Change-Id: I5ac6019c0d647691eda6cdbb2a53e7471859d4a3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2019-11-18 10:15:39 +01:00
Christian Ehrlicher
360df2cf74 QComboBox: add property placeholderText
QComboBox had no option to tell the user that he must select an item -
there was no placeholder text like e.g. in QLineEdit. This feature is
widely used in html forms so we should support it also.
Therefore add a new property 'placeholderText' to specify a text which
should be shown when the current selected index is invalid.

[ChangeLog][QtWidgets][QComboBox] QComboBox got a new property
'placeholderText'

Change-Id: If6dac45c9f43455474e267907b0b0d893301c611
Fixes: QTBUG-1556
Fixes: QTBUG-2776
Fixes: QTBUG-77141
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-11-15 20:45:24 +01:00
Qt Forward Merge Bot
5abb976f23 Merge "Merge remote-tracking branch 'origin/5.14' into 5.15" 2019-11-15 16:30:51 +01:00
Qt Forward Merge Bot
adc7bbe910 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	src/gui/rhi/qshader.cpp
	tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp

Change-Id: I1c4ae718eb3592a0a0a90af9d11553f3ab68cad5
2019-11-15 16:29:40 +01:00
Daniel Teske
9f48f1ebc2 QLineEdit: Fix End key for input masks
Consider this simple example:
   QLineEdit edit;
   edit.setInputMask( "9-9-9-9-9-9" );
   edit.show();

Without any input, m_text will contain: " - - - - - ". text() removes
the input mask's mask characters from that and returns "      ". A string
with 6 spaces. Thus currently the End key jumps to position 6, which is
in the middle of the string. Using m_text the End key jumps to the actual
end.

[ChangeLog][QtWidgets][QLineEdit] Fixed End key in combination with
certain input masks.

Task-number: QTBUG-16187
Task-number: QTBUG-20414
Change-Id: Ibb30a1dfa2f78103611b5afc9971dc43e8bdcc4a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-11-15 13:40:05 +02:00
Christian Ehrlicher
a4751f8824 QShortcut: add pmf ctor overloads
Provide pointer to member function overloads for the QShortcut ctor. The
ctor with two functors but no contexts is not provided since it creates
ambiguousness.

[ChangeLog][QtWidgets][QShortcut] QShortcut ctor has now pmf overloads

Fixes: QTBUG-77816
Change-Id: Ic9a759cde5150dbb94c2fd351b88ee8e447e0852
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-11-14 19:59:23 +01:00
Christian Ehrlicher
c15a069830 QTreeView: make sure to not ask the old model during setModel
Within QTreeView::setModel() the header might emit columnCountChanged
which then tries to update the geometries based on the old model which
is wrong.
Fix it by setting geometryRecursionBlock to true so
QTreeView::updateGeometries() will not ask the old model for it's data.

Fixes: QTBUG-75982
Change-Id: Ia0dd36cd7c6c5347fbc285deac43da6941accbe7
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-11-14 20:47:45 +02:00
Robert Loehning
6e42ed217c configure: Add sanitizer "fuzzer-no-link"
Adds instrumentation for fuzzing to the binaries but links to the usual
main function instead of a fuzzer's. The similar sanitizer "fuzzer"
should then be used only for building the test itself.

Requires clang 6 or higher.

Change-Id: I24ee1f018b0b97f2977dc86fbdc29a164d7c4e01
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-11-14 15:45:02 +01:00
Edward Welbourne
ad11cab484 Allow longer time-zone components on Android
Android uses its own time-zone naming, which includes a zone called
"Canada/East-Saskatchewan", whose second component is 17 characters
long. This violates a rule in the IANA naming scheme for zones, that
limits components to 14 characters each. So tweak the isValidId()
check to allow Android its long names.

Android has added Outer Mongolian time-zones, which are as borked as
many others in 1970, so blacklist those transitionEachZone() tests.

Fixes: QTBUG-69128
Change-Id: I46f674f095431335b16900860d83b624257ae3bb
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2019-11-14 10:47:57 +01:00
Robert Loehning
6961d46b6e Fuzzing: Add comment how to recude noise in iccparser's fuzzer
With logging enabled, all the output will slow down
execution and fill up your hard disc in about a day.

Task-number: QTBUG-79050
Change-Id: I5dcac2f349f7dbe471a5e6dd7006b89d312aeeaf
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-11-13 12:37:44 +02:00
Edward Welbourne
17b8a49fde Move some tests of QTimeZonePrivate::isValidId() to where they belong
They were tucked away in the back-end of the isTimeZoneIdAvailable()
test, but a separate isValidId() test had been added more recently,
which made some (arguably all) of them redundant. Reworked this test
in the process, so that the QSKIP() happens in _data() once instead of
in the test that's never run because there are no data rows.

Change-Id: Icaa6227ace9a1aa944d085691cdcfb3adf4a51dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-11-13 10:52:00 +01:00
Ryan Chu
004e3e0dc2 Make Qt aware of NTFS Junctions on Windows
On NTFS, a junction point can be created and deleted by the mklink and
rmdir commands, respectively. If a directory is not identified
correctly as a junction, then applications will likely try to remove
it using recursive methods, leading to fatal data loss.

With this change, Qt can identify file system entries as junctions,
allowing applications to use the correct file system operation to
remove it.

The test needs to delay the cleaning up of junctions and files it
creates until the checks are complete; since they might fail and make
the test function return prematurely, use a scope guard.

[ChangeLog][QtCore][QFileInfo] Add QFileInfo::isJunction so that
applications can recognize NTFS file system entries as junctions

Task-number: QTBUG-75869
Change-Id: I3c208245afbd9fb7555515fb776ff63b133ca858
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-11-09 00:47:45 +01:00
Friedemann Kleint
1dd83dd202 Diaglib/Windows: Output more information on geometry for native handles
Obtain the client area and output frame and position relative to the
parent window.

Task-number: QTBUG-79861
Change-Id: I193dfbcdec7e27d32a70ada08ba271260eedc969
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2019-11-08 11:34:11 +01:00
Qt Forward Merge Bot
78c687f98e Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I963b5f48b5d6f3500ca379fbd7f1a4290b570175
2019-11-08 09:11:02 +01:00
Allan Sandfeld Jensen
52a3f1b00c Fix accuracy of ARGB32->A2RGB30 conversions
It was converted over ARGB32PM, when it should have been directly
converted to not lose accuracy, instead there was an unnecessary direct
ARGB32->RGB30 conversion, which was converted to the necessary type.

This also improves the selection of conversion over ARGB32PM or RGBA64PM
for ARGB32 and RGBA8888 by using 32-bit conversion when alpha is not
relevant.

Change-Id: I5990d8a23b2909d3910d8c1213fa46477742b052
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-11-07 10:42:08 +01:00
Edward Welbourne
e6a0a945c5 Simplify two complex test conditions
Since the test was fatuous for i == 0, iterate from i = 1, instead.

Change-Id: I9b9c1b7b10639aefdd74f48051d592da4f84dc85
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-11-07 10:35:03 +01:00
Qt Forward Merge Bot
e3cc16e9fb Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	.qmake.conf
	mkspecs/features/mac/default_post.prf
	src/corelib/tools/qsimd_p.h
	src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
	util/qfloat16-tables/gen_qfloat16_tables.cpp

Change-Id: If48fa8a3bc3c983706b609a6d3822cb67c1352a4
2019-11-06 11:41:19 +01:00
Edward Welbourne
7bf4f81de8 Add qfloat16::copySign() since we can't overload std::copysign()
Change-Id: Idfaf841b3eb3538f076ae4f0de2d7d029e1588fe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-11-06 11:36:49 +01:00
Lars Knoll
2faccdf9a6 Don't insert multiple names for the same role
It doesn't make a lot of sense to have two names for the
same role. Use 'fileIcon' exclusively for the Qt::Decoration/
FileIconRole.

Change-Id: Icaa46ba4aa61efc56ba007a14bab5e59ea26cd35
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-11-05 16:32:28 +00:00
Shawn Rutledge
d1c6f7e5a2 QTextMarkdownWriter: preserve empty lists
You can save a "skeletal" document with list items to fill in later,
the same as you can do in HTML or ODF format.  Reading them back via
QTextDocument::fromMarkdown() isn't always perfect though.

Fixes: QTBUG-79217
Change-Id: Iacdb3e6792250ebdead05f314c9e3d00546eeb9f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-11-05 16:40:18 +02:00
Shawn Rutledge
524ab7b535 Avoid crashing when the end of an empty markdown list is detected
The markdown parser generates empty lists in some cases when a character
that can be used as a bullet is found on a line by itself.
cbEnterBlock() and cbLeaveBlock() are called symmetrically in such cases.
QStack::pop() on an empty stack triggers an assert, so push and pop need
to be done symmetrically too.  But it's difficult to actually create the
list as soon as the MD_BLOCK_UL or MD_BLOCK_OL callback occurs, without
breaking the case fixed in 7224d0e427 (and
probably other cases).  That's because QTextCursor::insertList() creates
a list item at the same time as it creates the list itself, and also
inherits block formatting from the previous block.  We now insert empty
lists with empty items whenever the need for that is detected though,
and there's a failsafe to prevent popping in case something still goes
wrong with that logic.  We aren't strict about reproducing the original
markdown when regenerating it via toMarkdown(), but it's getting closer.

Fixes: QTBUG-78870
Change-Id: Ided194ce7aec2710c60dbac42761ee4169ed9b78
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
2019-11-05 16:39:13 +02:00
Andy Shaw
b1004c7d0a If only family is set, prefer that in the families list after resolving
If a font with only a family set is resolved with one that has been setup
with setFamilies() then the family needs to be prepended to the families
list after resolving. This is so that the font still prefers the one set
as just a family with no famillies set.

This also amends the QFontDialog test to account for this too.

[ChangeLog][QtGui][Text] Resolving a font that just has a family set
with families set will prepend the family to the families so that it
is still the first preference for the font.

Task-number: QTBUG-46322
Change-Id: Icc4005732f95b2b4c684e592b06b31e133270e44
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-11-05 09:46:29 +01:00
Frederik Gladhorn
7ba1d611cf Fix qtHaveModule(widgets) condition
In qmake syntax there should be a colon or curly braces following a condition.

Change-Id: Ibd989662aef6320cec8093e7c6103bf8362b8255
Reviewed-by: Liang Qi <liang.qi@qt.io>
2019-11-02 08:55:27 +01:00
Timur Pocheptsov
1a878e65c2 QSslSocket - remove old OpenSSL backend (< 1.1)
OpenSSL 1.0.2 will stop receiving all support at the end
of 2019. Qt 5.15 is our next LTS thus makes sense remove
OpenSSL 1.0.2 support there. This also allows us quite
a significant cleanup of an old heavily if-defed code
and all 'pre11' suffixed source files.

[ChangeLog][QtNetwork][SSL] Removed OpenSSL 1.0.x support, now 1.1.x is required

Change-Id: I70c70c56cbd8aeff793afe793335696d1b1b7408
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-11-01 14:52:09 +01:00
Qt Forward Merge Bot
7a13a09116 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ic13ef00d76c81295076bb2432576db70ec84fe29
2019-11-01 01:00:45 +01:00
Ville Voutilainen
36e277e917 Add a transfer timeout at QNAM level as well
Task-number: QTBUG-3443
Change-Id: Idc4d3c9b1ace69bd8b6456506778116a3e8a5490
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-10-31 19:12:07 +02:00
Laszlo Agocs
09ee9ef65d Avoid EGL_BAD_MATCH in tst_qrhi autotest
Call adjustedFormat() as advised by the docs: "Applications are advised
to set this format on their QWindow in order to avoid potential BAD_MATCH
failures."

Task-number: QTBUG-79659
Change-Id: Ibf415fb0ee64bdd3f01d4ba744244bce811c0d27
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-10-31 14:41:07 +01:00
Edward Welbourne
c3eb521a0f Update UCD data to Unicode 12.1.0's Revision 24
Had to teach the update program to accept category Lm as for
Joining_Transparent, for the sake of a new ArabicShaping.txt entry.
Added three new Unicode versions, several new scripts and a new
word-break class.

Updated UCD's test data for tst_QTextBoundaryFinder.  This left 57
tests failing; I have commented out the data rows for those tests,
pending someone with more knowledge addressing this.

Task-number: QTBUG-79631
Task-number: QTBUG-79418
Change-Id: Ic33d3b3551195d47a84d98e84020f57a68f0b201
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-10-30 17:38:02 +01:00
Qt Forward Merge Bot
c51ca1d1b2 Merge remote-tracking branch 'origin/5.13.2' into 5.13
Change-Id: Ieb5afc87086758119bcfc8efbe355f5c0a93fc04
2019-10-30 06:52:03 +01:00
Qt Forward Merge Bot
a317bff298 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ib4df563fc7b1f7c40f425e0e71180d9517a672be
2019-10-30 01:00:14 +01:00
Edward Welbourne
d05ca484cf Make tst_QNumeric more systematic about checking float as well as double
Do this by templating the floating-point tests, which removes some
existing duplication as well as avoiding new duplication. Did some
renaming in the process. Added some tests of fuzzyCompare that come
closer to its boundary. Increased number of tests from 69 to 97. Use
std::numeric_limits to replace assorted hard-coded constants and old
C-library boundary-value macros.

It turns out MSVC's float conflates quiet and signaling NaN (although
MinGW's doesn't); and WebAssembly's old fastcomp compiler conflates
NaNs for both float and double; so XFAIL the test for distinct NaNs in
those cases.

Change-Id: I0a1c0d2f68f75d51b8cda9e3ddfe7fa9c190a3e2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com>
2019-10-29 16:46:54 +01:00
Laszlo Agocs
58a67e4e0a rhi: Move to CBOR in QShader and expand the autotest
Binary JSON is said to become deprecated. Therefore, add support
for CBOR. Binary JSON is still supported for deserialization, so
all existing .qsb files will continue to work, as long as the
binaryjson feature is enabled in the Qt build.

Also makes QShaderDescription comparable. This is important for
tests in particular.

A nice side effect of using CBOR is that .qsb files become smaller.
For a typical Qt Quick material shader this can mean a reduction of
300 bytes or more.

Task-number: QTBUG-79576
Change-Id: I5547c0266e3e8128c9653e954e47487352267f71
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-10-29 15:22:46 +01:00
Morten Johan Sørvig
dcbcda81b4 wasm: add local file access manual test
Testes file load and save, computes a sha256 hash
for verifying file content.

Change-Id: Id7f697c4dfd41e051442350f4050f04b493cfc18
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-10-29 14:02:43 +00:00
Andy Shaw
ccd3bf0871 Ensure that child windows are visible again when showing their parent
When a window is closed, then it will cause the child windows to be
closed as well as a result. Therefore in order to ensure that they are
shown again as a result, we need to remove the WA_WState_ExplicitShowHide
attribute if the widget was not already hidden before. This enables us to
test for this attribute when calling showChildren(), so that if the
window has a windowHandle then we can make sure that this widget is shown
again.

Fixes: QTBUG-73021
Change-Id: I1186242b889899dfcd38d782a67567348e2055ee
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-10-29 10:45:19 +02:00
Christian Ehrlicher
c87e2c37de tst_QDataWidgetMapper/QFileIconProvider/ItemEditorFactory: cleanup
Cleanup QDataWidgetMapper/QFileIconProvider/ItemEditorFactory autotests:
 - use range-based for loops
 - use nullptr
 - use member initialization
 - use new signal/slot syntax
 - use static invocations
 - use override

Change-Id: I1a36ea2da7de1cfa5d5d4e305ef508fda3a6c460
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-10-29 06:24:01 +01:00
Ville Voutilainen
c33d8bfc99 Add a timeout for transfers
If a transfer timeout is set for QNetworkRequest, downloads
and uploads are aborted if the timeout expires and bytes
haven't been transmitted in either direction.

Task-number: QTBUG-3443
Change-Id: I702d223d673f0c6612343dc9d053815acfcb61b8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-10-28 21:15:43 +03:00
Qt Forward Merge Bot
08f90adffd Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	src/corelib/serialization/qjson_p.h

Change-Id: I83cea141a4de8b3998478bfded84ca9029f7a2a9
2019-10-28 10:50:03 +01:00
Qt Forward Merge Bot
86e74d60d2 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I208a36bf1c88c8291baaa5ca8fe8e838bc9d7aea
2019-10-26 01:01:14 +02:00
Edward Welbourne
43f64b4dc8 Update CLDR to v36
Released on October 4th.
Adds Windows names for two time zones, Qyzylorda and Volgograd.
Added languages Chickasaw (cic), Muscogee (mus) and Silesian (szl).

Norwegian number formatting has flipped back to using colon rather
than dot as time separator; it's flipped back and forth over the last
several CLDR releases.  The dot form is present as a variant, the
colon form was long given as the normal pattern, then went away; but
now it's back as a contributed draft and that's what we pick up.

The MS-Win time-zone ID script was iterating a dict, causing random
reshuffling when new entries are added. Fixed that by doing the
critical iteration in sorted order.

Omitted locales ccp_BD and ccp_IN due to QTBUG-69324.

Task-number: QTBUG-79418
Change-Id: I43869ee1810ecc1fe876523947ddcbcddf4e550a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-10-25 11:44:48 +02:00
Edward Welbourne
ef9c498215 Tidy up data-stream test
While I was looking into a bug related to problems building the test
without GUI, I noticed a lot of spurious #include lines so tidied up a
bit.  Split some long lines, while I was about it.

Change-Id: Id87eb6f612c6b174f8240dfe9c00e0929244fb6c
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2019-10-25 11:44:13 +02:00
Edward Welbourne
59ca056a79 Exclude tests that need GUI when GUI isn't available
Thanks to Dmitriy Purgin for pointing out the serialization one.

Task-number: QTBUG-79353
Change-Id: Ia3d750b17ddd8fbb7a83a55df7e4546ca78c358b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-10-25 11:42:09 +02:00
Edward Welbourne
fd3db1dc3a Don't try to define QT_NO_CAST_TO_ASCII when the test undefines it
The qmake config for tst_QString tried to impose QT_NO_CAST_TO_ASCII
on it, but the source file explicitly #undef-s this symbol and its
friends. Leave the define commented out in the .pro so that a comment
can explain why it's no good.

Change-Id: I7620f4e104f0cdab05fdc246b903c40026e63d76
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-10-25 11:41:44 +02:00
Edward Welbourne
946c701883 Move a test for feature ICU from .pro to .cpp
Test QT_CONFIG(icu) in the code instead of testing qtConfig(icu) in
the profile and setting an extra define just to shadow what's already
defined. Also remove the matching define from qcollator.pro, whose
test code didn't use it.

Noticed while reviewing the conversions to CMake.

Change-Id: I19d3b1026b2a8f50ec424c450614e721500fd38a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-10-25 11:41:30 +02:00
Johan Klokkhammer Helsing
c9b3091be5 tst_qgraphicspixmaptiem: Fix undefined behavior in contains
See the comment in the test for details.

Change-Id: Ie3d356e476ba0419d304bccd396fc18a831a30cd
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-10-25 07:20:54 +00:00
Qt Forward Merge Bot
375efdd0e1 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Iebedaa967a263854f18cd403ce007d7965f26d2b
2019-10-25 01:00:16 +02:00
Christian Ehrlicher
9ae0fa4d49 cleanup QSortFilterProxyModel tests
Cleanup QSortFilterProxyModel tests:
 - adjust includes
 - use nullptr
 - use override
 - avoid unneeded casts
 - use new signal/slot syntax

Change-Id: I05f7c18cd2642bc8251bf1560803e7635684d24d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-10-24 19:41:16 +02:00
Christian Ehrlicher
5edf34848a QTableView: properly deselect row when column 0 is hidden/not visible
When the first column is hidden or not visible in the current viewport,
it is not possible to deselect the current row.
Fix it by passing the correct column to
QItemSelectionModel::selectedRows() when testing if the current index is
selected.

Fixes: QTBUG-79092
Change-Id: I9d8082d2b29ad2f799156aee910c6ff6e3217771
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-10-24 19:41:14 +02:00
Ulf Hermann
9ab043b688 QFileSystemEngine: Consistently check for invalid file names
stat() and friends expect a null-terminated C string. There is no way to
generate anything useful from a string that has null bytes in the
middle. It's important to catch this early, as otherwise, for example, a
QDir::exists() on such a path can return true, as the path is silently
truncated.

Extend the checks for empty file names to windows and add checks for null
bytes.

Change-Id: Ie9794c3a7c4fd57f9a66bdbbab8b45a08b6f9170
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-10-24 13:37:22 +02:00
Robert Loehning
c46eec096f QStateMachine: Don't scream at the user
Change-Id: I171606d10985bc7338b0f24ceb142fc0d88e7932
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2019-10-24 10:26:03 +02:00
Qt Forward Merge Bot
4158de330d Merge "Merge remote-tracking branch 'origin/5.13' into 5.14" 2019-10-24 10:25:37 +02:00
Qt Forward Merge Bot
b327807c5e Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	src/corelib/io/qstandardpaths_unix.cpp
	src/corelib/tools/qsharedpointer_impl.h
	tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp

Change-Id: Iae95c5778dc091058f16f6db76f04a0178a9e809
2019-10-24 10:23:44 +02:00
Eirik Aavitsland
03717be788 Fix: confusion in QImage paintEngine creation on shared images
During the creation of a raster paint engine in QImage::paintEngine(),
the QImage will be detached. At least old gcc versions would get
confused so that the newly created paintengine would end up in the old
QImage copy insteads of the newly detached one. Work around by
dropping the temporary engine pointer.

Fixes: QTBUG-79383
Change-Id: I27b1f24312269bc2bcc641dc4334397a92e3bfbb
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-10-24 08:56:21 +02:00
Qt Forward Merge Bot
563dc21c51 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ic062a5bd62621877b17cc0d47303b3c879241385
2019-10-22 01:00:49 +02:00
Eskil Abrahamsen Blomfeldt
5205510524 Enable cursor in ligature test on Windows
The default font on Windows ("Times" is not found) does not have
a ligature for "fi", so the test would not actually be testing
what it was supposed to on this platform, and would pass even
when the code was buggy.

To enable the test on Windows, we select a standard font which
has the ligature (Calibri).

Change-Id: Ic117cd8e549aa729a0cd68006d7c180c6c89c053
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-21 09:01:26 +02:00
Qt Forward Merge Bot
84db112fe2 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I69f44ea7254cb2643a00b040bbb46f41b7f76a87
2019-10-19 01:00:45 +02:00
Johan Klokkhammer Helsing
52484cc4b6 Widget tests: Skip tests that fail on Wayland
Either by testing for platform name or window activation.

After this gets in, we can enable widget tests in the Wayland bot, which
hopefully will reduce the number of regressions in the Wayland plugin.

Fixes: QTBUG-62188
Change-Id: I71ce8abd6b5891e5b953126b1c35345892585931
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-10-18 10:53:34 +02:00
Eirik Aavitsland
19f29802bf Fix: QPainter off-by-one clipping for some non-integer scalings
For some scalings, setClipRect(QRect) would produce a clip one pixel
different from setClipRect(QRectF) because of different
rounding. Ditto for setClipRegion. Fix by making sure to transform
QRectFs instead of QRects.

Fixes: QTBUG-78962
Fixes: QTBUG-78963
Change-Id: I0be721133858c30769ec6d81e978962a3d6b70cf
Reviewed-by: Christoph Cullmann <cullmann@kde.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-10-18 06:11:39 +00:00
Qt Forward Merge Bot
dce8849037 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I4fbbf100b673ab100997dbf2f42bf195dc3c050f
2019-10-18 01:00:35 +02:00
Frederik Gladhorn
328122dddd tst_qiconhighdpi: fix target name
CMake will complain that we have a duplicate test name otherwise.
Generally it makes a lot of sense to name the test binary the same as
the test itself.

Change-Id: I27c4b51e6a2869f025e1100f1a9dd6b54ebdaf55
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Morten Kristensen <me@mortens.dev>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2019-10-17 16:44:51 +02:00
Johan Klokkhammer Helsing
4b5ff2be7c QGraphicsView tests: Prefer exposed over active
Makes the tests pass on Wayland.

Task-number: QTBUG-62188
Change-Id: I5860c1ae6dd3d15632d827f4e357cb6c2cc9c5e3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-17 13:12:17 +02:00
Johan Klokkhammer Helsing
ee4a604a2e tst_qdialog: Wait for exposed instead of active
This makes the test pass on Wayland.

Task-number: QTBUG-62188
Change-Id: Ib67cf8913055bbe753f71791095aff035342c18d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-17 13:12:12 +02:00
Samuel Gaist
c222a9283d QAbstractItemModel: implement QRegularExpression support for match
This is part of the migration of qtbase from QRexExp to
QRegularExpression.

[ChangeLog][QtCore][QAbstractItemModel] The match() method now
supports the new Qt::RegularExpression match flag value. This
will allow users to use either a string or a fully configured
QRegularExpression when doing searches. In the second case,
the case sensitivity flag will be ignored if passed.

Task-number: QTBUG-72587
Change-Id: I07c8d72a661c48b7f4fcf13ef8e95980bcdcb998
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-10-16 21:53:30 +02:00
Eirik Aavitsland
ea377c5a2f Add testing of fillRect() to QPainter lancelot test
Change-Id: I3be230d3fafa178a37cf7387f79f372c8d8aeb05
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-10-16 06:31:59 +00:00
Christian Ehrlicher
78d349eaab tst_QSqlQuery: remove tests commented out a long time ago
Remove some code which was commented out with 'NOT_READY_YET' since the
initial Qt5 import. Since the mentioned bug reports are no longer
available remove this code.

Change-Id: I98686e53d85619f01d16105d147eba79b557a104
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-10-16 08:25:38 +02:00
Johan Klokkhammer Helsing
821c2eb131 tst_qfiledialog2: Don't assume window activation is available
Prefer qWaitForWindowExposed over qWaitForWindowActive whenever possible, skip
in the other cases.

Makes the test pass on Wayland.

Task-number: QTBUG-62188
Change-Id: I60b4000c72c3727a2f33b79a5038469055b0fef2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-16 07:06:12 +02:00
Johan Klokkhammer Helsing
8814c5778d tst_QAbstractScrollArea: Use qWaitForWindowExposed instead of active
Makes the test pass on Wayland.

Task-number: QTBUG-62188
Change-Id: I53011ad623e4bdb557d79c136f06ce7ac00a08ee
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-16 07:03:09 +02:00
Qt Forward Merge Bot
faab18c65a Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ifd83db69416230175ddc3161f640b612755018fc
2019-10-16 01:00:49 +02:00
Johan Klokkhammer Helsing
80ddac3a0a tst_qgraphicseffect: Wait for exposed instead of active
Makes the test pass on Wayland.

Task-number: QTBUG-62188
Change-Id: I3900925e74d8d940a8c5af87ea64a6ec3c8c3293
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-15 20:39:32 +02:00
Sona Kurazyan
9cc040a806 Prepare for deprecating the QDesktopWidget
QDesktopWidget is marked as obsolete in docs, but it is not yet
completely deprecated, some of its methods are still in use.

Replace uses of the following methods marked as obsolete:
- QDesktopWidget::screenNumber(QWidget*) -> QWidget::screen()
- QDesktopWidget::screenGeometry(QWidget*) -> QWidget::screen()->geometry()
- QDesktopWidget::availableGeometry(QWidget*) -> QWidget::screen()->availableGeometry()

Task-number: QTBUG-76491
Change-Id: I2cca30f2b4caa6e6848e8190e09f959d2c272f33
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-15 20:09:29 +02:00
Christian Ehrlicher
ed7dd9a6ed QODBC: Fix crash when a prepared statement is deleted after the db was removed
When a prepared statement is still alive after the database was removed
with QSqlDatabase::removeDatabase(), the cleanup routine is trying to
access the driver which is no longer alive which results in a crash.

Fixes: QTBUG-79019
Change-Id: I4630e3b947a12b23ed062f015abc373fc0e246c1
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2019-10-15 13:37:42 +02:00
Friedemann Kleint
05a829f923 Win32: Consolidate registry code
Add a RAII class for registry keys and use it throughout
the code base.

Change-Id: I666b2fbb790f83436443101d6bc1e3c0525e78df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-10-14 20:26:42 +02:00
Johan Klokkhammer Helsing
332c255c69 tst_qgraphicsitem: Skip tests that fail on Wayland
Task-number: QTBUG-62188
Change-Id: If0638d51bffa6ef375476c0a601c387bd05583ae
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-10-14 14:06:32 +02:00
Sona Kurazyan
ffac899576 Fix the size calculation of QHeaderView when stylesheet is used
When calculating the header section size based on its contents when a
stylesheet is used, the size hints from the stylesheet are used. In case
if the stylesheet specifies only one of the sizes, the other is set to
-1. Because of this the actual content size is ignored.

The solution is to calculate the size based on the application style, in
case if it's not specified in the stylesheet.

Fixes: QTBUG-75615
Change-Id: I3453fa623d75b6b32832edf753de6e3e4e7f5a22
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-10-14 10:17:07 +02:00
Johan Klokkhammer Helsing
df91ff5551 tst_qgraphicsitem: Don't assume window activation is available
Some windowing systems (i.e. Wayland) do not allow applications to steal window
focus.

Normally, we would just replace qWaitForWindowActive with
qWaitForWindowExposed, because that is usually the intent, in this test
however, there are many occurrences of both variants right after each other.
And, as described in the commit message of 153e8b49a, this may be because
window activation may cause repaints, and we want to wait for it to reduce
the chance of receiving an extra repaint later (possibly causing tests to be
racy).

Therefore, I took the conservative approach, and kept the qWaitForWindowActive
calls, except when the capability is not available. Hopefully this will not
cause flakiness in existing platforms, while also allowing tests to pass on
platforms where activation is not supported.

Task-number: QTBUG-62188
Change-Id: I15502baa28c464a808d585a5e6d67c9b745b17ae
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-14 08:39:31 +02:00
Sona Kurazyan
66a9c4b0b2 Remove usages of deprecated APIs of QDesktopWidget
- Replaced the usages of the following deprecated APIs:
  * QDesktopWidget::screenCount() -> QGuiApplication::screens().size()
  * QDesktopWidget::screenGeometry(int) -> QGuiApplication::screens().at()
  * QDesktopWidget::screenNumber(QPoint) -> QGuiApplication::screenAt(QPoint)

- Added notes for the QWidget *QDesktopWidget::screen(int), which
currently has no replacement.

- Fixed the tests to build conditionally, only when these APIs are
enabled.

Task-number: QTBUG-76491
Change-Id: I2fdec96d0a6a4fc782c53549b05a5556412b8305
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-10-13 13:08:42 +02:00
Qt Forward Merge Bot
8d8140dffa Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I9953c1ca16862184c2373027e946c482ce8e6f0e
2019-10-13 01:00:43 +02:00
Christian Ehrlicher
b43f5ed2da QMYSQL: remove support for MySql 4.x
MySql 5.0 was released 2005 so it's time to remove support for MySql 4.x
14 years later.

[ChangeLog][QtSql][QMYSQL] Removed support for MySql < 5.0 since 5.0 was
released 14 years ago.

Change-Id: I45005accdffefbd9338ac0e710512a4c7ea8e09e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2019-10-12 08:31:01 +02:00
Samuli Piippo
55427858e3 QStandardPaths: Correct handling for XDG_RUNTIME_DIR
Always try to create the runtime directory and never change
the permissions of an existing directory. Conform to the
XDG Base Directory Specification:

"If, when attempting to write a file, the destination directory
is non-existent an attempt should be made to create it with
permission 0700. If the destination directory exists already
the permissions should not be changed."

Fixes: QTBUG-68338
Change-Id: Iaf854d69225fc46e43abae86232d749e5c247df0
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-10-12 08:57:35 +03:00
Andre de la Rocha
31012df705 Fix QGraphicsScene::update() performance
A previous fix has caused a performance degradation while adding a
check for avoiding adding duplicated rectangles to the update list.
This patch fixes it by using a std::set instead of a QList, avoiding
duplication while using an O(log N) operation, instead of the O(N)
used before.

Fixes: QTBUG-77952
Change-Id: Ifa9fbf110e0bad60ee02a42d91281981fd98ceab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-10-11 16:53:23 +02:00
Milian Wolff
014d7ac654 Q{Shared,Weak}Pointer: Reduce overload sets in implicit conversions
Only allow implicit conversions when the types involved are compatible.
That means, only allow construction and copy assignment when the type
X* is convertible to type T*. This is done using SFINAE and the
std::is_convertible type trait, which makes the previous
QSHAREDPOINTER_VERIFY_AUTO_CAST obsolete.

This patch fixes compilation when a function is overloaded with
Q{Shared,Weak}Pointer of different, incompatible types. Previously, this
resulted in a compilation error due to an ambiguous overload.

Change-Id: I069d22f3582e69842f14284d4f27827326597ca2
Fixes: QTBUG-75222
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-10-11 16:53:23 +02:00
Volker Hilsheimer
1748dc3e2d QGroupBox: always disable children in a checkable, unchecked groupbox
The childEvent handler sets the enabled property of children as they are
added to the groupbox, but applications might later enable children and
check/uncheck the groupbox's checkbox in undefined order. In that case,
we would end up with enabled children inside a conceptually disabled
groupbox (the groupbox's checkbox represents the logical "disabled"
state), which breaks documented QWidget::enabled rules.

To make sure that all children are disabled as per the state of the
groupbox, we need to run that logic once the UI has been set up, and
before it becomes visible. This is what polishing is for, so listen
for that event in addition and handle it the same way as adding (which
duplicates things, but keeps existing code that might depend on things
being updated as they are added working).

Adds the case to the existing enabledChildPropagation test case.

[ChangeLog][QWidget][QGroupBox] Always disable children of a checkable,
unchecked group box before showing.

Change-Id: I978bd27b6f1a3f54ec745faeea529a98d0d93619
Fixes: QTBUG-25938
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-10-11 13:53:49 +02:00
Eirik Aavitsland
c54083ff93 Fix QEasingCurve possible imprecision at endpoints
Both the spline curves and (most of) the predefines curves are defined
as having start value 0.0 and end value 1.0. The spline and In/OutBack
functions would sometimes not produce that result precisely, so code
could not reliably depend on expressions like (easedValue < 1.0)
becoming false. Fix by explicitly handling endpoints.

Fixes: QTBUG-76781
Fixes: QTBUG-72630
Change-Id: I21be43af469a76c090154bffef8406a9baf2d0b1
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2019-10-11 12:29:27 +02:00
Edward Welbourne
60deb69034 Distinguish invalid datetimes from others
A default-constructed QDateTime is invalid, but compared equal to a
valid one referencing the start of 1970.  This lead to date properties
in QML being initialized invalid but not getting an onChange if the
first value they're set to is the start of 1970.

Fixing that then lead to some tests failing. Indeed, the original
equality check involved using toMSecsSinceEpoch(), whose value is
undefined unless the datetime is valid, without a prior check on its
validity: so ensure all uses of toMSecsSinceEpoch() are guarded with
isValid() checks.

Reworked tst_QDateTime::toSecsSinceEpoch() to use its bool column
(previously unused, after separating from toTime_t(), which uses this
column for "out of time_t's range") for validity of the datetime.

[ChangeLog][QtCore][QDateTime] Invalid datetimes are now treated as
equal and less than all valid ones. They could previously be found
equal to valid datetimes.

Fixes: QTBUG-79006
Change-Id: Ie72deb8af4350a5e808144d0f6e42dc8eb3ff5ef
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-10-11 11:59:41 +02:00
Mårten Nordheim
d79726e9eb Win: QUdpSocket: Use QVarLengthArray for retrieving size
Increased size of the peek buffer to 2048 from 1500 and now
uses QVarLengthArray with space for 10 stack-allocated WSABUF instances,
but still growing at the pace of 5.

In benchmarking (created for and included in this patch) this shows
better performance when retrieving the datagram size for larger
datagrams, and the same performance as before for smaller datagrams
(at the cost of 2048 - 1500 + 16 * 10 = 708 bytes extra stack space).

Benchmarks:

With changes:

********* Start testing of tst_QUdpSocket *********
Config: Using QtTest library 5.13.1, Qt 5.13.1 (x86_64-little_endian-llp64 shared (dynamic) release build; by MSVC 2019)
PASS   : tst_QUdpSocket::initTestCase()
PASS   : tst_QUdpSocket::pendingDatagramSize(52)
RESULT : tst_QUdpSocket::pendingDatagramSize():"52":
     0.0038 msecs per iteration (total: 63, iterations: 16384)
PASS   : tst_QUdpSocket::pendingDatagramSize(1024)
RESULT : tst_QUdpSocket::pendingDatagramSize():"1024":
     0.0039 msecs per iteration (total: 64, iterations: 16384)
PASS   : tst_QUdpSocket::pendingDatagramSize(2049)
RESULT : tst_QUdpSocket::pendingDatagramSize():"2049":
     0.0038 msecs per iteration (total: 63, iterations: 16384)
PASS   : tst_QUdpSocket::pendingDatagramSize(4500)
RESULT : tst_QUdpSocket::pendingDatagramSize():"4500":
     0.0039 msecs per iteration (total: 64, iterations: 16384)
PASS   : tst_QUdpSocket::pendingDatagramSize(4098)
RESULT : tst_QUdpSocket::pendingDatagramSize():"4098":
     0.0040 msecs per iteration (total: 66, iterations: 16384)
PASS   : tst_QUdpSocket::pendingDatagramSize(8192)
RESULT : tst_QUdpSocket::pendingDatagramSize():"8192":
     0.0040 msecs per iteration (total: 67, iterations: 16384)
PASS   : tst_QUdpSocket::pendingDatagramSize(12000)
RESULT : tst_QUdpSocket::pendingDatagramSize():"12000":
     0.010 msecs per iteration (total: 90, iterations: 8192)
PASS   : tst_QUdpSocket::pendingDatagramSize(25000)
RESULT : tst_QUdpSocket::pendingDatagramSize():"25000":
     0.021 msecs per iteration (total: 88, iterations: 4096)
PASS   : tst_QUdpSocket::pendingDatagramSize(32768)
RESULT : tst_QUdpSocket::pendingDatagramSize():"32768":
     0.033 msecs per iteration (total: 69, iterations: 2048)
PASS   : tst_QUdpSocket::pendingDatagramSize(64512)
RESULT : tst_QUdpSocket::pendingDatagramSize():"64512":
     0.088 msecs per iteration (total: 91, iterations: 1024)
PASS   : tst_QUdpSocket::cleanupTestCase()
Totals: 12 passed, 0 failed, 0 skipped, 0 blacklisted, 3090ms
********* Finished testing of tst_QUdpSocket *********

Without changes:

********* Start testing of tst_QUdpSocket *********
Config: Using QtTest library 5.13.1, Qt 5.13.1
(x86_64-little_endian-llp64 shared (dynamic) release build; by MSVC 2019)
PASS   : tst_QUdpSocket::initTestCase()
PASS   : tst_QUdpSocket::pendingDatagramSize(52)
RESULT : tst_QUdpSocket::pendingDatagramSize():"52":
     0.0039 msecs per iteration (total: 65, iterations: 16384)
PASS   : tst_QUdpSocket::pendingDatagramSize(1024)
RESULT : tst_QUdpSocket::pendingDatagramSize():"1024":
     0.0039 msecs per iteration (total: 65, iterations: 16384)
PASS   : tst_QUdpSocket::pendingDatagramSize(2049)
RESULT : tst_QUdpSocket::pendingDatagramSize():"2049":
     0.0040 msecs per iteration (total: 66, iterations: 16384)
PASS   : tst_QUdpSocket::pendingDatagramSize(4500)
RESULT : tst_QUdpSocket::pendingDatagramSize():"4500":
     0.0040 msecs per iteration (total: 67, iterations: 16384)
PASS   : tst_QUdpSocket::pendingDatagramSize(4098)
RESULT : tst_QUdpSocket::pendingDatagramSize():"4098":
     0.0040 msecs per iteration (total: 67, iterations: 16384)
PASS   : tst_QUdpSocket::pendingDatagramSize(8192)
RESULT : tst_QUdpSocket::pendingDatagramSize():"8192":
     0.010 msecs per iteration (total: 90, iterations: 8192)
PASS   : tst_QUdpSocket::pendingDatagramSize(12000)
RESULT : tst_QUdpSocket::pendingDatagramSize():"12000":
     0.010 msecs per iteration (total: 90, iterations: 8192)
PASS   : tst_QUdpSocket::pendingDatagramSize(25000)
RESULT : tst_QUdpSocket::pendingDatagramSize():"25000":
     0.033 msecs per iteration (total: 69, iterations: 2048)
PASS   : tst_QUdpSocket::pendingDatagramSize(32768)
RESULT : tst_QUdpSocket::pendingDatagramSize():"32768":
     0.0502 msecs per iteration (total: 103, iterations: 2048)
PASS   : tst_QUdpSocket::pendingDatagramSize(64512)
RESULT : tst_QUdpSocket::pendingDatagramSize():"64512":
     0.13 msecs per iteration (total: 70, iterations: 512)
PASS   : tst_QUdpSocket::cleanupTestCase()
Totals: 12 passed, 0 failed, 0 skipped, 0 blacklisted, 3192ms
********* Finished testing of tst_QUdpSocket *********

Fixes: QTBUG-78275
Change-Id: If86a226620244aa4e470600c6c1db4a7863b5617
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-10-11 11:36:16 +02:00
Frederik Gladhorn
afb82ef5be Merge 5.13 into 5.13.2
Change-Id: Id8852e90bfc5e4bd3e344435195992c5c7a0ab86
2019-10-11 09:54:09 +02:00
Shawn Rutledge
f1dd6addda Make QTextBlockFormat::MarkerType an enum class
This came up during API review.

Change-Id: I9198e1eb96db0c21e46a226a032919bb62d3ca66
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-10-10 21:08:08 +02:00
Christian Ehrlicher
95717ea834 tst_QAbstractItemView: cleanup
Cleanup QAbstractItemView autotest:
 - use range-based for loops
 - use nullptr
 - use member initialization
 - use new signal/slot syntax
 - use static invocations
 - use override
 - replaced QCoreApplication::processEvents with
   QTRY_VERIFY/QTRY_COMPARE

Change-Id: Iba91811db6fb925364fc88ec36357e758b937329
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-10-10 18:08:36 +02:00
Frederik Gladhorn
5e421957de Fix strange qmake syntax
It seems like qmake is happy with the comment, followed by a
continuation and then another comment, but having the continuation at
the end of the line makes more sense.
This will make it easier to port to CMake.

Change-Id: I20c964e8c3b6fea4745095783503045b191b000b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-10 16:57:37 +02:00
Timur Pocheptsov
9845c06d1f DTLS auto-test(s) - fix a buggy logic with pending datagrams
Fixes: QTBUG-79128
Change-Id: Ifebd5b056541b7732b15b5cf063ad22ab754a64c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-10-10 11:28:24 +02:00
Liang Qi
9c84b7786c Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	src/plugins/platforms/xcb/qxcbscreen.h
	src/src.pro

Change-Id: I4e1981e69a1ddcbe4078ec6ab2a64b0da6a445de
2019-10-10 09:13:49 +02:00
Qt Forward Merge Bot
68375b4f3d Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Iadeca81f499d6b19e86ceae1edd7960db2575e90
2019-10-10 09:10:27 +02:00
Robert Loehning
d6734e8ab7 Fuzzing: Don't copy input data to QByteArray
Change-Id: I603413805dca46a85709c2ab6ff573687849572e
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2019-10-09 17:16:09 +02:00
Laszlo Agocs
b62b80706e rhi: Autotest for rendering a triangle into a window
Change-Id: Id1562ff8cf7c6bc7e5bd147bb628f3d9dd57f2b5
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-10-09 17:15:06 +02:00
Laszlo Agocs
df0b1836b5 rhi: Autotest rendering with uniform buffer
Change-Id: I4251f31494680c78e90a08a2b471cb1af08ecd81
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-10-09 17:15:06 +02:00
Laszlo Agocs
b2de7f8583 rhi: Autotest rendering a textured quad
Task-number: QTBUG-78971
Change-Id: I0e7e0f3c00f9509031f7b4a8a389e51c915f01c2
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-10-09 17:15:06 +02:00
Laszlo Agocs
8f44da1f55 rhi: Enable the qrhi autotest on WinRT
There is no onscreen support for WinRT in the D3D11 backend yet.
However, offscreen operations (rendering into a texture) should work.
One catch is that there is no D3DCompile available for deployed WinRT
apps. So ship the intermediate format (DXBC output from fxc) in the
.qsb files.

Change-Id: Ic0aba4b817c27d13dcf3af41bf7612d799382655
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-10-09 17:15:05 +02:00
Laszlo Agocs
dd105fab8d rhi: Autotest rendering a triangle
Also improve (docs and runtime checks) and test the minimum set
of required data to create a graphics pipeline.

Task-number: QTBUG-78971
Change-Id: If5c14f1ab1ff3cf70f168fde585f05fc9d28ec91
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-10-09 17:15:05 +02:00
Laszlo Agocs
9baf69c765 rhi: gl: Add a feature flag for reading back non-zero mip levels
The joys of "level - Specifies the mipmap level of the texture
image to be attached, which must be 0." for glFramebufferTexture2D
in OpenGL ES 2.0.

Change-Id: Iaf19502f48d7ba73b26abb72535bfa6696a1e182
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-10-09 17:15:05 +02:00
Laszlo Agocs
9c466946d0 rhi: Autotest basic texture operations
...and make the Null backend able to deal with these, for RGBA8 textures
at least. Naturally it is all QImage and QPainter under the hood.

Also fix a bug in the OpenGL backend, as discovered by the autotest:
the size from the readback did not reflect the mip level.

Task-number: QTBUG-78971
Change-Id: Ie424b268bf5feb09021099b67068f4418a9b583e
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-10-09 17:15:05 +02:00
Laszlo Agocs
89ec1b3618 rhi: Add support for buffer readbacks
This also marks the beginnings of significantly extending autotesting
of the resource and rendering functionality in QRhi.

Also involves fixing up the buffer operation lists like we did
for textures before. This is to ensure updates and reads on the
same batch execute in the correct order. So just have two lists:
one with buffer, one with texture operations.

Also simplify the struct layouts. No need for those inner structs
with many duplicate members. This reduces the size even, since using a
union was never an option here. Also switch to a VLA, the size is around
253 KB per batch.

The Null backend now keeps track of the QRhiBuffer data so it can return
valid results in readbacks.

Task-number: QTBUG-78984
Task-number: QTBUG-78986
Task-number: QTBUG-78971
Task-number: QTBUG-78883
Change-Id: I9694bd7fec523a4e71cf8a5c77c828123ebbb3bd
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-10-09 15:15:05 +00:00
Laszlo Agocs
4a3ee77f65 rhi: Exercise nativeHandles() in qrhi test
Task-number: QTBUG-78971
Task-number: QTBUG-78972
Change-Id: Ibce10caf1ccd74ae7efead9579f4a4342ef896b8
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-10-09 17:15:05 +02:00
Lars Knoll
ba26496647 Don't crash when calling jumpToFrame() on an empty QMovie
Properly return an invalid frame when calling jumpToFrame()
with a non existent frame number.

Fixes: QTBUG-79029
Change-Id: Ic40f4a6de3106fab42c0bb6c961194be47b04e31
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-10-09 15:58:26 +02:00
Edward Welbourne
61ec1abc08 Suppress deprecation warnings on a test of a deprecated QString method
QString::fromAscii() is deprecated since 5.0 but still tested.
So suppress deprecations for its code.

Change-Id: Ic048a843c43551021da39a16d94c3222201573dc
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2019-10-09 11:18:22 +02:00
Qt Forward Merge Bot
74858dc4af Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I03d82c5bc47908a97e7a908d7e67a7301b28d8cb
2019-10-09 01:00:42 +02:00
Robert Loehning
af8f3c5da4 Add libfuzzer test for QTextLayout::beginLayout()
Task-number: QTBUG-77819
Change-Id: I34e9cbaa615896222bcf947012cfed9f6c3186c7
Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>
2019-10-07 15:40:34 +02:00
Mårten Nordheim
3dd8f6dc34 Schannel: no longer keep old ssl errors around when reusing socket
And add a test for it so it can no longer happen in any current or
future implementation.

Change-Id: I3214aa90595e291b1e1c66befe185cfe1ea7bc6b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-10-07 11:34:39 +02:00
Qt Forward Merge Bot
327b305e95 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I554a2762890391b3b6013c8b82211a8386a4ced8
2019-10-05 01:01:06 +02:00
Simon Hausmann
da284ef10e Add support for machine-readable JSON output to the MOC
The --output-json parameter will make moc produce a .json file next to
the regular output file. With --collect-json the .json files for a
module can be merged into a single one.

Task-number: QTBUG-68796
Change-Id: I0e8fb802d47bd22da219701a8df947973d4bd7b5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-10-04 18:35:29 +02:00
Christian Ehrlicher
64473c9320 tst_QColumnView: cleanup
Cleanup QColumnView autotest:
 - use range-based for loops
 - use nullptr
 - use member initialization
 - use new signal/slot syntax
 - use static invocations
 - use override

Change-Id: Iae94e9074b65cca1e4d9eb199ea2b13e0cfa2880
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-10-04 15:36:39 +02:00
Tor Arne Vestbø
0768a28fbf Remove CFBundleGetInfoString from Info.plist templates
Is't been deprecated since Mac OS X 10.5.

Task-number: QTBUG-74872
Change-Id: I8b1ad7aca6448883cb164fd0c4b329592ca60548
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-04 13:09:34 +00:00
Robert Loehning
de182ea0be Add libfuzzer test for QTextDocument::setMarkdown()
Change-Id: I729d4a3bb276523011a6f17a800e72aa34540e47
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-10-04 14:47:59 +02:00
Qt Forward Merge Bot
3a1613c227 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I43393cf47675fd6c14972df1221986335c6f493c
2019-10-04 01:01:48 +02:00
Joerg Bornemann
5ab8efd66a Make conflicting targets check less strict
People tend to "turn off debug and release builds" by just not building
one of the variants. For example, Qt's own rcc is built in release only,
however it is configured for debug_and_release with the same TARGET for
both.

Let qmake complain about conflicting TARGETs only we're about to build
all of those conflicting targets, i.e. if build_all is set.

Change-Id: I0448bf5cb421e2d801d3cc30e0d80353fba0d999
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-10-03 20:28:03 +02:00
Simon Hausmann
dcecaeb7b9 Prospective fix to stabilize tst_qwindow::isActive() on Windows 10
It is conceivable that during the try-compare loop of processing
windowing system events we loose and regain the focus. That would
explain the occasional test failure where instead of the expected 3
focus in events, we have received four.

Task-number: QTBUG-77769
Change-Id: I2221440d09a74d4d18a72f7786232b4491cf45a8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 56f084781e)
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-10-03 15:09:16 +00:00
Edward Welbourne
d448f2ecb8 Correct handling of -qfloat16(0)
It is finite and normal; it classifies as a zero; and it should not be > qfloat16(0).
Added tests to match.

Change-Id: I7874fb54f622b4cdf28b0894050ad3e75cf5d77c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-10-03 16:30:40 +02:00
Edward Welbourne
b4efdd3769 Reorganise the qfloat16 auto-test
Its limits() test was rather large and had some overlap with an older
qNan() test, that needed some clean-up (it combined qfloat16 values
with double and float values in ways that caused qfloat16 to be
promoted to another type, so we weren't testing qfloat16).

Renamed the qNan() test to qNaN(), separated out the parts of it that
actually tested infinity. Moved various parts of limits() to these and
rationalised the result. Split out a properties() test from limits()
for the properties of the qfloat16 type that are supplied by its
numeric_limits. Split out a data-driven finite() test to cover some
repeated code that was in limits() and extended it to test more
values. Added more tests of isNormal().

Fixed my earlier UK-ish spelling of "optimise", in the process, and
identify the processor rather than the virtualization as the context
where the compiler errs.

Change-Id: I8133da6fb7995ee20e5802c6357d611c8c0cba73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-10-03 11:09:47 +02:00
Laszlo Agocs
f1c7814a55 rhi: Remove QVectors from the data description structs as well
As usual, keep some QVector overloads around to allow Qt Quick to compile.

Color attachments and vertex input bindings get an at(index) type of
accessor, unlike any other of similar lists. This is because there the
index is significant, and sequential iteration is not the only type of
operation that is performed. Sometimes a lookup based on an index will
be needed as well.

Task-number: QTBUG-78883
Change-Id: I3882941f09e94ee2f179e0e9b8161551f0d5dae7
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-10-03 09:37:48 +02:00
Mårten Nordheim
6e203824a2 Move away from recently deprecated HTTP2 attributes
Amends f59f67287f

Change-Id: I74045c558e9d20f9f45f150a91f181a04e9b8c69
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-10-01 18:40:29 +02:00
Qt Forward Merge Bot
8791a8398a Merge "Merge remote-tracking branch 'origin/5.14' into 5.15" 2019-10-01 11:47:42 +02:00
Simon Hausmann
56f084781e Prospective fix to stabilize tst_qwindow::isActive() on Windows 10
It is conceivable that during the try-compare loop of processing
windowing system events we loose and regain the focus. That would
explain the occasional test failure where instead of the expected 3
focus in events, we have received four.

Task-number: QTBUG-77769
Change-Id: I2221440d09a74d4d18a72f7786232b4491cf45a8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-01 11:47:37 +02:00
Qt Forward Merge Bot
4e40c54a3c Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I77ba01f09b3dbcaf13cb265a70d9da661c32a61f
2019-10-01 01:01:20 +02:00
Laszlo Agocs
7000b66f7e Remove QVector in the API of QRhiResource subclasses
Forcing users to go through a QVector, when in practice they almost
always want to source the data from an initializer list, a QVarLengthArray,
or a plain C array, is not ideal. Especially since we can reason about
the maximum number of elements in the vast majority of use cases for all
the affected lists. QRhiResource is also not copyable so we do not need
the usual machinery offered by containers. So switch to a
QVarLengthArray.

Note that a resource is not a container. The only operations we are
interested in is to be able to source data either via an initializer
list or by iterating on something, and to be able to extract the data,
in case a user wishes to set up another resource based on the existing
one.

In some cases a QVector overload is kept for source compatibility with
other modules (Qt Quick). These may be removed in the future.

Also do a similar QVector->QVarLengthArray change in the srb-related
data in the backends.

Change-Id: I6f5b2ebd8e75416ce0cca0817bb529446a4cb664
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-09-30 20:07:43 +02:00
Liang Qi
6f9a215cc4 Merge "Merge remote-tracking branch 'origin/5.13' into 5.14" 2019-09-30 20:07:25 +02:00
Edward Welbourne
4bd6cd1992 Featurize support for signaling NaN
One of our compilers for emscripten coerces all signaling NaNs to
quiet ones, so won't do any actual signaling. Anyone relying on them
to do so shall be disappointed, so it's better that they know about it
at compile-time - or, at least, have the ability to find it out.

Put the signaling NaN producers (and remaining (test) code using them)
under the control of a feature that's disabled when numeric_limits
claims double has no signaling NaN. Assume the bootstrap library
doesn't need signaling NaNs. Sadly, until C++20 <bit>, there's no
contexpr way to test that alleged signalling and quiet NaNs are
actually distinct.

Added some auto-tests for signaling NaN, including that it's distinct
from quiet NaN. Any platform on which the last fails should disable
this feature.

Task-number: QTBUG-77967
Change-Id: I57e9d14bfe276732cd313887adc9acc354d88f08
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2019-09-30 20:05:42 +02:00
Liang Qi
99cdd5fc67 Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	src/corelib/global/qrandom.cpp
	src/corelib/io/qfileinfo.cpp
	src/corelib/kernel/qeventdispatcher_win.cpp
	src/corelib/kernel/qeventdispatcher_win_p.h
	src/gui/text/qfontdatabase.cpp
	src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
	src/plugins/platforms/windows/qwindowsglcontext.cpp
	src/testlib/qtestcase.cpp

Done-With: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Done-With: Edward Welbourne <edward.welbourne@qt.io>
Change-Id: I4893212471aa24be804c989a581810e2f714545c
2019-09-30 14:43:02 +02:00
Laszlo Agocs
86876744f0 Ensure drawable size atomicity within a frame
Revert surfacePixelSize() to be a getter only. With Metal this will
mean returning the "live" layer size (and so not the
layer.drawableSize), which is in line with what we expect with other
backends.

Instead, we leave it to the swapchain's buildOrResize() to "commit"
the size by setting drawableSize on the layer. With typical
application or Qt Quick logic this ensures that layer.drawableSize is
set once and stays static until we get to process the next resize - on
the rendering thread.

This of course would still mean that there was a race when a client
queries surfacePixelSize() to set the depth-stencil buffer size that
is associated with a swapchain. (because that must happen before
calling buildOrResize() according to the current semantics)

That can however be solved in a quite elegant way, it turns out,
because we already have a flag that indicates if a QRhiRenderBuffer is
used in combination with (and only in combination with) a
swapchain. If we simply say that setting the UsedWithSwapChainOnly
flag provides automatic sizing as well (so no setPixelSize() call is
needed), clients can simply get rid of the problematic
surfacePixelSize() query and everything works.

Task-number: QTBUG-78641
Change-Id: Ib1bfc9ef8531bcce033d1f1e5d4d5b4984d6d69f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-09-29 22:16:55 +02:00
Laszlo Agocs
cd5a0bc735 rhi: Always enable debug info printing from manual tests
It can be important to see for example the adapter enumeration that is
printed when qt.rhi.general is enabled. Make it enabled by default in
the tests.

Change-Id: I7bd073781e176d9b17b5386c548e9f8a2e16c10f
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-09-29 00:12:53 +02:00
Qt Forward Merge Bot
e8d7df4cb2 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I98086dc1584e90a24a4f90cd7b86582df047e81d
2019-09-28 01:00:51 +02:00
Friedemann Kleint
e7272ee9bd Re-enable tst_QOpenGLWindow on Win32
The test was found crashing with software rendering in Qt 5.7.

Removing the insignification revealed that there are failures
on WinRT as well, blacklist them for the moment.

Task-number: QTBUG-78802
Fixes: QTBUG-49630
Change-Id: Ib1a3efe69d7b63cdd98c6da364ab09e0e2dbdf62
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2019-09-27 20:41:55 +02:00
Christian Ehrlicher
efb9f2e1e4 tst_QListView: cleanup
Cleanup QListView autotest:
 - fix indentation
 - use QCoreApplication::sendEvent instead of QApplication::sendEvent

Change-Id: If6bb686502f6b4f2bc2dd0db52b331b2c35cf36d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-09-26 17:29:50 +00:00
Dmitry Kazakov
5839714d98 Fix QRandomGenerator initialization on AMD CPUs
Some AMD CPUs (e.g. AMD A4-6250J and AMD Ryzen 3000-series) have a
failing random generation instruction, which always returns
0xffffffff, even when generation was "successful".

This code checks if hardware random generator generates four consecutive
equal numbers. If it does, then we probably have a failing one and
should disable it completely.

Change-Id: I38c87920ca2e8cce4143afbff5e453ce3845d11a
Fixes: QTBUG-69423
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-09-26 19:52:50 +03:00
Laszlo Agocs
22d22eb282 rhi: Add a --transparent option to manual tests
This will also cause clearing to 0,0,0,0.

Essential in order to allow fast testing of window transparency
issues in combination with QRhi and the various backends.

Change-Id: Iee2763c1d06f1d3e5d59a9142abaf30fab1dc543
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-09-26 17:02:12 +02:00
Laszlo Agocs
30e27328e3 rhi: Unify handling of special cases for scissor and viewport rects
With OpenGL a scissor (or viewport) rectangle is not allowed to have a negative
width or height. Everything else is allowed. This is also the semantic we wish to
keep for QRhiViewport and QRhiScissor.

This raises some problems. For instance, when we do bottom-left - top-left
rectangle conversion, the case of partially out of bounds rects needs to be
taken into account.

Otherwise, Qt Quick ends up in wrong scissoring in certain cases, typically when
the QQuickWindow size is decreased so the content does not fit because that will
then start generating negative x, y scissors for clipping (which is perfectly
valid but the QRhi backends need to be able to deal with it)

Then there is the problem of having to clamp width and height carefully, because
some validation layers for some APIs will reject a viewport or scissor with
partially out of bounds rectangles.

To verify all this, add a new manual test, based on the cubemap one. (cubemap was
chosen because that is an ideal test scene as it fills the viewport completely, and
so it is visually straightforward when a scissor rectangle is moving around over it)

Fixes: QTBUG-78702
Change-Id: I60614836432ea9934fc0dbd0ac7e88931f476542
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-09-26 17:02:05 +02:00
Christian Ehrlicher
2431765d57 tst_QItemView: cleanup
Cleanup QItemView autotest:
 - use range-based for loops
 - use nullptr
 - use member initialization
 - use new signal/slot syntax
 - use static invocations
 - use override

Change-Id: I46edc2dc5bbaa09fb11710fa34ef4c6639181f62
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-09-25 17:19:05 +02:00
Friedemann Kleint
8810f82f3f QWizard/Aerostyle: Fix "&Next" shortcut
The fix for QTBUG-35203 set the Alt+Right shortcut on the next
button, clobbering the Alt+N shortcut from parsing the text (similar
for other languages). Add a separate shortcut for Alt+Right since a
button may not have several shortcuts.

Amends 6714196f45.

Fixes: QTBUG-78604
Change-Id: I1367da739c35fbd011d11f850c9bc3915113c644
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-09-25 15:14:36 +02:00
Mårten Nordheim
65cb6f5f29 tst_qsslsocket: Update some QSslConfiguration usage
Following the deprecation of add[Default]CaCertificate[s] let's update
the uses of it. While we're doing this, let's also use QSslConfiguration
more in some places where it makes sense.

Change-Id: I2c9e7c73fee8a405492410378f2babe67d3a3f25
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
2019-09-25 14:13:58 +02:00
Christian Ehrlicher
c5c51f442a tst_QHeaderView: cleanup
Cleanup QHeaderView autotest:
 - use range-based for loops
 - use nullptr
 - use member initialization
 - use new signal/slot syntax
 - use static invocations
 - use override

Change-Id: I4df0b46c58ae9ae9dd4d9762390a2b14886aa68f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-09-25 08:21:21 +02:00
Shawn Rutledge
06cc5d3071 Ensure that QFont::fromString() doesn't parse empty font specifications
Fixes: QTBUG-78236
Change-Id: Iba060e7a24080cdc8f317ecb6dc616b2cd918acb
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-09-24 14:38:40 +02:00
Friedemann Kleint
74179a209a Revert "BLACKLIST insert_remove_loop for msvc-2019"
The error was due to a compiler optimization bug, which is fixed
in 16.3.0.

This reverts commit 305f2c3aa6.

Fixes: QTBUG-77239
Change-Id: Idfb86ad5c3ec026518f0713c41f7ad744ab4d5db
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-09-24 10:26:00 +02:00
Oliver Wolff
f72dfdb9af Skip tst_QDateTime::systemTimeZoneChange for UWP configurations
Due to their sandboxed nature, UWP applications do not have access to
system settings like time zone.

Fixes: QTBUG-71185
Change-Id: I567a255f8adc18838fff79b81210faa094674722
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-09-24 06:18:07 +02:00
Qt Forward Merge Bot
9a09af1cb7 Merge "Merge remote-tracking branch 'origin/5.14' into 5.15" 2019-09-24 01:00:54 +02:00
Qt Forward Merge Bot
a211c240a9 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I9ec6345a38ada55219f3cdfb6bd0d6e9169fe880
2019-09-24 01:00:43 +02:00
Christian Ehrlicher
0c15cf66a4 tst_QListWidget: cleanup
Cleanup QTreeWidget autotest:
 - use range-based for loops
 - use nullptr
 - use member initialization
 - use new signal/slot syntax
 - use static invocations
 - use override

Change-Id: Ied5c0b12c0d3338469e50f3b30892557c9b4479d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-09-23 22:38:31 +02:00
Edward Welbourne
22742c5f21 Include missing shbang line in executable shell script
Change-Id: I802665c89fcac9e07e745cf6dce1a04404ae764d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-09-23 16:31:48 +02:00
Edward Welbourne
35aec918c1 Rearrange tst_QNumeric's tests for infinity and (quiet) NaN
Separate quiet NaN from infinity and expand the nan-with-payload test
to a general test that bits outside the exponent don't break qIsNan().
Generally test more thoroughly and systematically.
Tests for signalling NaN shall follow.

Change-Id: Ib35dabacc8ebcc9a0761df38f6f419f0398d0e20
Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com>
2019-09-23 14:57:48 +02:00
Rolf Eike Beer
3a4f11c0f9 tests: fix typo in comment
Spotted while grepping for 'imx'.

Change-Id: I24889929e58045d6bba8dd74f213eff3c0487c4c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-09-23 10:27:56 +02:00
Mårten Nordheim
895a786827 Fix crash when using signaldumper and sender is deleted
Testlib's signaldumper functionality would crash inside
testlib as it dereferenced the sender after it was deleted.

Change-Id: I6013b75b0a121e2768429d8a3cf0339a940314f2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-09-23 08:27:18 +00:00
Christian Ehrlicher
963941faae tst_QListView: cleanup
Cleanup QListView autotest:
 - use range-based for loops
 - use nullptr
 - use member initialization
 - use new signal/slot syntax
 - use static invocations
 - use override
 - replaced QCoreApplication::processEvents with
   QTRY_VERIFY/QTRY_COMPARE

Change-Id: I38de7fb105cd70259e60e6b05de82944bee53a54
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-09-23 09:51:14 +02:00
Christian Ehrlicher
aa6d7dd7ee QSqlDriver: deprecate one-arg notification() signal
QSqlDriver::notifcation() signal is available in two versions since Qt4
times. They are both emitted in the corresponding places which is
useless.
Therefore deprecate the one-arg version.

[ChangeLog][QtSql][QSqlDriver] The one-arg version of
QSqlDriver::notifcation() is now deprecated.

Change-Id: Ie09aa0cc952f4d854c6fb617b37b9047a3194ee3
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2019-09-21 08:13:59 +02:00
Qt Forward Merge Bot
15dc8b1d8e Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I46ec05ade1c84e61f7f45562a218aa9ff55e2975
2019-09-19 21:54:53 +02:00
Christian Ehrlicher
6234286925 tst_QTreeView: cleanup
Cleanup QTreeView autotest:
 - use range-based for loops
 - use nullptr
 - use member initialization
 - use new signal/slot syntax
 - use static invocations / replace with QTRY_foo() calls
 - use override
 - use QStyledItemDelegate

Change-Id: I0e2d023254ed9f6f5d94cebf4d4358351cc4c3e2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-09-19 18:06:22 +02:00
Christian Ehrlicher
3c59080ce9 tst_QTreeWidget: cleanup
Cleanup QTreeWidget autotest:
 - use range-based for loops
 - use nullptr
 - use member initialization
 - use new signal/slot syntax
 - use static invocations
 - use override

Change-Id: I2c07e95871d8725366cddd5cd098010709c8dc55
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-09-19 07:57:41 +02:00
Simon Hausmann
4d289edb14 Disable debug-and-release builds for MinGW
The requirement to separate debug and release DLLs on Windows stems from
the Visual Studio C run-time library appearing in two different variants
(debug and release) and not mixing well. It's possible to perform builds
without optimzations and with debug symbols while linking against the
release version of the C run-time, but at the same time the debug
version of the run-time brings other developer visible advantages.

MinGW on the other hand does not have this distinction, does not ship
with separate DLLS and does also not require the VS C runtime library.
Therefore we do not need this separation for MinGW, which means that our
packages can be reduced in size and application developers wishing to
debug their applications do not have to use debug builds of the Qt
libraries or run into Qt internal debug code.

Task-number: QTBUG-78445
Change-Id: Idf588606091298dc44262c4c89e689df18d34747
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-09-18 06:28:16 +00:00
Nils Jeisecke
4a240bb67e QTextDocument: Fix device scaling for QTextFrameFormat margins, padding and border
Those values must be scaled to device coordinates - otherwise borders,
margins etc. will be too small when rendered on high dpi devices
(printers etc.).

This change will add the scaling to those values.

QTextDocument::print applies 2cm margins to the root frame of a
unpaginated QTextDocument. Those margins were previously scaled to
device coordinates in order to give the correct result. But because
scaling is now done inside QTextDocumentLayout that scaling must be
removed and pixel values based on qt_defaultDpi are provided instead.

Fixes: QTBUG-78318
Change-Id: I6fe6dcc25f846341f6a2fe5df2f54baea473fdfd
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-09-17 23:05:09 +02:00
Qt Forward Merge Bot
73bce0411d Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I4d7f0e35f4a6ccb6d5494f947fd82fc276feadd3
2019-09-17 01:00:15 +02:00
Edward Welbourne
b26ac46c59 Add support for UTC[+-]\d+(:\d+){,2} time zone IDs
We presently only support the UTC-based offset timezones that are
listed in the CLDR; and it doesn't make sense to list more than these
in the list of available zones. However, if someone sets their TZ
environment variable to a conformant UTC-offset string, we should make
sense of it even if CLDR doesn't mention it. Only do so as final
fall-back, as backends may handle the givne name better (some such IDs
appear in the windows-compatibility list, for example).

Added tests for the new UTC-offset time-zone names.
Removed one test that relied on them not being supported.

[ChangeLog][QtCore][QTimeZone] The constructor can now handle general
UTC-offset zone names. The reported id() of such a zone shall be in
canonical form, so might not match the ID passed to the constructor.

Fixes: QTBUG-77738
Change-Id: I9a0aa68281a345c4717915c8a8fbc2978490d0aa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-09-16 17:06:28 +02:00
Edward Welbourne
1f60e587e7 Move some time-zone validity tests to where they belong
In tst_QTimeZone::isTimeZoneIdAvailable(), a block of tests of
QTimeZonePrivate::isValidId() overlapped with what
tst_QTimeZone::isValidId_data() tests; so move out of the former and
adapt to use by the latter. At the same time, check that each
allegedly available zone *is* available enough that we can create it
and it's valid.

Change-Id: I3f7c8e2e3fbfb201747c7b769d691d7f17fc6b2a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-09-16 17:06:03 +02:00
Edward Welbourne
6cee284001 Fix mis-handling of actual TLD in qIsEffectiveTLD()
If the domain passed down is an actual TLD that's the subject of a *
rule, e.g. "ck" subject to *.ck, then we were finding no dot in it and
concluding that it couldn't be the subject of a * rule.

Added a test for the specific .ck case and commented on where we could
get some canonical test data that I tripped over while researching
this. Cross-reference the cookie-jar test from the QUrl test, too.

Fixes: QTBUG-78097
Change-Id: Id858a9dae22e6b306a68df3fc199e0160f537159
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-09-16 17:05:09 +02:00
Friedemann Kleint
3a0c325bfd Brush up tst_QGraphicsItem
- Add window titles
- Introduce nullptr
- Remove unneeded C-style casts in QCOMPARE
- Replace remaining C-style casts
- Use range-based for
- Fix static invocation
- Fix class structure, add override, use member initialization
- Use Qt 5 connection syntax
- Streamline some code
- Replace some QList by QVector

Task-number: QTBUG-76497
Change-Id: I4338e2b7d397b5c4c59373b63beabd2ca1130571
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2019-09-16 13:21:19 +02:00
Tor Arne Vestbø
7f0faddf9f CoreText: Modernize style hint fallback lookup
The DefaultFontFallbacks.plist system file that we used for looking up
style fallbacks does not exists in macOS 10.15, nor did it ever exists
on iOS. Instead of relying on this file, we hard-code a set of default
families, that we then look up the fallbacks for.

The result of QFont::defaultFamily() on macOS is now:

  QFont::Helvetica --> "Helvetica"
  QFont::Times --> "Times New Roman"
  QFont::Courier --> "American Typewriter"
  QFont::OldEnglish --> ""
  QFont::System --> "Lucida Grande"
  QFont::AnyStyle --> "Lucida Grande"
  QFont::Cursive --> "Apple Chancery"
  QFont::Monospace --> "Menlo"
  QFont::Fantasy --> "Zapfino"

And on iOS:

  QFont::Helvetica --> "Helvetica"
  QFont::Times --> "Times New Roman"
  QFont::Courier --> "American Typewriter"
  QFont::OldEnglish --> ""
  QFont::System --> "Helvetica"
  QFont::AnyStyle --> "Helvetica"
  QFont::Cursive --> ""
  QFont::Monospace --> "Menlo"
  QFont::Fantasy --> "Zapfino"

Fixes: QTBUG-78240
Change-Id: Ie9bc13c9c1031d89f024199e4736a046c568a48d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-16 11:26:07 +02:00
Friedemann Kleint
d20bacbb4c tst_QWidget::translucentWidget(): Pass with High DPI scaling enabled
Since 9c8d1ca18b, the test would fail
when High DPI scaling is enabled:

FAIL!  : tst_QWidget::translucentWidget() Compared QImages differ in device pixel ratio.
   Actual   (actual): 2
   Expected (expected): 1
.\tst_qwidget.cpp(8913) : failure location

Set the device pixel ratio on the expected pixmap to fix this.

Change-Id: I517495931c2c6b1f49125bb4b5836e304bdbf545
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-09-16 10:48:52 +02:00
Qt Forward Merge Bot
1cfa636fe2 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ie24be82ee70bf103c2664de1a42741979262b10c
2019-09-16 01:00:07 +02:00
Christian Ehrlicher
6f8fc4217a tst_QTableView: cleanup
Cleanup QTableView autotest:
 - use range-based for loops where possible
 - use nullptr
 - use member initialization
 - use new signal/slot syntax
 - remove a lot of c-style casts
 - use static invocations
 - use override
 - instantiate objects on stack instead heap to avoid memleaks

Change-Id: I52fee26697b1732afa9f965e600d4c59551370ce
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-09-14 15:50:05 +02:00
Friedemann Kleint
147a8bc4c8 tst_QWindow: Remove usages of deprecated QWSI API
Use the standard testlib helpers for generating clicks and port the
remaining occurrences to the new versions of
QWindowSystemInterface::handleMouseEvent(). Similarly, fix
QWindowSystemInterface::handleTabletEvent().

Task-number: QTBUG-76491
Change-Id: I6a30957164891b56a018696606956c3cab56047f
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2019-09-14 11:39:29 +02:00
Edward Welbourne
8286daba03 MS TZ data: avoid calculating a date in year 0
There is no year 0 in the proleptic Gregorian calendar, so QDate()
won't be happy if asked for a date in it. Tweak scanning of the data
we get from MS-Win so as to avoid a date calculation that could
otherwise happen in year 0 when constructing
QDateTime(QDate(1, 1, 1), QTime(0, 0, 0), QTimeZone("Australia/Sydney")).

Added a test for this case, which Oliver Wolff has kindly verified
does reproduce the assertion failure. However, Coin is unable to
reproduce, as all its MS builds are configured with -release, so
Q_ASSERT() does nothing. (The relevant code then skips over year 0,
albeit for the wrong reasons, and gets the right results, albeit
inefficiently, leaving no other symptom by which to detect the
problem.)

Fixes: QTBUG-78051
Change-Id: Ife8a7470e5bd450bc421e89b3f1e1211756fc889
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-09-13 10:47:41 +02:00
Qt Forward Merge Bot
104f0535a1 Merge remote-tracking branch 'origin/5.13' into 5.14
Change-Id: Idcf8fc1d79bcd84b494d7f43308e6fe82d60e1a4
2019-09-13 01:00:15 +02:00
Laszlo Agocs
ef78a2e8f9 rhi: Add a flag to indicate preferring a software adapter
...if there is one and the concept is applicable in the first place.

Change-Id: Iab202c1c1cdd229f4910159de4cae7ce30805ea9
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-09-12 14:28:23 +00:00
Laszlo Agocs
f567129bb5 rhi: d3d11: Add the device lost testing machinery
The device can be lost when physically removing the graphics adapter,
disabling the driver (Device Manager), upgrading/uninstalling the
graphics driver, and when it is reset due to an error.

Some of these can (and should) be tested manually, but the last
one has a convenient, programmatic way of triggering: by triggering
the timeout detection and recovery (TDR) of WDDM. A compute shader
with an infinite loop should trigger this after 2 seconds by default.

All tests in tests/manual/rhi can now be started with a --curse <count>
argument where <count> specifies the number of frames to render before
breaking the device. Qt Quick will get an environment variable with
similar semantics in a separate patch.

Change-Id: I4b6f8d977a15b5b89d686b3973965df6435810ae
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-09-12 12:39:12 +02:00
Marc Mutz
333b1e9229 QReadWriteLock: add a check for writeOnly, too
Results on my machine:

  PASS   : tst_QReadWriteLock::writeOnly(QMutex)
  RESULT : tst_QReadWriteLock::writeOnly():QMutex:
     3,607 msecs per iteration (total: 3,607, iterations: 1)
  PASS   : tst_QReadWriteLock::writeOnly(QReadWriteLock)
  RESULT : tst_QReadWriteLock::writeOnly():QReadWriteLock:
     39,703 msecs per iteration (total: 39,703, iterations: 1)
  PASS   : tst_QReadWriteLock::writeOnly(std::mutex)
  RESULT : tst_QReadWriteLock::writeOnly():std::mutex:
     3,697 msecs per iteration (total: 3,697, iterations: 1)
  PASS   : tst_QReadWriteLock::writeOnly(std::shared_mutex)
  RESULT : tst_QReadWriteLock::writeOnly():std::shared_mutex:
     5,727 msecs per iteration (total: 5,727, iterations: 1)
  PASS   : tst_QReadWriteLock::writeOnly(std::shared_timed_mutex)
  RESULT : tst_QReadWriteLock::writeOnly():std::shared_timed_mutex:
     5,921 msecs per iteration (total: 5,921, iterations: 1)

(the 'nothing' test of course doesn't work with writing, as writing to
the same QString from different threads is UB)

Change-Id: Ia78b54963a51eaf6563ce0d243316a3337056a83
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-09-12 06:38:42 +02:00
Marc Mutz
72259e7186 Brush up QReadWriteLock benchmark
- add override
- tests C++17 shared_mutex in addition to C++14 shared_timed_mutex
- replace manual memory management with unique_ptr

Change-Id: If52df2097a4b92c10df4a7cdbb1c506d64b673e3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-09-12 06:38:23 +02:00
Qt Forward Merge Bot
dc4ecf0641 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ie69d40d2efc5559b31e28ba71f88e3cda741e051
2019-09-11 01:00:09 +02:00
Christian Ehrlicher
f5f24731ec tst_QTableWidget: cleanup
Cleanup QTableWidget autotest:
 - use range-based for loops where possible
 - use nullptr
 - use member initialization
 - use new signal/slot syntax
 - remove a lot of C-style casts
 - use static invocations
 - use override
 - instantiate objects on stack instead of heap to avoid memleaks

Change-Id: I99ed144caab88d648d5ab987ce0963fbc6f1197d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-09-10 13:36:30 +02:00
Sona Kurazyan
49362d064f Add a QSplashScreen constructor taking a QScreen
The constructor taking a QWidget is needed for specifying the screen
where the splash screen should be displayed.

Add a new constructor for specifying the target screen for the splash screen
directly, instead of "extracting" the screen information from a widget.
This removes the need for using the deprecated QDesktopWidget.

Deprecate the constructor taking a QWidget.

Task-number: QTBUG-76491
Change-Id: I1dde242ff5f7b53e52af308bb685f492d6266d33
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-09-10 07:34:03 +00:00
Assam Boudjelthia
17032c4d64 Re-add tst_selftests "crashes old stdout txt" on QEMU
The test is not failing anymore on QEMU targets.

This partially reverts commit
71bd06d516.

Fixes: QTBUG-71915
Change-Id: I68593edf0ec245e14879833c8aa90661a3c2e227
Reviewed-by: Liang Qi <liang.qi@qt.io>
2019-09-09 11:19:38 +00:00
Friedemann Kleint
1d53b6d9f2 Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp

Change-Id: Idd3ca5cb9a2b95a4c3513b2a4c8966e6f56193f1
2019-09-09 07:51:49 +00:00
Qt Forward Merge Bot
2eead078c8 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: If8e9d88771243fd9e221b49f53d7d8b111a8ce2a
2019-09-09 09:21:48 +02:00
Allan Sandfeld Jensen
89d0a03c06 Remove BT.2020 support from QColorSpace
BT.2020 is an HDR color space and its luminance range doesn't match
that of the rest of the currently available color spaces. Without
support for white-point luminance in 5.14, there would be a behavior
change when luminance support is later introduced, so it is better to
remove it now, and reintroduce it when the necessary handling of
different luminance levels is available.

Change-Id: Ie29e4dd757faae3ac91d4252e1206acce42801dc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-09-08 16:19:14 +02:00
Qt Forward Merge Bot
1f35c8caa0 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I371c5ae1af6f58e32e579671f485b92b586e0b76
2019-09-08 11:33:28 +02:00
Qt Forward Merge Bot
a9db729095 Merge remote-tracking branch 'origin/5.12.5' into 5.12
Change-Id: I41a252fdbf22551aadb0b1a6e9ecf3f95f99fbd4
2019-09-07 13:08:26 +02:00
Sona Kurazyan
14ade9c476 Fix the build of the qgraphicslayout manual test
This was accidentally introduced by
2f33e030b8 and since manual tests are not
built by default, was not discovered earlier.

Change-Id: I5cb6d5cfe0911bdb01a33014f2648a47b7a48848
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-09-06 09:57:57 +02:00
Christian Ehrlicher
a42a451339 QShortcut: call base class implementation in event()
QShortcut::event() did not call the base class implementation
QObject::event() which caused that e.g. QEvent::DeferredDelete was not
handled.
Fix it by calling QObject::event() when the event was not handled.

Fixes: QTBUG-66809
Change-Id: Ideebc980bc658f8f2b9ec4417e738bccda5eeab5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-09-05 20:41:43 +02:00
Allan Sandfeld Jensen
f92d8fd64e Combine BGR30_to_RGB30 and BGR888_to_RGB888
And let the meat of the function be shared with the rbSwap routine.

Change-Id: I0ea18b30c26ff050c17dcb3ad4d654bfbb8c6221
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-09-05 17:41:21 +02:00
Christian Ehrlicher
42011c0361 QGraphicsView: mark obsolete flag DontClipPainter as deprecated
The enum OptimizationFlag::DontClipPainter is deprecated and not used in
the code since Qt4 times. Therefore also mark it as deprecated so it can
be removed with Qt6

Change-Id: I318a55cf42e7a233d13d4ec0144e1977251f5c92
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-09-05 17:40:29 +02:00
Friedemann Kleint
d2894d968d tst_QPdfWriter: Fix deprecation warnings
Fix warnings:
tst_qpdfwriter.cpp:223:58: warning: virtual void QPdfWriter::setPageSize(QPagedPaintDevice::PageSize)’ is deprecated: Use setPageSize(QPageSize(id)) instead [-Wdeprecated-declarations]

by using the QPageSize-based API. Streamline the code by using
QPageSizeId.

Task-number: QTBUG-76491
Change-Id: I409f0e27de64bc66502a60a9109c6115f36e527d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-05 16:08:47 +02:00
Qt Forward Merge Bot
fa2589bbb5 Merge remote-tracking branch 'origin/5.13.1' into 5.13
Change-Id: Ic633850940bbe17dcedc1609217a052b6f81ce4b
2019-09-05 13:33:00 +02:00
Qt Forward Merge Bot
f3a1048b61 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I065e212f0dc115efa1ffcb14cf9f679259da6b79
2019-09-05 08:58:25 +02:00
Sona Kurazyan
43983b0b6f Remove QOperatingSystemVersion::WindowsVista
The minimum supported version is Windows 7. Remove
QOperatingSystemVersion::WindowsVista added by
b0cd007335 and replace with "true"
wherever it was used.

Change-Id: I08c0208467b655a921b6773f77d8bc099be69031
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-09-05 08:25:05 +02:00
Friedemann Kleint
e82a1d6b29 Deprecate QDirModel
Deprecate the constructors, add guards.
Use a QStandardItemModel in tst_QCompleter::setters() instead.

Task-number: QTBUG-69410
Change-Id: If77298982bb3d0b5321ae1271fab3f33b196101d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-09-04 21:27:33 +02:00
Edward Welbourne
46ec24d2b9 Rename calendar methods from m{in,ax} to m{in,ax}imum
Words should not be abbreviated.
Split a long line and reflowed some comments in the process.

Fixes: QTBUG-78008
Change-Id: I52d75409f02e2cecbed3e94d424617ad594c275b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-09-04 18:43:35 +02:00
Tor Arne Vestbø
c3e0e7a3eb Limit QColorSpacePrimaries export to auto-test
Change-Id: I997a5a7afa72f2fd527921ed81d6ccf5f339962b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-09-04 16:35:33 +02:00
Timur Pocheptsov
b9b48464df tst_http2::goaway - run in ALPN mode only
I was observing rare crashes on my mac, where I was using SecureTransport.
This would imply both the client (the test) and the server were working
in h2c mode. But this is against the test's logic - the first request
will be HTTP/1.1 (and upgrading protocol) and I wanted to send 3 HTTP/2
requests instead.

Fixes: QTBUG-77476
Change-Id: I048ca242e2096ca36dd112277807d1fee530150c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-09-04 15:35:50 +02:00
Daniel Smith
651dd26403 Update lancelot tests to use non-system-specific host info collection
Change the lancelot baseline test runner to use generic text files for
host info data collection. This also avoids relying on QProcess and
scraping the bash scripts output from stdout.

Fixes: QTBUG-71836
Change-Id: I88a46c99dbb11f71afc18cae5a6d2fbebcbe76c5
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-09-04 13:09:39 +00:00
Liang Qi
6a36fe904c Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	src/corelib/codecs/qicucodec.cpp
	src/dbus/qdbusserver.cpp
	src/gui/painting/qbezier.cpp
	src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
	src/plugins/printsupport/cups/qppdprintdevice.cpp

Change-Id: I2703128bb64baf5580fbc2c2061b55b0f0611d2a
2019-09-04 07:03:54 +02:00
Tor Arne Vestbø
cc1ea2bf47 Simplify QColorSpace named presets
We don't need a getter for the 'preset' of a color-space, as color
spaces can be compared to the presets directly. This allows us to
remove the Undefined and Unknown values from the presets.

Internally we still distinguish known presets from unknown or undefined
presets via the magic 0-value. The validity of a QColorSpace is not
based on this preset, but on its actual values.

Fixes: QTBUG-77963
Change-Id: I1e0a2a4be83021b8c82b3c778019f680fd46455b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-09-03 15:10:11 +00:00
Friedemann Kleint
efbba1e54a Brush up tst_QStyle
- Remove member m_testWidget; instantiate test widget on the
  stack where needed
- Introduce nullptr
- Use range-based for
- Streamline some code
- Fix static invocation
- Fix class structure, add override
- Use initializer lists
- Fix some style issues

Task-number: QTBUG-76493
Change-Id: If339d51a16bb77565cf10404ad1266c8f63a68b4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-09-03 15:00:13 +02:00
Friedemann Kleint
194d4946c7 tst_QStyleSheetStyle: Pass on High DPI screens
The test requires High DPI scaling to be disabled since it
manipulates the factors itself in a test.

Turn it off initially and introduce a member variable
containing a suitable size depending on the screen to make the
test pass on High DPI screens without violating minimum window
widths on Windows.

Task-number: QTBUG-76493
Change-Id: I7b908940413d6a35a4bee781b4df07a31069bb17
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-09-03 06:27:55 +00:00
Friedemann Kleint
0a1f48a082 Brush up tst_QStyleSheetStyle
- Fix includes
- Fix a widget leak (incorrectly parented QComboBox)
  and add a check in cleanup()
- Add window titles
- Introduce nullptr
- Replace C-style casts
- Use range-based for
- Streamline some code
- Fix static invocation
- Fix class structure, add override
- Use initializer lists

Task-number: QTBUG-76493
Change-Id: I035ec782fa1241a5a1d775e86b0591d9bd134359
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-09-03 06:27:44 +00:00
Sona Kurazyan
38d5ad2ee5 Fix the build with disabled QGraphicsItem::ItemMatrixChange
QGraphicsItem::ItemMatrixChange has been deprecated since 5.14. Fixed
the usage in tests to compile condinionally, only when it is available.

Change-Id: I63e892a01a50fb9ac51bf38eb761cb26375bc194
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2019-09-02 20:56:03 +02:00
Allan Sandfeld Jensen
c8d3eb35e7 Fixup move semantics of QColorSpace
Stop using QExplicitlySharedDataPointer, makes it possible to inline
the move constructor and assign operator.

Also protect other methods from nullptr d_ptr, and change the default
constructed value to also have a null d_ptr, to match the result after
a move.

Change-Id: I40928feef90cc956ef84d0516a77b0ee0f8986c7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-09-02 18:37:07 +02:00
Eirik Aavitsland
6bb51e0f08 QPainter lancelot test: improve drawImage testing
In QPainter, there is a shortcut code path for the drawImage(point,
image) call, relative to the full drawImage(targetRect, img,
srcRect). The lance script interpreter would only use the latter, so
the former was not covered by the tests.

As a driveby, remove the pointless usage of non-default dithering
flags in drawImage(), since it is more important to test the default.

Change-Id: Id373fd528a0c4c40b6bd8eea37b960fd7cdb2cc7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-09-02 12:08:40 +02:00
Rainer Keller
af6ac444c9 Fix crash when text contains too many directional chars
In case a text to be layouted contains more than 128 directional characters
it causes the application to crash

The function initScriptAnalysisAndIsolatePairs() collects information of
RTL/LTR chaaracters into vector "isolatePairs". The size of the vector is
capped to 128. Later the function generateDirectionalRuns() iterates
the text again and tries to access items from the previously capped vector
above the upper bound.

Task-number: QTBUG-77819
Change-Id: Ibb7bf12c12b1db22f43ff46236518da3fdeed26a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
(cherry picked from commit 1232205e32)
Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-08-31 08:29:31 +00:00
Rainer Keller
1232205e32 Fix crash when text contains too many directional chars
In case a text to be layouted contains more than 128 directional characters
it causes the application to crash

The function initScriptAnalysisAndIsolatePairs() collects information of
RTL/LTR chaaracters into vector "isolatePairs". The size of the vector is
capped to 128. Later the function generateDirectionalRuns() iterates
the text again and tries to access items from the previously capped vector
above the upper bound.

Task-number: QTBUG-77819
Change-Id: Ibb7bf12c12b1db22f43ff46236518da3fdeed26a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-30 21:17:32 +02:00
Volker Hilsheimer
ca3be92234 Remove QFileInfo::type and related enum from 5.14
The API is problematic for several reasons:
- the mixing of flags and enum in a single enum type
- the name "type" as somewhat overloaded
- the ease of misuse when comparing the result rather than testing
  for a bit being set

In light of this, focus for 5.14 on the new isShortcut and
isSymbolicLink functions, thus migitating the problematic
isSymLink which conflates the two concepts.

Change-Id: I57e02321edd5061f69a775f04a0932ef89adf866
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-08-30 13:20:07 +02:00
Edward Welbourne
acd7259a03 Extend QDate's benchmark
Test more methods.
Document what the existing test covers.
Use the right #include for QDate.

Change-Id: I051542c244e5bc381aafa3ae38144e246919db7a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-08-30 11:22:07 +02:00
Edward Welbourne
14aa481614 Convert foreach to ranged for in QDateTime benchmark
Change-Id: I05cf7b1916afa94a9f0f9b83af9b4ebe20a04cf0
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-08-30 11:09:59 +02:00
Edward Welbourne
0556366ddb Deduplicate list-building code in QDateTime benchmark
Aside from the start-date and the end-date, and a variant with a
time-zone, the lists various tests were building were all built the
same way; so pack that up as a pair of functions (one without
time-zone, one with) to save duplication. Make the list in each
function const, ready for conversion of foreach loops to ranged for.

In the process, replace QList with QVector, reserve space before we
populate and use auto for the now-const list variables it's saved in.

Change-Id: I7d8cce459a4d6111cd645e8d3966ad769ab7e201
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-08-30 11:09:36 +02:00
Edward Welbourne
54f6c9bfd9 Fix unused variable warnings in QDateTime benchmark
Change-Id: Id123ace74cfa7b5ff406eabbfda0aad9f58c3fd4
Reviewed-by: David Faure <david.faure@kdab.com>
2019-08-30 10:55:46 +02:00
Edward Welbourne
06f69700af Fix some bogus date calculations in QDateTime's benchmark
Multiplying a Julian Day number by the number of milliseconds per day
does not get you a time since the start of 1970; it gets you a time
since the start of the Julian Day number system, which was several
millennia earlier.

Change-Id: Ic90a6c3de445baf9cfd30f28dd847f146e6a7adf
Reviewed-by: David Faure <david.faure@kdab.com>
2019-08-30 10:55:12 +02:00
Edward Welbourne
2faa6cafa9 Pass QDate, QTime as value classes, rather than by const reference
This can, of course, only be done in private APIs - but comment on
public APIs to do the same at Qt 6.

Change-Id: I3c79951572be3c37b0b0c5b1b05bced051a40964
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-08-30 10:54:27 +02:00
Alex Trotsenko
81408c0e76 QEventDispatcherWin32: avoid livelock in a foreign event loop
According to Windows docs, GetMessage() function retrieves the messages
from the input queue in defined order, where posted messages are
processed ahead of input messages, even if they were posted later.
Therefore, if the application produces a posted event permanently, as
a result of processing that event, user input messages may be blocked
due to hard CPU usage by the application.

It's not a problem, if an internal Qt event loop is running. By calling
sendPostedEvents() on the beginning of processEvents(), we are sending
posted events only once per iteration. However, during execution of
the foreign loop, we should artificially lower the priority of the
WM_QT_SENDPOSTEDEVENTS message in order to enable delivery of other
input messages.

To solve the problem, it is proposed to postpone the
WM_QT_SENDPOSTEDEVENTS message until the message queue becomes empty,
as it works for the internal loop.

Task-number: QTBUG-77464
Change-Id: I8dedb6837c6fc41aa6f497e67ab2352c2b4f3772
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-08-29 09:12:29 +00:00
Laszlo Agocs
2602209f54 rhi: vulkan: Introduce secondary command buffer usage
As an option. Must opt in via setting ExternalContentsInPass in
the flags for beginFrame(). It is somewhat unfortunate to require
declaring this up front, but forcing using secondary command buffers
always, even though beginExternal() may not be used in many applications,
would be an overkill.

Change-Id: I8d52bcab40c96f89f140c4c7877b6c459925e3c7
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2019-08-29 10:23:15 +02:00