Commit Graph

39771 Commits

Author SHA1 Message Date
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
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
Friedemann Kleint
07071a23c3 uic/Python: Fix tab stop/Z-Order and buddy handling
The code compared the attribute names of the properties against the
m_registeredWidgets hash which contained the qualified names
(self.widget) and thus reported errors without actually generating
anything.

Replace the m_registeredWidgets hash by a lookup of the attribute name
in the m_widgets hash and add a function widgetVariableName()
returning the qualified variable name for an attribute name and use
that for the checks.

Remove unused m_registeredActions hash and rename some variables to
make it clearer.

Task-number: PYSIDE-797
Change-Id: Id31d95c1141d21c51eb85bcd8f8fc63486eb36a5
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2019-05-08 10:19:22 +02:00
Friedemann Kleint
f48aa008e9 Windows QPA: Fix RTL window title bars
Add a platform option to the plugin (-platform windows:reverse) that
enables reverse mode. It sets WS_EX_LAYOUTRTL on RTL windows, forces normal
orientation on all HDCs created for the window, fixes
ClientToScreen()/ScreenToClient() accordingly and transforms mouse events.

[ChangeLog][Platform Specific Changes][Windows] It is now possible
to enable RTL mode by passing the option -platform windows:reverse.

Fixes: QTBUG-28463
Change-Id: I4d70818b2fd315d4e8d5627eab11ae912c6e77be
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2019-05-22 14:23:33 +02:00
Marc Mutz
26a0db4b44 Long live Qt::SplitBehavior!
The is a copy of the QString::SplitBehavior enum, but scoped
in the Qt namespace instead of inside QString, where it creates
problems using it elsewhere (QStringView, in particular).

Overload all QString{,Ref} functions taking QString::SplitBehavior
with Qt::SplitBehavior.

Make Qt::SplitBehavior a QFlags for easier future extensions (e.g.
a hint to use Boyer-Moore searching).

Added tests in QStringApiSymmetry.

[ChangeLog][QtCore] Added new Qt::SplitBehavior.

[ChangeLog][QtCore][QString/QStringRef] The split functions now
optionally take Qt::SplitBehavior.

Change-Id: I43a1f8d6b22f09af3709a0b4fb46fca61f9d1d1f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-21 17:50:26 +02:00
Marc Mutz
cea46aa362 QGestureManager: don't abuse a QMap for a set
The filterEvents() implementations used a QMap<GestureType, int> for
tracking whether a given type was already seen. The mapped_type was
completely unused.

Since the expected number of gesture types is very low, go directly to
QVarLengthArray, not QSet, as the reduced number of allocation will
dwarf the low overhead of O(N) search vs. O(1) for QSet or O(logN) for
QMap.

Change-Id: I98b6af69f11cca753e3c7c4fbb58e8f2e935e0d5
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-21 09:15:15 +02:00
Marc Mutz
f7ae47ad07 QEvdevTouchScreenData: use a mutex locker instead of manual lock/unlock()
Extra difficulty: the lock is conditional. Not a problem with std::unique_lock, which is movable.

Change-Id: Ib5515838ccb10100d5aa31163ab7f171591c04c4
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-21 09:07:38 +02:00
Marc Mutz
9d0649d338 QStandardDirs: fix quadratic loop
Instead of a bad copy of remove_if, with quadratic complexity, use
an ok copy of copy_if, with linear complexity.

Port to QStringRef as a drive-by.

Change-Id: I47fde73b33305385835b0012f6d332e973470789
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-21 08:58:16 +02:00
Marc Mutz
94fbea2f30 QFileSystemWatcher: fix quadratic loop by porting away from QMutableListIterator
QMutableListIterator::remove() is linear, so called in a loop, the
loop potentially becomes quadratic.

Fix by porting to std::remove_if. In this case, since the old code
unconditionally detached, anyway, we use remove_copy_if to build a new
list. That's still more efficient than the old code, even if nothing
is removed. It also prepares the code for when Java-style iterators
will be deprecated.

Since the same code appears in two different functions, do an Extract
Method into a file-static function.

Lastly, restore NRVO for most compilers by returning the same object
from all return statements of the function.

Change-Id: I6909c6483d8f7acfd1bf381828f020038b04e431
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-21 08:57:49 +02:00
Marc Mutz
1065777a2a QtGui: get rid of the last Java-style iterator
Trivial.

Java-style iterators are going to be deprecated.

Change-Id: Ie94658be988cc095fb3b05d0d4ef6e7e3bf9a2af
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-21 08:57:42 +02:00
Marc Mutz
b03385f9cf QFileSystemWatcherEngines: port some Java-style iterators to ranged-for
Java-style iterators are scheduled to be deprecated.

The general pattern used in the patch is that instead of copying an
input list, then iterating over the copy with some calls to
it.remove() (which leads to quadratic-complexity loops), we simply
copy conditionally (a la remove_copy_if instead of remove_if).

To make clearer what's going on, rename the outgoing list to
'unhandled'.

To avoid having to touch too much of the loops' structure, which
sometimes is quite convoluted, use qScopeGuard to do the append to
'unhandled', unless the original code removed the element.

Saves a surprising almost 5KiB in text size on GCC 9.1 optimized
AMD64 Linux builds.

Change-Id: Ifd861de9aa48d66b420858606998dd08a8401e03
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-21 21:57:20 +02:00
Marc Mutz
4e026a2076 QQnxIntegration: replace a Java-style iterator with an STL-style loop
Java-style iterators are going to be deprecated.

Change-Id: Ia55070608d3826bd84ed5d56a593c1c4918a6063
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-21 08:56:28 +02:00
Marc Mutz
88978a5b03 Add private qt_make_unique as a drop-in for C++14 std::make_unique
The original is much more subtle, so don't try to be a 100%
replacement. Most users will be able to use std::make_unique these
days. This is just a minimal implementation to enable using the
functionality in the implementation of Qt libraries. In particular,
it does not attempt to deal with arrays.

It is therefore not proposed as public API. It is placed in a new
private header, since the only header in QtCore that already
includes <memory> is sharedpointer_impl.h, and that did not seem
to be a good place to add it. It is probably too much of a
compilation-time drain to add <memory> to qglobal.h...

Change-Id: Ie206ef7ae9beb36c63aef4ec46dbde6c73e0d9f5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-21 20:17:21 +00:00
Giuseppe D'Angelo
8845caa057 QCharRef/QByteRef: warn when triggering the resizing operator= behavior
The whole reason of QCharRef/QByteRef existence is to have a magic
operator=. This operator= delays the actual detach up to
the moment something is written into the Ref, thus avoiding
spurious detaches to the underlying string/byte array.

operator= has also an extra feature, it allows this code to
succeed:

  QString s("abc");
  s[10] = 'z';
  assert(s == "abc      z");

This last behavior is *extremely* surprising.

The problem with all of this is that this extra convenience is
outweighted by the massive pessimization in the codegen for
operator[]; by the maintenance burden (QChar APIs need to be
mirrored in QCharRef, etc.), and, for the automatic resize, by the
fact that it's an super-niche use case.

Cherry on top, std::basic_string does not do that, and no Qt or std
container does that. In other words: any other container-like class
exhibits UB for out of bounds access.

We can't just go and change behavior, though. This is something
coming all the way back from Qt 2 (maybe even Qt 1), which means we
can't deprecate it at short notice.

This patch simply adds a warning in debug builds in case the special
resizing behavior is triggered. While at it, removes some code
duplication in QByteRef.

[ChangeLog][QtCore][QString] The behavior of operator[] to allow
implicit resizing of the string has been deprecated, and will be
removed in a future version of Qt.

[ChangeLog][QtCore][QByteArray] The behavior of operator[] to allow
implicit detaching and resizing of the byte array has been
deprecated, and will be removed in a future version of Qt.

Change-Id: I3b5c5191167f12a606bcf6e513e6f304b220d675
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-05-19 14:24:52 +02:00
Giuseppe D'Angelo
c7167509ac QPainterPath: convert manual memory management to std::unique_ptr
And default the destructor, now that it's empty.

Change-Id: I868d4fa04f8e82bc35f2364073d07fa47659b89c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-05-14 20:07:49 +02:00
Giuseppe D'Angelo
0060ff6749 QPainterPathPrivate: code tidies
* Honor the RO3, doing copies of the members where it belongs
(and not in its subclass), and properly handling the refcounting
by disabling the copy assignment

* Clean up construction of QPainterPathData by using ctor-init-lists,
getting rid of a warning because the base class copy constructor
wasn't being called by the subclass' copy constructor.

* Mark everything for cleanup in Qt 6.

Change-Id: I143a322dc816e2e12b454a9e5ffe63f1a86009a5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-14 19:36:03 +02:00
Jędrzej Nowacki
f946c9fb78 Fix compilation error on compilers not supporting [[nodiscard]]
__warn_unused_result__ and [[nodiscard]] both are masked by
Q_REQUIRED_RESULT but there are some minor differences between them.
In general [[nodiscard]] is more flexible while
__warn_unused_result__ can cause warnings in some contexts, for
example:

  error #2621: attribute "__warn_unused_result__" does not apply here
  error #3058: GNU attributes on a template redeclaration have no effect

That is a fix for regression caused by
b91e6f6f40.

Change-Id: Icf11b832f31e714a88536828051f4b7f348cdb36
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-05-21 15:47:55 +02:00
Tasuku Suzuki
8afecdcccb Fix build without features.timezone on macOS
It is no longer needed after bd78f57463

Change-Id: I73aceb10eab7c9fdc7d0dfbe89012df7d0110205
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-05-21 11:34:39 +00:00
Mikhail Svetkin
9895cdd3ce rtems: Disable features which RTEMS does not support
build:
- shared
- use_gold_linker
- large file support

QtCore:
- systemsaphore
- process
- processenvironment

QtGui:
- clipboard
- multiprocess

Change-Id: I641b37d0b603bbe6f0a839019f458f8138c73d34
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-05-14 13:53:35 +02:00
Marc Mutz
1307bf2892 qlalr: replace a QMap-wrapping OrderedSet with std::set
Why roll your own if you can use the original. The clone was even
designed to be API-compatible with std::set, so porting is trivial,
except for the unholy int/size_t mismatch, which requires a few
casts.

Change-Id: Ieb99cbc019ef387c6901d7518d1e79585169b638
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-14 19:18:28 +02:00
Giuseppe D'Angelo
046a1b72b4 Qt 6: unexport QCharRef / QByteRef
They're fully inlined classes.

Change-Id: Id9e5f1a1a0b3d8ee49ba45ad2157ffa38fe265cd
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-05-18 18:48:55 +02:00
Marc Mutz
ed19fc0531 QFileSystemWatcher: lock autotest code away into a cold section
The code contained a sizeable chunk of string parsing along with
qDebug()s in the normal path of execution. That code, however, was
only used for Qt's own autotests.

The idea of this patch is, then, to not only move the autotest case
into the cold text section (using Q_UNLIKELY), but also to completely
exclude it, when QT_BUILD_INTERNAL is not set.

Unfortunately, the structure of the function did not really lend
itself to #ifdefing that part of the code out (production code was in
the middle of non-production code), so I transformed the engine
selection code into a lambda, replacing assignment with returns, and
swapping the branches of the central if around to yield a single block
of code that can be excluded from compilation with just one #ifdef.

As a consequence, the runtime code is almost unaffected, and the
function is much easier to read now.

Since the test-specific code is only compiled into Qt now in developer
builds, guard the tests that rely on this behavior with the same macro.

Change-Id: I9fd1c57020a13cef4cd1b1674ed2d3ab9424d7cd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-21 12:58:27 +02:00
Giuseppe D'Angelo
eb8b63542f Disable copies in QObjectData / QObjectUserData
They're meant to be subclassed, so we need to avoid slicing.

Change-Id: I384b65478f728c69aaf1edbc985b3fb4150191fe
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-05-18 08:02:33 +02:00
Marc Mutz
2e83528856 QScopeGuard: some cleanups
Use qExchange() in the move ctor and pass the function object by
rvalue ref.

This saves one move construction and doesn't produce unexpected
results. The qScopeGuard free function should take the function object
by value, because it decays and because we can't create an rvalure
reference in a deduced context. But once we're inside qScopeGuard, the
extra object isn't needed anymore, so optimize it away.

Change-Id: I94cbc45f9bf6ca086e100efd922a0b4643a81671
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-21 12:48:11 +02:00
Marc Mutz
4b09d5a78d qmake: remove use of Java-style iterators
They will be deprecated, so qmake wouldn't compile anymore.

Change-Id: I42212fdf213df696d736ed34458f7e79bd902dd5
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-05-21 08:58:35 +02:00
Marc Mutz
0efc6a88b6 QtNetwork: port away from Java-style iterators
They are going to be deprecated.

Change-Id: Ib021aad108dc021df76ae21d1db6c8a1a734893d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-05-21 08:56:33 +02:00
Frederik Gladhorn
eeffdef1d7 macOS: Fix usage of deprecated accessibility APIs
The accessibilityAttributeValue method was deprecated and all needed
replacements are in macOS 10.12.

The new API is nicer, since it adds a lot of individual functions instead of
forcing one big switch statement on us. This makes it easier to implement
further protocols. When implementing e.g. the Button protocol, the old attribute
functions do not get called any more, so this is needed before implementing more
features.

Change-Id: I5a705edfa3f6bb0d25436df8cf5dd7f59e7e764e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-05-20 13:17:04 +00:00
Frederik Gladhorn
2bf7b15446 macOS accessibility: implement accessibilityLabel
We had an implementation of this based on the old attribute
based API, which also works. This cleans it up and adds
the setter.

Change-Id: I886fc9c89ee08b9f4f9aabec00ac1a5b9a800c6f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-05-16 13:37:24 +02:00
Erik Verbruggen
cfdbfcebbd QStateMachine: handle parallel child mode for state machines
Setting the childMode property to ParallelStates will result in an
invalid state machine. This is never checked (worse, we explicitly
allow it and have a constructor to set it), but it results in
findLCCA failing, which then results in a failing assert or crash.

This fix in this patch is to handle this case separately. The proper
fix would be to remove completely the ability to set the childMode
on a QStateMachine, but that will have to wait until Qt6.

Fixes: QTBUG-49975
Change-Id: I43692309c4d438ee1a9bc55fa4f65f8bce8e0a59
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-05-16 16:51:42 +02:00
Chris Adams
d7afd8bb38 Remove dead code from qdbusintegrator.cpp
This code has been there since the initial public commit, but has no
effect.

Change-Id: Iae80ae22a363b3bd0e6cf7706619b38edc47790f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-02-22 16:57:27 +10:00
Edward Welbourne
d3b887707d Clean up some poorly-placed newlines in the TLD suffix data
A comma appeared on a line on its own; a closing-brace didn't.

Change-Id: I33cf37bb3574cd421c8af5ab6312865b71ce61f1
Reviewed-by: Peter Hartmann <peter-qt@hartmann.tk>
2019-03-08 10:44:05 +01:00
Edward Welbourne
aca13a8eba Tidy up in qdatetime.cpp
Break a line before a close-brace. Added blank lines. Remove some
duplicate blank lines and spurious \fn directives. Fixed placement of
& between type and parameter name in the function declarations that
made these last redundant (these are the WS-only changes).

Change-Id: I7ee06a7cbb4f9cb275d5ad87246d8fbc9c9b6668
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-05-15 15:44:19 +02:00
Giuseppe D'Angelo
28ce318fcb Cleanup the fallout of QWeakPointer::data() deprecation
There are still users of QWeakPointer::data(), which under
certain compilers will make headersclean fail. So this
patch:

* ports data() to a private internalData() function and
calls it from all the usage points;

* adds cleanup notes for Qt 6, once some of the deprecated
machinery around storing unmanaged QObjects in QWeakPointers
can get removed.

Change-Id: Id3bcbd23374c18a2026861c08a4dcba1670673c1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2019-05-17 20:42:36 +02:00
Christian Ehrlicher
edb53d761e QFileDialog: mark obsolete enum DontUseSheet as deprecated
QFileDialog::DontUseSheet is obsolete since 4.5 and not used anywhere
inside the Qt code base. Mark it as deprecated and remove the last usage
in the examples.

Change-Id: If3d23fd5906314e6ebc7080efa79da14a2aa2720
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-05-17 14:08:34 +00:00
Christian Ehrlicher
4f6eb43898 QtCore: mark obsolete enumerations as deprecated
The following enumerations were obsolete for a log time but not marked
as deprecated:
 - WA_NoBackground
 - WA_MacNoClickThrough
 - WA_MacBrushedMetal
 - WA_MacMetalStyle
 - WA_MSWindowsUseDirect3D
 - WA_MacFrameworkScaled
 - AA_MSWindowsUseDirect3DByDefault
 - AA_X11InitThreads
 - ImMicroFocus

mark them as deprecated and remove the usage inside QtBase so they can
be removed with Qt6

Change-Id: Ia087a7e1d0ff1945286895be6425a6cceaa483fb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-05-17 14:08:30 +00:00
Giuseppe D'Angelo
b7a7d61efc Deprecate QWeakPointer::data()
It's a dangerous API to have. Upgrade to a shared pointer
if accessing the raw pointer is required.

[ChangeLog][QtCore][QWeakPointer] The data() function has
been deprecated.

Change-Id: Ie5d34f4fb500b3cfa14d2c0b1b08484df072129c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-16 13:59:52 +00:00
Marc Mutz
5497183c71 Add some examples to qExchange() docs
Change-Id: I758782f6566ab94006aedacc9988ec4eb09a14c6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-05-16 13:18:06 +00:00