Commit Graph

39849 Commits

Author SHA1 Message Date
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
Marc Mutz
e92d2f5852 QToolBox: replace a QList with a std::vector<std::unique_ptr>
This user of QList depended on the stability-of-reference guarantee of QList.
Make that explicit by using a vector of unique_ptrs. Adapt to new API.

This patch does not intend to fix any pre-existing problems with the code,
such as double-lookups. It is focused on getting rid of this questionable
use of QList, so the code doesn't explode when QList temporarily becomes
QVector in wip/qt6. Not more, not less.

Change-Id: I33847f33aa9f411ad9cd6c046653b7ab22a733cb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-05-23 18:28:54 +00:00
Marc Mutz
f0463f0cc6 Torrent example: add missing qAsConst()
The function is const, but the d-pointer doesn't propagate it (raw pointer),
so we need the qAsConst() even here.

Change-Id: I9d2e1f7715abb3dc67a87cdadaa7ded971b15848
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-23 13:35:16 +02:00
Marc Mutz
54590c4f8a Torrent example: rewrite some very convoluted code
The old code iterated over the peer list, inserting active peers into
a QSet, curiously not stopping to search for clients if it had already
determined the peer to be active.

It then iterated over the peers again, storing the indexes of the
peers it had determined to be active in the first loop, in a QList.

It _then_ iterated over the index list, in reverse, calling removeAt()
on the peers list.

<sean parent>That's a remove_if!</sean parent>

The twist is, that only some maximum number of inactive peers should
be removed, just enough to bring the number of peers below a
predefined number.

To solve, use a lambda that keeps track of the number of times it has
returned true, returning false once the count drops to zero. We can't
use a mutable lambda here, since the STL algorithms are allowed to
copy the predicate as many times as they wish, and, indeed, remove_if
is commonly implemented by calling find_if. But the standard
guarantees exactly one application of the predicate per element, so we
can assume that we're not called again on the same element, and
therefore keep a reference to an external count.

With this, what was a horrible mess becomes a single call to remove_if.

Also change a while(--n) c.removeFirst() loop to a single call of
range-erase.

Change-Id: I6c6a54a1805e5b376800e1116e7aec643e95e4e1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-24 12:27:36 +00:00
Shawn Rutledge
c85e6dc998 Add documentation for the QTextBlockFormat::marker property
Amends 65314b6ce8.

Change-Id: I8f69030accb948055b0081f8a4f1daafbac824ce
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-05-23 10:29:04 +00:00
Friedemann Kleint
28b06fc1a7 QtPrivate::QSmartPointerConvertFunctor: Fix deprecation warning
Fix warning:
src/corelib/kernel/qmetatype.h:1723:27: warning: ‘T* QWeakPointer<T>::data() const [with T = QFile]’ is deprecated: Use toStrongRef() instead, and data() on the returned QSharedPointer [-Wdeprecated-declarations]

shown when compiling tst_QVariant by using
QWeakPointer::internalData().

Change-Id: I5ea543019b4f8e5dfc829939cd2011ae65f12876
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-05-24 11:12:27 +02:00
Marc Mutz
77e708d167 Torrent example: replace Java-style iteration with STL iterators
Java-iterators are going to be deprecated.

Change-Id: I2e6353f3fd9e2ddaf0767e7f6cea713249d9591e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-05-23 13:35:15 +02:00
Edward Welbourne
070517f628 Replace look-up array with simple arithmetic
QDate looked up lengths of months in an array.  Change it to use some
simple arithmetic instead.  Benchmark result unchanged:
RESULT : tst_QDate::monthLengths():
     0.33 msecs per iteration (total: 87, iterations: 256)

Change-Id: I1ab0fa3b97e6716598e50d643a498e0b01c04a96
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-05-23 09:46:58 +02:00
Edward Welbourne
7efce5d510 Add a bench-mark for QDate's isValid() and daysInMonth()
The two perform related calculations, so test them together.
RESULT : tst_QDate::monthLengths():
     0.33 msecs per iteration (total: 87, iterations: 256)

Change-Id: I86b36a9182b00c0a1f40e858ed3e7812434974c4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-22 15:07:32 +02:00
Edward Welbourne
5b672693e7 Add locale support for Cebuano and Erzya languages (new in CLDR v35.1)
Change-Id: I5d0ee7bc27eeca1c046d442b0410128ea5abbdb3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2019-05-20 20:42:11 +02:00
Edward Welbourne
b7d8169f02 Suggest name, when available, for unknown codes
When parsing the CLDR data, we only handle language, script and
territory (which we call country) codes if they are known to our
enumdata.py tables.  When reporting the rest as unknown, in the
content of an actual locale definition (not the likely subtag data),
check whether en.xml can resolve the code for us; if it can, report
the full name it provides, as a hint to whoever's running the script
that an update to enumdata.py may be in order.

Change-Id: I9ca1d6922a91d45bc436f4b622e5557261897d7f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2019-05-20 20:42:11 +02:00
Edward Welbourne
248b6756da Rename util/locale_database/ to include the e that was missing
It was misnamed local_database, quite missing the point of its name.

Change-Id: I73a4fdf24f53daac12304de1f443636d89afacb2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2019-05-20 20:42:10 +02:00
Edward Welbourne
cf909f0ef6 Tidy up in tst_QDateTime
Use QCOMPARE rather than QVERIFY an equality; ditch a stray blank line.

Change-Id: Ie828837919fb9d3cc774d82d0eebcf7728fed645
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-22 15:43:28 +02:00
Marc Mutz
dca0efc70d QEvdevTouchScreenData: remove use of Java-style iterators
They will be deprecated.

Change-Id: Ic1281ba2543209eb9a4ba8d6653c3a3c537eb830
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-05-24 08:59:31 +02:00
Marc Mutz
905ecdd783 QBasicTimer: share some code
Saves 0.5KiB on optimized GCC 9.1 Linux AMD64 builds, and is more
maintainable going forward.

Change-Id: I11e6dd33eacf276d1205a63734c66fa7c70c5118
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-05-23 21:37:24 +02:00
Eskil Abrahamsen Blomfeldt
922d195020 Fix font matching of typographic families on Windows
9204b8c31e broke font matching on Windows.
This was then attempted fixed by bcd2fa484a,
but this caused an infinite recursion for some cases, so it was reverted
again by 9d1905da9c.

The original issue was that if we populate a specific face of a family,
such as "Arial Black", then the typographic/preferred name will be
detected as "Arial" and this family will be set as populated=true, even
though we have not yet registered any additional subfamilies. In this case,
we need to call populateFamily() for the typographic family name to
ensure we get Windows to enumerate all the subfamilies in that family
before it sets it as populated=true.

But this broke for some fonts where the font naming was unconventional.
In particular, "Yu Gothic" would have its Japanese name as the
typographic name, and there would be no font in the system where
the old-style font family name matched the typographic name. In
that case we would go into a loop where we would try populating
"<Japanese font name>", Windows would translate this to "Yu Gothic", we would
translate it back to "<Japanese font name>", ad infinitum.

In order to avoid the infinite recursion, we add a recursion guard
as well, ensuring that we never call populateFamily() for the main
family we are currently populating.

[ChangeLog][Windows][Fonts] Fixed a bug where it would be impossible
to request different faces of a font family after a specific type face
has been in use.

Task-number: QTBUG-74748
Task-number: QTBUG-74983
Change-Id: Ibe6239f67c45d67ebf75947c8f231cfa177e347f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-05-23 09:49:10 +02:00
Giuseppe D'Angelo
cceeb1ee7e QHsts: code tidies
1) Remove a use-after-move. It was benign because the move didn't
actually trigger move assignment, as the original object was const.

2) Remove a usage of insert(hint), as the hint was always end(),
and there is no reason to believe that that's the insertion place.

Change-Id: I71aac8cdc9fb85b6ecef3695bae7b21f022bb60b
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
 
 
 
 
 
 
 
 
 
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-05-13 19:12:17 +02:00
Giuseppe D'Angelo
c2d2757bcc QString/QByteArray: detach immediately in operator[]
Unlike any other implicitly shared container, QString/QByteArray
have a "lazy detach" mechanism: their operator[] returns a
special object; assignment into that object will actually
detach.

In other words:

  QString a("Hello");
  QCharRef c = a[0];  // does not detach
  c = 'J';            // detach happens here

This allows this behavior:

  QString a("Hello");
  QCharRef c = a[0];
  QString b = a;
  c = 'J';               // detach happens here
  assert(a == "Jello");
  assert(b == "Hello");

Note that this happens only with operator[] -- the mutating
iterator APIs instead detach immediately, making the above code
have visible side effects in b (at the end, b == "Jello").

The reasons for this special behavior seems to have been lost in
the dawn of time: this is something present all the way back
since Qt 2, maybe even Qt 1. Holding on to a "reference" while
taking copies of a container is documented [1] to be a bad idea,
so we shouldn't double check that the users don't do it.

This patch:

1) adds an immediate detach in operator[], just like all other
containers;

2) adds a warning in debug builds in case QByteRef/QCharRef is going
to cause a detach;

3) marks operator[] as [[nodiscard]] to warn users not using
Clazy about the (unintended) detach now happening in their code.

This paves the way for removal of QCharRef/QByteRef, likely in
Qt 7.

[1] https://doc.qt.io/qt-5/containers.html#implicit-sharing-iterator-problem

[ChangeLog][QtCore][QString] QString::operator[] detaches
immediately. Previously, the detach was delayed until a
modification was made to the string through the returned
QCharRef.

[ChangeLog][QtCore][QByteArray] QByteArray::operator[] detaches
immediately. Previously, the detach was delayed until a
modification was made to the byte array through the returned
QByteRef.

Change-Id: I9f77ae36759d80dc3202426a798f5b1e5fb2c2c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-19 16:33:56 +02:00
Joerg Bornemann
c9b7cc349a Remove usages of Q_OS_WINCE
This platform is history.

Change-Id: Iddfab008a509f4828c321730414c8204055cf7af
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2019-05-23 13:51:05 +02:00
Joerg Bornemann
b6c7defd6c Update outdated comment in QEventDispatcherWin32::processEvents
The reason for the explicit qt_GetMessageHook call is not related to
Windows CE anymore. It is a work-around used by the Direct2D
integration.

Change-Id: I489665741fc673ab9d29b35a0c02c51f2a9e9288
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2019-05-23 11:59:23 +00:00
Simon Hausmann
b4a1336bb0 Fix memory leak with arthur style
ASAN reports a leak here, so let's delete the style after the widgets
using them have been destroyed.

Change-Id: I0e8603fc5d2d0c13deca35a1c0020646c65eaf49
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-05-23 15:57:51 +02:00
Shawn Rutledge
90243aebb6 QTextBrowser: set base URL and document URL before loading content
setHtml() or setMarkdown() can result in attempting to load resources
such as images that are needed to render the page.  Whenever the
resource has a relative URL, loading depends on the baseURL having
already been set so that a complete URL can be constructed.
QTextDocument::resource() is called to load images, and uses baseUrl().
A little later, QTextBrowserPrivate::resolveUrl() is given an URL that
already has been extended with the baseURL if known; but it has its own
logic to resolve the resource URL against currentURL, or else to treat
it as a local file path if a file exists at that location.  The autotest
was relying on this fallback to the local relative file path before; but
now it tests both with a local filename in the current directory for the
source HTML and also with a fully resolved source URL containing the
complete file path.

Also made minor style improvements in tst_QTextBrowser's TestBrowser class.

Change-Id: I46a850015d0e9c5bc5f13b9e37179a9323ab1980
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-22 14:54:26 +02:00
Friedemann Kleint
ce211b1f83 Fix qdoc warnings for Qt 5.14
src/corelib/tools/qstring.cpp:9505:clang found diagnostics parsing \fn int QLatin1String::indexOf(QLatin1String l1, int from Qt::CaseSensitivity cs) const error: expected ')' error: out-of-line definition of 'indexOf' does not match any declaration in 'QLatin1String'
src/corelib/tools/qstringview.cpp:723:clang found diagnostics parsing \fn qsizetype QStringView::indexOf(QLatin1String l1, qsizetype from Qt::CaseSensitivity cs) const error: expected ')' error: out-of-line definition of 'indexOf' does not match any declaration in 'QStringView'
src/corelib/tools/qstringview.cpp:822:Unknown command '\t'
src/corelib/tools/qstringview.cpp:825:Unknown command '\t'
src/corelib/tools/qstringview.cpp:826:Unknown command '\t'
src/corelib/tools/qstringview.cpp:831:Unknown command '\t'
src/corelib/global/qnamespace.qdoc:2448:Undocumented enum item 'MarkdownText' in Qt::TextFormat
src/corelib/tools/qstringmatcher.cpp:183:No such parameter 'pattern' in QStringMatcher::QStringMatcher()
src/network/ssl/qsslerror.cpp:58:Undocumented enum item 'CertificateStatusUnknown' in QSslError::SslError
src/gui/kernel/qevent.cpp:5321:Undocumented parameter 'screenOrientation' in QScreenOrientationChangeEvent::QScreenOrientationChangeEvent()
src/gui/kernel/qevent.cpp:5321:Undocumented parameter 'screen' in QScreenOrientationChangeEvent::QScreenOrientationChangeEvent()
src/gui/kernel/qevent.cpp:5321:No such parameter 'orientation' in QScreenOrientationChangeEvent::QScreenOrientationChangeEvent()
src/gui/text/qtextformat.cpp:532:Undocumented enum item 'BlockCodeLanguage' in QTextFormat::Property
src/gui/text/qtextformat.cpp:532:Undocumented enum item 'BlockQuoteLevel' in QTextFormat::Property
src/gui/text/qtextformat.cpp:532:Undocumented enum item 'BlockMarker' in QTextFormat::Property
src/gui/text/qtextdocument.cpp:3294:Undocumented parameter 'features' in QTextDocument::toMarkdown()
src/gui/painting/qcolorspace.cpp:659:Undocumented parameter 'colorSpace1' in QColorSpace::operator!=()
src/gui/painting/qcolorspace.cpp:659:Undocumented parameter 'colorSpace2' in QColorSpace::operator!=()
src/gui/painting/qcolorspace.cpp:659:No such parameter 'colorspace1' in QColorSpace::operator!=()
src/gui/painting/qcolorspace.cpp:659:No such parameter 'colorspace2' in QColorSpace::operator!=()
examples/widgets/doc/src/icons.qdoc:269:Command '\snippet (//! [43])' failed at end of file 'widgets/icons/iconpreviewarea.cpp'
src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogRetryButton' in QStyle::StandardPixmap
src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogYesToAllButton' in QStyle::StandardPixmap
src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogIgnoreButton' in QStyle::StandardPixmap
src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogNoToAllButton' in QStyle::StandardPixmap
src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogAbortButton' in QStyle::StandardPixmap
src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_RestoreDefaultsButton' in QStyle::StandardPixmap
src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogSaveAllButton' in QStyle::StandardPixmap
src/testlib/qtestcase.qdoc:439:Undocumented parameter 'TestClass' in QTest::QTEST_HIGHDPI_SCALING_MAIN
src/testlib/qtestcase.qdoc:452:Undocumented parameter 'TestClass' in QTest::QTEST_NO_HIGHDPI_SCALING_MAIN

Change-Id: Ib0e9bf81c5caaa6b1fc644ac92085af47c600e0e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-05-21 17:39:58 +02:00
Marc Mutz
b4a88aa758 examples: port away from Java-style iterators
There's no reason to use them here, the Mutable is misleading in a
few instances, ranged-for is much simpler, and more future-proof.

Change-Id: Ifd5eaae95bbaa0b4cf0f435e6cfee6d778817b44
Reviewed-by: David Faure <david.faure@kdab.com>
2019-05-23 17:30:51 +02:00
Marc Mutz
923e08132c tst_QActionGroup: avoid Java-style iterators
They are going to be deprecated soon.

Use a lambda to mimic the adjacent addActions() calls.

Also, I didn't want to add a scope or extend the lifetime
of the return value of actions() until the end of the
function, and

  for (QAction *action : actGroup.action())

would detach. I'd've made it a helper function, but it's
used only once, so... a lambda.

Change-Id: I2b3aae463036fd61a9cca7b4ef991b8752869bf3
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-22 05:15:39 +00:00
Andrew den Exter
d661a22ae2 Write an anchor-type attribute when embedding images in an ODF document
Without this some readers will fail to display the image or position
the image at the start of a paragraph rather than inline.

Change-Id: I2b9257e3193e5e68eb20112017a0c23be1d06cb0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-05-13 13:03:07 +10:00
Andrew den Exter
345f86a2d8 Avoid re-encoding embedded images when writing an ODF file
If an embedded image is already encodeded as an png or jpg write the
data as is instead of decoding to a QImage and re-encoding as a new
image.

Change-Id: I479ae1fddbf59900a500497dd1bdf7449c21f273
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-05-13 13:03:01 +10:00
Giuseppe D'Angelo
208f22300a QWeakPointer/QSharedPointer: add a missing changelog entry
[ChangeLog][QtCore][QSharedPointer] The swap overload for
QSharedPointer in the std namespace has been removed; a new
overload has been added in the Qt namespace.

[ChangeLog][QtCore][QWeakPointer] A swap overload has been
added.

Change-Id: I20d8dd90e896dd9d4b3461dc5d2f5bb2251654da
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-12 12:19:07 +02:00
Christian Ehrlicher
aa8d3f90a4 QAbstractSpinBox: fix some ui glitches
Fix some ui glitches for QAbstractSpinBox:
 - update geometry when buttons are toggled on/off
 - calc button size with subControlRect instead hardcoded 20px
 - when buttons are not shown, don't add the button size in
   sizeFromContents for common and macOS style

Fixes: QTBUG-39713
Fixes: QTBUG-75303
Task-number: QTBUG-67126
Change-Id: Ibf330c76deb16358a481bba6bd429fff6a5d57ae
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-05-10 19:52:11 +02:00
Allan Sandfeld Jensen
12ebdf0281 Fix new[] delete mismatch in test
QScopedPointer uses normal delete, but we need delete[].

Change-Id: Id62a2c55f75ef4aa60580f5e04c4bf306a6dd3c9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-15 11:17:57 +02:00
Dongmei Wang
ad1d616033 wasm: add Qt Virtual Keyboard support
Change-Id: I454ab677cad25b50ba7b03ef2c4b6046e1227ce8
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2019-05-16 13:30:52 -07:00
Fredrik Orderud
2a2f04205c WASM: Make wasm_shell.html compatible with CMake configure_file
The CMake configure_file command is commonly used copy & modify template files
during the build process. One limitation, thought, is that configure_file
expect the variables to be replaced to be encoded using either a @APPNAME@ or
${APPNAME} convention.

This commit therefore changes "APPNAME" to "@APPNAME@" in wasm_shell.html to
make the HTML template file compatible with CMake configure_file.

With this commit, it becomes possible to write the following CMake function
that mimics what QMake is already doing:
function(copy_html_js_launch_files target)
  set(APPNAME ${target})
  configure_file("${_qt5Core_install_prefix}/plugins/platforms/wasm_shell.html"
                 "${target}.html")
  configure_file("${_qt5Core_install_prefix}/plugins/platforms/qtloader.js"
                 qtloader.js COPYONLY)
endfunction()

Change-Id: Ic38abdc498ba03b8d21f1b9b70aa1d480ae7f362
Reference: https://cmake.org/cmake/help/latest/command/configure_file.html
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-05-21 09:12:07 +02:00
Volker Hilsheimer
bd55a9d912 Fix canonicalFilePath() for files with trailing slashes
Such files do not exist (as per QFileInfo::exists), but on some
platforms that rely on realpath(), QFileInfo::canonicalFilePath did
not return the empty string.

Use the same logic on macOS as we already did on Android, and include
a test case. Remove the unnecessary dynamic memory allocation and
use a stack-allocated array instead, unless we use modern POSIX in
which case realpath() will alloc the memory for the result for us.

Change-Id: Ide987c68ebf00cbb7b1a66c2e9245a12c7807128
Fixes: QTBUG-44242
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-05-21 13:59:34 +02:00
Cristian Adam
bba44746f9 Disable debug plugin check for MinGW
MinGW doesn't have a debug and a release version of the CRT like
Visual C++ does. Disabling the check would allow distribution
only of a Release build of Qt.

Change-Id: Iecfa753217af96ca74091cd1d47400632629abdb
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-05-20 13:00:41 +00:00
Tor Arne Vestbø
e6036cfc5a macOS: Better document plain-text code-path in QMacPasteboard::retrieveData
Due to PasteboardCopyItemFlavorData converting newlines to '\r' for some
UTIs we have traditionally had to shortcut these UTIs via NSStringPboardType
instead of the mime converters such as QMacPasteboardMimeUnicodeText.

Let's explain this a bit better for future generations.

Note that public.utf8-plain-text doesn't seem to have this problem
anymore, but it's left in for now to not cause any regressions due
to behavior change.

Change-Id: I7dce80828865c6323ed308780b8ca07b7a3e7c17
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-05-15 16:30:16 +02:00