Commit Graph

39933 Commits

Author SHA1 Message Date
Marc Mutz
5ef6e1fa54 Improve qHash(QFont)
When the families member was added to QFontDef, it was included
in op== and qHash(), however the seed was passed to two qHash()
calls for subobjects. With xor used as the combiner, it could
happen that the seed was xored out (e.g. on empty strings),
leaving a slight opening for prediciable hash values.

Fix by using QtPrivate::QHashCombine, which handles the seed in
such a way as to avoid the issue.

Change-Id: I8a3e4c2f368306446554249763695158df5ac634
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-05-27 16:12:34 +02:00
Marc Mutz
fbb2ed1505 Icons example: use std::unique_ptr instead of QScopedPointer
There's talk that QScopedPointer may be deprecated. Don't use it
in examples anymore.

Change-Id: Ia50ef66de84dae2885f71a9dd83c5909bfa253f0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-15 11:03:53 +02:00
David Edmundson
404bee752c Add attribute to disable QSessionManager
Loading a session manager can be problemtatic for system services that
are always auto-activated or small DBus activated helpers which
shouldn't really be restored nor gain anything from a session.

The current solutions is to connect to commitDataRequest and
saveStateRequest and then reset a restart hint.

It's very unintuitive and somewhat wasteful given the X session manager
is full of slow blocking calls.

Rather than changing the behavior of QGuiApplication and handling null
pointers, this patch loads the base QPlatformSessionManager that is used
by QPAs that don't have a session manager.

Change-Id: I976521d551549e2d56076e968c6be5421e4a9c20
Reviewed-by: Albert Astals Cid <aacid@kde.org>
Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-03-01 01:15:43 +00:00
Tasuku Suzuki
3b756bdcf5 Fix build without feature.label
Change-Id: Ibe4d31d441ff691c4b354dde546e403653564ba4
Reviewed-by: David Faure <david.faure@kdab.com>
2019-05-26 00:28:46 +09:00
David Faure
341c8b9cd0 QCommandLineParser: add --help-all, to show Qt options as well
Sample output at http://www.kdab.com/~dfaure/2019/help-all-example.txt

Fixes: QTBUG-41802
Change-Id: I7a3350200761d41481fcb10ec4328e96e548d246
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-15 15:28:18 +02:00
Tasuku Suzuki
b75e6e00b7 Fix gui build without feature.highdpiscaling
Change-Id: Ic206cb6fa1b9fae1db9923ef6596852e93b3cbe5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-05-26 20:51:15 +09:00
Friedemann Kleint
b61d52f98a Windows QPA: Replace Q_DISABLE_COPY by Q_DISABLE_COPY_MOVE
Fix clang warnings like:
warning: class 'QWindowsStaticOpenGLContext' defines a default destructor, a copy constructor and a copy assignment operator but does not define a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions

Change-Id: I736d20476ef407100b6ecb654d1112106e545758
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-05-24 15:13:34 +02:00
Friedemann Kleint
98f9d4a029 Windows QPA: Use nullptr consistently
Change-Id: I09297e34bd62359e31c483199ade1d7a0baf7195
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-05-28 14:20:23 +02:00
Friedemann Kleint
1f6ac40ff6 QSharedPointer: Fix build error for cross-built tools
Guard friend declaration within QT_NO_QOBJECT.
Amends 28ce318fcb.

Fixes: QTBUG-76056
Change-Id: I14fbe5457c16e8a366fecdc0a356b68b8609848b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-29 09:19:07 +02:00
Marc Mutz
a4084f6bf5 QAccessibleWidgets: re-enable NRVO in childWidgets()
... for poor compilers such as GCC.

Change-Id: Ifcf603657ff6242599972c21b135d7b6a0af4c35
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-29 09:14:15 +02:00
Giuseppe D'Angelo
0290525ffb QStyleSheetStyle: do not bypass the base class' overrides
Change-Id: Iae8e24dd6c511071724fde62277ea5054b9c5253
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2019-05-28 12:43:00 +02:00
Marc Mutz
8ab4d2028f Composition example: use std::unique_ptr instead of QScopedPointer
The use of a unique_ptr member requires that the destructor be
out-of-line, since the payload is only forward-declared in the header
file. This is good hygiene, so do it for CompositionWidget, too.

Add 'explicit' and missing = nullptr to both constructors as a
drive-by.

Change-Id: Ied1c89864f90d3f2c13fb4e9a8bbbe2e6fd6f1d7
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-15 11:03:53 +02:00
Marc Mutz
4469e36d72 qhashfunctions.h: add specializations of std::hash for some Qt types
We have a problem. Our types don't play well with the std unordered
containers, because they do not specialize std::hash. We therefore
force our users to come up with an implementation, hindering
interoperability, since any two developers are unlikely to come up
with compatible implementations. So combining libraries written by
different developers will result in ODR violations.

Now that we depend on C++11, and thus the presence of std::hash, we
still face the problem that the standard does not provide us with a
means to compose new hash functions out of old ones. In particular, we
cannot, yet, depend on C++17's std::hash<std::string_view> to
implement std::hash<QByteArray>, say. There's also no std::hash for
std::tuple, which would allow easy composition by using std::tie().

So piggy-back on the work we have done over the years on qHash()
functions, and implement the std::hash specializations for Qt types
using the existing qHash() functions, with a twist: The standard
allows implementations to provide means against predictable hash
values. Qt has this, too, but the seed is managed by the container and
passed to the qHash() function as a separate argument. The standard
does not have this explicit seed, so any protection must be implicit
in the normal use of std::hash.

To reap whatever protection that std library has on offer, if any, we
calculate a seed value by hashing int(0). This will be subject to
constant folding if there's no actual seed, but will produce a value
dependent on the seed if there is one.

Add some tests.

A question that remains is how to document the specialization. Can we
have a \stdhashable QDoc macro that does everything for us?

Task-number: QTBUG-33428
Change-Id: Idfe775f1661f8489587353c4b148d76611ac76f3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2019-05-29 11:22:20 +02:00
Kevin Funk
0f777a3b75 qobject_p.h: Const-correctness fix
Note: This function is being called inside GammaRay

Change-Id: I4260d2b720d87eec829758cf3b86bc0593d964f2
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-05-27 15:07:57 +00:00
Marc Mutz
a7e9fab3e9 Use QtPrivate::QHashCombine in qHash(QSslError)
It's the same operations as boost::hash_combine, but without
explicit magic numbers.

Change-Id: Id65b6f6b7be3070e4ec349ed0cc062af473a95b3
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-27 17:38:43 +02:00
Kevin Funk
90f668c79f qtreeview.h: Fix minor typo
Change-Id: I62d494c0bd784ef14a7b7c1cb3b005a7529ba43e
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2019-05-27 20:57:03 +02:00
Marc Mutz
0f9e48d6f4 QtWidgets: eradicate some indexed loops [needing qAsConst()]
... by replacing them with C++11 range-for loops.
To avoid detaches of these mutable Qt containers,
wrap the container in qAsConst().

Change-Id: I9b5c23c723be024b314a7ad873e21ad63b44b348
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-29 07:21:18 +00:00
Giuseppe D'Angelo
0574d5dc8a Make QCoreApplicationPrivate's destructor virtual in bootstrapped builds
In a bootstrapped build QCAP does not inherit from QObjectPrivate,
meaning it won't get a polymorphic destructor, causing compile errors.
This is necessary in preparation to add virtuals to QCAP.

The "virtual" keyword is protected to avoid further warnings by
compilers or linters telling that it's unnecessary because the base
class' dtor is already virtual.

Change-Id: Ifbd218154f74b4f1d2f2c5a3ef1fc31970f1c24b
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-29 10:54:31 +00:00
Tasuku Suzuki
f5bfb7a8db Fix build without features.itemviews
Change-Id: I9a7c3b2a3ad68ea76b1d6b79192b936e7cd1d44e
Reviewed-by: David Faure <david.faure@kdab.com>
2019-05-12 16:24:53 +09:00
Shawn Rutledge
5ab6e2ef20 Update 3rdparty md4c library
0.3.3 plus a few more patches, including the one that adds
MD_BLOCK_CODE_DETAIL::fence_char, which will enable smarter rewriting
of code blocks (indented vs. fenced).

Change-Id: Ibc892369947a8a8edfa4bc20b1df98a5c8153141
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2019-05-24 15:37:05 +02:00
Shawn Rutledge
280d679c55 QTextMarkdownWriter: fix some bad cases with word wrap
If any non-breakable content (such as a link) already went past
80 columns, or if a word ended on column 80, it didn't wrap the rest of
the paragraph following.

Change-Id: I27dc0474f18892c34ee2514ea6d5070dae29424f
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2019-05-24 15:37:05 +02:00
Shawn Rutledge
7224d0e427 QTextMarkdownImporter: don't keep heading level on following list item
When reading a document like

 # heading
 - list item

and then re-writing it, it turned into

 # heading
 - # list item

because QTextCursor::insertList() simply calls QTextCursor::insertBlock(), thus
inheriting block format from the previous block, without an opportunity to
explicitly define the block format.  So be more consistent: use
QTextMarkdownImporter::insertBlock() for blocks inside list items too.  Now it
fully defines blockFormat first, then inserts the block, and then adds it to
the current list only when the "paragraph" is actually the list item's text
(but not when it's a continuation paragraph).  Also, be prepared for applying
and removing block markers to arbitrary blocks, just in case (they might be
useful for block quotes, for example).

Change-Id: I391820af9b65e75abce12abab45d2477c49c86ac
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2019-05-24 15:37:05 +02:00
Shawn Rutledge
2c8fa9700c Support clicking to toggle checkboxes in QTextEdit
Add QAbstractTextDocumentLayout::markerAt(pos) for hit testing.
(Qt Quick TextEdit needs it too.) Finds out whether the position
corresponds to a marker on a paragraph.  I.e. it finds checkboxes in
GitHub-flavored markdown.  This enables editor classes to toggle
checkboxes by clicking them.

Use it in QTextEdit to add the checkbox toggling feature.  Also show the
"pointing finger" cursor when hovering a toggleable checkbox.

Change-Id: I036c967ab45e14c836272eac2cc7c7d652543c89
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2019-05-24 15:37:04 +02:00
Tasuku Suzuki
12e0c7cbe0 Fix network build without feature.networkproxy
Change-Id: I832db8e9e13b93d7613bdf890fa6c16be78b3b28
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-05-27 14:36:46 +09:00
Tasuku Suzuki
fe4a7de238 Headers cleanup in mac style
Solve many duplication between _p_p.h and .cpp, sorted by module and
header name, and move headers for each features at the end of includes.

Change-Id: Ice9189c10d062bc473258b7ace279df057102167
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-05-12 14:34:13 +09:00
Giuseppe D'Angelo
4d83d37943 QMessageLogContext: simplify construction
By using NSDMI.

Change-Id: I171133b07ba2c7050e0d279caff0c393e03df182
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-22 08:29:32 +00:00
Giuseppe D'Angelo
001ba40e19 QMessageLogContext: rename and improve copy()
The "copy" name led me to mis-believe that it was a workaround
to the class being non-copiable, and was missing copying a
data member.

This is instead deliberate; so rename the function to
"copyContextFrom", documenting that version won't be copied.
The function is still private API, so actually make it private;
QMessageLogContext already befriended the only user.

Finally, make it return *this (so that it can be chained,
if necessary) and noexcept.

Change-Id: I3deb3c8edc863a88ac0c37467b144ec2e20db5ca
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-27 17:43:12 +00:00
Tasuku Suzuki
a8162e1f59 Replace QTESTLIB_USE_VALGRIND with a new feature 'valgrind'
Change-Id: I851788cb1872eef86c75c7bdb2de361a0ff2af6c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-05-28 17:20:00 +09:00
Mikhail Svetkin
1798d3ddc8 rtems: Add Q_OS_RTEMS macro to detect RTEMS OS
Change-Id: I45530cb7438a8f3ae8eac2e4be3c7d4472d9eec2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-28 11:23:35 +00:00
Nils Jeisecke
87748cc18e QTextDocumentLayout: Avoid table border drawing artifacts
As borders are always painted for single cells any rounding errors that
occur when mapping from fixed point numbers to integers during raster
painting will cause ugly drawing artifacts like extra pixels between
cells or borders that overlap.

To avoid this the following values are being rounded:
- table offset
- column positions and widths
- row positions and cell heights

For the column positions and widths the distribution constraints (total
table width) are respected.

Task-number: QTBUG-43589
Change-Id: I6308c113f8f9be3db8e9267629f26b5d65d2d7c7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-09-07 20:40:14 +02:00
Joerg Bornemann
20e9422e06 Do not ignore exit codes of install commands
All calls to QINSTALL or QINSTALL_PROGRAM were written into Makefiles
with a preceding dash which lets make ignore the command's exit code.
Scripts (and users) calling 'make install' had no way to determine if an
installation completely succeeded, unless they inspected make's output
or the installation tree.

Remove the leading dash from those commands to stop 'make install' on
failure. Users who really want to ignore the exit codes can run 'make -k
install'.

[ChangeLog][qmake] Installation targets do not ignore the exit code of
QINSTALL and QINSTALL_PROGRAM anymore.

Fixes: QTBUG-18870
Change-Id: I7c072c896e6bd2b2ddba4b9c082c5bf627c90f50
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-23 11:06:48 +02:00
Tasuku Suzuki
ec6dc5f784 Fix gui build without feature.regularexpression
Change-Id: Id27fc81af8d2b0355b186540f41d75a9c8d7c7f3
Reviewed-by: David Faure <david.faure@kdab.com>
2019-05-22 22:11:41 +09:00
Joerg Bornemann
9f77c91522 Sequentialize install targets in debug_and_release builds
Debug/release install targets can potentially install the same files which
leads to errors on install when running make with -j > 1.

If build_all is set, make the 'install' dependent of the new target
'debug-release-install' which contains the commands of 'debug-install' and
'release-install'.

Of course, debug/release is not hard-coded, but the content of the BUILDS
variable is used.

Change-Id: I67b504a95b83daf43bc89dcc0e3391b67e19c027
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-24 11:34:32 +02:00
Tasuku Suzuki
c034544767 Fix corelib build without feature.regularexpression
Change-Id: I208d6cb7f57a74873fae3a36fe094a92d287c2f0
Reviewed-by: David Faure <david.faure@kdab.com>
2019-05-22 14:04:11 +09:00
Friedemann Kleint
c0d8c56487 Merge "Merge remote-tracking branch 'origin/5.13' into dev" 2019-05-27 15:34:10 +02:00
Friedemann Kleint
518cf3312c Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: Ia279fc4a8226626041c772902a07b2f90f37b53b
2019-05-27 15:34:10 +02:00
Friedemann Kleint
bf207acb34 Tests: Fix some warnings about deprecated functions not under test
Fix warnings like:
baselineserver/shared/baselineprotocol.cpp:295:72: warning: ‘int QImage::byteCount() const’ is deprecated: Use sizeInBytes [-Wdeprecated-declarations]
tst_qnetworkreply.cpp:1560:17: warning: ‘static QList<QSslCertificate> QSslSocket::defaultCaCertificates()’ is deprecated [-Wdeprecated-declarations]
tst_qnetworkreply.cpp:1560:39: warning: ‘static QList<QSslCertificate> QSslSocket::defaultCaCertificates()’ is deprecated [-Wdeprecated-declarations]
tst_qnetworkreply.cpp:8153:60: warning: ‘T* QWeakPointer<T>::data() const [with T = const QNetworkSession]’ is deprecated: Use toStrongRef() instead, and data() on the returned QSharedPointer [-Wdeprecated-declarations].
...
st_qprinter.cpp:1318:74: warning: ‘QList<QPagedPaintDevice::PageSize> QPrinterInfo::supportedPaperSizes() const’ is deprecated [-Wdeprecated-declarations]
tst_qprinter.cpp:1362:74: warning: ‘QList<QPagedPaintDevice::PageSize> QPrinterInfo::supportedPaperSizes() const’ is deprecated [-Wdeprecated-declarations]
tst_largefile.cpp:492:85: warning: ‘bool qEqual(InputIterator1, InputIterator1, InputIterator2) [with InputIterator1 = char*; InputIterator2 = char*]’ is deprecated: Use std::equal [-Wdeprecated-declarations]
tst_largefile.cpp:498:91: warning: ‘bool qEqual(InputIterator1, InputIterator1, InputIterator2) [with InputIterator1 = char*; InputIterator2 = char*]’ is deprecated: Use std::equal [-Wdeprecated-declarations]
tst_qabstractitemmodel.cpp:312:25: warning: ‘void QAbstractItemModel::reset()’ is deprecated [-Wdeprecated-declarations]
...
tst_qabstractitemmodel.cpp:1793:28: warning: ‘void QAbstractItemModel::setRoleNames(const QHash<int, QByteArray>&)’ is deprecated [-Wdeprecated-declarations]
...
tst_qcolor.cpp:1425:33: warning: ‘QColor QColor::light(int) const’ is deprecated: Use QColor::lighter() instead [-Wdeprecated-declarations]
tst_qcolor.cpp:1432:31: warning: ‘QColor QColor::dark(int) const’ is deprecated: Use QColor::darker() instead [-Wdeprecated-declarations]
tst_qprinterinfo.cpp:303:61: warning: 'QList<QPagedPaintDevice::PageSize> QPrinterInfo::supportedPaperSizes() const' is deprecated [-Wdeprecated-declarations]
tst_qprinterinfo.cpp:304:65: warning: 'QList<QPair<QString, QSizeF> > QPrinterInfo::supportedSizesWithNames() const' is deprecated [-Wdeprecated-declarations]
tst_qtextdocumentfragment.cpp:947:52: warning: ‘QString QTextCharFormat::anchorName() const’ is deprecated: Use anchorNames() instead [-Wdeprecated-declarations]
tst_qtextlayout.cpp:2261:61: warning: ‘void QTextLayout::setAdditionalFormats(const QList<QTextLayout::FormatRange>&)’ is deprecated: Use setFormats() [-Wdeprecated-declarations]
tst_qtextlayout.cpp:2330:42: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations]
tst_qitemselectionmodel.cpp:2214:37: warning: ‘QModelIndex QModelIndex::child(int, int) const’ is deprecated: Use QAbstractItemModel::index [-Wdeprecated-declarations]
...
tst_qtextlist.cpp:317:68: warning: 'bool QTextList::isEmpty() const' is deprecated: Use count() instead [-Wdeprecated-declarations]
tst_qpainter.cpp:373:32: warning: ‘void QPainter::setMatrixEnabled(bool)’ is deprecated: Use setWorldMatrixEnabled() instead [-Wdeprecated-declarations]
tst_qpainter.cpp:374:40: warning: ‘bool QPainter::matrixEnabled() const’ is deprecated: Use worldMatrixEnabled() instead [-Wdeprecated-declarations]
tst_qpainter.cpp:702:45: warning: ‘const QBrush& QPalette::background() const’ is deprecated: Use QPalette::window() instead [-Wdeprecated-declarations]
tst_qpainter.cpp:1573:29: warning: ‘void QPainter::drawRoundRect(const QRect&, int, int)’ is deprecated: Use drawRoundedRect(..., Qt::RelativeSize) instead [-Wdeprecated-declarations]
tst_qpdfwriter.cpp:76:38: warning: ‘virtual void QPdfWriter::setPageSize(QPagedPaintDevice::PageSize)’ is deprecated: Use setPageSize(QPageSize(id)) instead [-Wdeprecated-declarations]
tst_qpdfwriter.cpp:81:41: warning: ‘virtual void QPdfWriter::setPageSizeMM(const QSizeF&)’ is deprecated: Use setPageSize(QPageSize(size, QPageSize::Millimeter)) instead [-Wdeprecated-declarations]
tst_qpdfwriter.cpp:105:30: warning: ‘virtual void QPdfWriter::setMargins(const QPagedPaintDevice::Margins&)’ is deprecated: Use setPageMargins(QMarginsF(l, t, r, b), QPageLayout::Millimeter) instead [-Wdeprecated-declarations]
tst_qpdfwriter.cpp:172:37: warning: ‘virtual void QPdfWriter::setPageSizeMM(const QSizeF&)’ is deprecated: Use setPageSize(QPageSize(size, QPageSize::Millimeter)) instead [-Wdeprecated-declarations]
tst_qpdfwriter.cpp:258:38: warning: ‘virtual void QPdfWriter::setPageSize(QPagedPaintDevice::PageSize)’ is deprecated: Use setPageSize(QPageSize(id)) instead [-Wdeprecated-declarations]
qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp:3980:54: warning: ‘QModelIndex QModelIndex::child(int, int) const’ is deprecated: Use QAbstractItemModel::index [-Wdeprecated-declarations]
tst_qlocale.cpp:434:26: warning: 'QString::null' is deprecated: use QString() [-Wdeprecated-declarations]
...

Change-Id: I77c1a934b27119eedeb26a77c913686314a2a5c7
Reviewed-by: David Faure <david.faure@kdab.com>
2019-05-27 15:29:16 +02:00
Friedemann Kleint
65cfac73bd Merge "Merge remote-tracking branch 'origin/5.12' into 5.13" 2019-05-27 09:17:14 +02:00
Friedemann Kleint
761b71bd20 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: Iaf6bd52972b562b9c91d9e93a988d26b0eb9d3b4
2019-05-27 09:17:14 +02:00
Edward Welbourne
14aa1f7d6f Use appropriate encoding rather than UTF-8 when reading from a pipe
The qmake code to read output from dependency-generation was adding
QByteArray values to a QString, thereby tacitly converting from UTF-8;
this is misguided. Hopefully, the command emits its output in the same
local 8-bit encoding that QString knows to convert from.

Simplified needlessly verbose loops (that violated Qt coding style) in
the process.

Fixes: QTBUG-75904
Change-Id: I27cf81ffcb63ebc999b8e4fc57abdb9a68c4d2b3
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-05-24 16:58:04 +02:00
Kai Koehne
0c9b449aa4 Doc: Clarify state of Qt Xml
The state of the module is done, not deprecated, so we shouldn't
recommend users to move away from it in all cases. There's also
no direct replacement for the DOM API.

Fixes: QTBUG-70629
Change-Id: Ifaff9757234bd68a411a3da1403c57bbbcb94693
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2019-05-24 11:54:55 +02:00
Giuseppe D'Angelo
59937de098 Annotate the futex implementation for TSAN
TSAN does not understand the futex system call.

Now, in QMutex and QSemaphore usage, futex is always wrapped by
atomic operations that always do an acquire (before waiting) and
a release (before waking waiters). That alone realizes a
synchronizes-with, and since Qt uses std::atomics, TSAN knows
what's going on and does not complain.

But what if one uses futex directly, or we change the
algorithms, or introduce some other new synchronization
primitive somewhere?  Luckily TSAN offers annotations for this
that we can use.

This patch annotates the main entry point for the futex syscall
with a pair of acquire/release semantics. A futex call
guarantees total ordering on the operations on the futex
word(s), whether the call succeeds or fails.

Change-Id: Ib80ff898c09fbb6fc73989247eb757bf70971a8a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-22 21:04:30 +00:00
Marc Mutz
eae4668afa Torrent example: replace a QMultiMap with a sorted vector
This came about trying to remove the Java-style iterator. It was used to
iterate in reverse order, something QMap can't do, easily, due to lack
of rbegin()/rend(). Instead of writing ugly loops, use a vector of pairs,
fill it, sort it, then iterate over that one in reverse.

Change-Id: I09c8a2732a0699fff4c497778745523e20d348a1
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-05-25 09:30:51 +00:00
Marc Mutz
8fe6f14bf0 QBasicTimer: add some noexcept and constexpr
The noexcept part should be clear. The constexpr should make the
compiler not create initialization code for static instances. This is
how std::mutex works[1], and Clang and GCC understand it. MSVC
doesn't.

[1] https://en.cppreference.com/w/cpp/thread/mutex/mutex

Change-Id: If9e4c6c0279f0024a659d5602d55e126224ca950
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-24 09:34:57 +02:00
Sérgio Martins
4965b0ed77 Don't allow to copy QBasicTimer in Qt 6, it would stop the timer
Fixing this in Qt 5 would be BIC. Although it could be okayish, there
are many more classes that shouldn't be copyable. I need to go through
clazy's output and fix them, and would rather do this noise for Qt 6 and
leave Qt 5 alone and purely BIC free.

Added a move-ctor and move-assign, as well as swap(), deprecated
copy-ctor and copy-assign.

The new copy special member functions warn at runtime if they are called.
In order to not pollute client code with the warning strings, lock them
away by defining the functions out-of-line.

[ChangeLog][QtCore][QBasicTimer] QBasicTimer is now a move-only class.
Copying is now deprecated and will be removed in Qt 6.

[ChangeLog][QtCore][QBasicTimer] Added swap() member and free function.

Change-Id: Ic3e6a26f3989d4c8d125c06e8b0b825411c6e106
Done-with: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-25 16:37:08 +00:00
Friedemann Kleint
d2c4782432 tst_QVariant: Fix warnings about deprecated functions not under test —
Silence a warnings flood about qVariantFromValue(), QString::null
and QWeakPointer::data().

Change-Id: I73347190c0fa396b39b9efd00447cf24e48259a0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-05-24 10:35:17 +02:00
Thorbjørn Lund Martsum
48f7f65dc3 QMenu size fix - Mark items dirty on screen change
It seems like an optimization on the itemsDirty flag
caused a bug to be re-introduced. When a popup is shown
on a new screen, the itemsDirty must however be set to
ensure that new correct sizes are calculated.

Task-number: QTBUG-59794
Change-Id: Ifb5c233b1f9d4d38bd0cd7a9a71cc32ad3212f8c
Reviewed-by: Morten Kristensen <msk@nullpointer.dk>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2019-05-22 11:22:26 +02:00
Lorn Potter
800941df89 wasm: fix empty body on POST
this also optimizes network post method handling

Task-number: QTBUG-75660
Change-Id: Ibb0d01f2cc2b2bc7802598c4f6f04b04882c12ca
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-05-22 16:58:34 +10:00
Lorn Potter
9fc17c14fa wasm: fix QSGContext warning message
When runing the scenegraph example sgengine, gets rid if this error:
 QSGContext::initialize: stencil buffer support missing, expect
 rendering errors

Change-Id: I7f3a82409bc2cf81cf8217876e527f9c45be3bf4
Fixes: QTBUG-74694
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-05-21 06:21:21 +10:00
Giuseppe D'Angelo
e9f383497f QSslSocket: do not bypass the base class' overrides
Change-Id: Ifd0842c70af764827a7e815efbc96da6cad99672
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-14 11:19:26 +00:00