Commit Graph

34393 Commits

Author SHA1 Message Date
Martin Smith
5e0ef2defd doc: Add missing template text
There are two fake classes in qendian.h that exist only documenting
a lot of operator functions, but now that clang is being used to parse
all C++ code, when a class is a template class, clangqdoc must see its
template stuff to recognize template type T, for example. Hence, this
update adds template<typename T> to some fake class declarations used
only for documentation purposes. ie, inside #ifdef Q_CLANG_QDOC.

Change-Id: I1988b77cd7f3bb97067e7107dd00de34770e9fed
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-04 13:39:57 +00:00
Martin Smith
49bb359580 doc: Fix qdoc errors for \fn commands in endian functions
This change updates the \fn commands in the endian
functions, which are template-based. clangqdoc now
parses these \fn commands and expects to see all the
template stuff in the signatures.

Change-Id: I94c1aba8d710c97b8d41184d64b5341c88ece297
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-12-04 12:04:10 +00:00
Martin Smith
a69675a9f9 Add template text to \fn commands for QGlobalStatic
The \fn commands were not recognized by clang-qdoc because
the template stuff was missing from the \fn commands. This
update adds the correct template text and parameters.

Change-Id: I920d9cc4bef710f276267a34b6b9d49f7412adb0
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-12-04 07:19:36 +00:00
Peng Wu
8f1b4a9081 Support ForwardKeyEvent signal in ibus input context
For ibus-hangul, it needs ForwardKeyEvent signal to fix
the commit issue.

[ChangeLog][plugins][ibus] Support ForwardKeyEvent signal

Change-Id: If41e75bed9ec4e3126db05c8ece4a51d2bc3c3fd
Reviewed-by: Takao Fujiwara <takao.fujiwara1@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-12-04 06:36:07 +00:00
Martin Smith
e27bb2fd25 Remove two obsolete qdoc comments
The macros Q_GLOBAL_STATIC(Type, VariableName) and
Q_GLOBAL_STATIC_WITH_ARGS(Type, VariableName, Arguments)
were documented in qglobal.cpp, but both qdoc comments
were marked \internal. More recent documentation for the
macros also exists in qglobalstatic.qdoc, and the qdoc
comments there are not marked \internal. clang-qdoc
reports errors indicating that both macros havew been
documented in two places. This update removes the older
comments that are marked \internal.

Change-Id: I1c319b831d705d86eb4142b9963dbf56edc72772
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-12-03 18:34:15 +00:00
Martin Smith
c3e0f09e33 doc: Fix qdoc errors for \fn commands in QGenericMatrix
This change updates the \fn commands in QGenericMatrix
clangqdoc now parses these \fn commands and expects to see
all the template stuff in the signatures.

Change-Id: Icf815606f98271aae1959adc633e918e7f241aa0
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-12-03 11:37:25 +00:00
Alex Trotsenko
0873e5abb6 QProcess/Unix: do not toggle a state of the write notifier twice
_q_canWrite() unconditionally disabled the write notifier before the
writing, and might have enabled it again afterwards. This caused
unnecessary processing in the event dispatcher and could result in
extra system calls.

Actually setting the state at the moment when the write buffer size
is determined is enough.

Change-Id: I81f9ec27d95a5a9bdb83cc6a842b6ae95f002b96
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-12-02 19:42:11 +00:00
Martin Smith
24a0b641c1 doc: clangqdoc needs to see all GLxxx typedefs
Clang needs to see declarations for GLclampf, GLSizei,
and GLboolean.

Change-Id: Id1c1310e4877b32bb8fc2e6d4f743999842b3f06
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-02 17:30:17 +00:00
Martin Smith
f1817ea9ce doc: Add default openGL typedefs for clangqdoc
When Q_CLANG_QDOC is defined, ensure that the following openGL
types are defined:
typedef int GLint;
typedef int GLsizei;
typedef unsigned int GLuint;
typedef unsigned int GLenum;
typedef unsigned int GLbitfield;
typedef float GLfloat;
typedef float GLclampf;
typedef bool GLboolean;
typedef void GLvoid;
typedef char GLchar;
Running clangqdoc with these on macOS fixed over 500 qdoc errors!

There were also some functions that declared the parameter list as void.
It was also shown as void in the \fn command for each function in the
.cpp file, which is wrong. When the function is declared in the header
as int func(void), it should just be \fn int classname::func() in the
.cpp file.

Change-Id: I6489d499f0830e5ba97c085ed5dadfad5affecb7
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-02 17:29:59 +00:00
Martin Smith
1a78e16d19 doc: Fix three "Cannot tie" errors
Two of the three functions were for functions that
should not be documented. The third was a function
protected by #ifndef Q_OS_DARWIN, which required a
test of Q_CLANG_QDOC in the header and cpp files.

Change-Id: Id2ab3e4f2ea896dc628a622de2e80a19c18eb9fe
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-02 14:58:07 +00:00
Martin Smith
7cfd6f0e1e doc: Fix some ref qualifier documentation errors
Some member functions of QImage were upgraded to use ref qualifiers,
but the documentation wasn't updated correctly to account for this.
This change update the documentation for those member functions to
show the ref qualifiers in the documentation.

Change-Id: I0ff4011e9d0251062d5616d69e9dda6bdbc1c136
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-02 14:57:47 +00:00
Martin Smith
87cce3e061 doc: Don't let qdoc see some defines that cause trouble
This update surrounds some #defines with #ifndef Q_CLANG_QDOC
because they define some names that conflict with formal parameter
names. Otherwise, clang starts replacing formal parameter names
with $27 etc, when qdoc runs, and that causes trouble for qdoc.
The change also replaces one use of Q_QDOC with Q_CLANG_QDOC.

Change-Id: I6e93bf1e0d30d7590280b6f18f0e694556050685
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-02 14:57:26 +00:00
Martin Smith
e210b1233d doc: Correct a few minor qdoc errors
A use of Q_QDOC is changed to Q_CLANG_QDOC.
A misspelled std type name is corrected.
A few extraneous ';' are removed.

Change-Id: Ic49f64a3b97f645268a8ecbbca5f0eef0456bb33
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-02 14:57:07 +00:00
Allan Sandfeld Jensen
2c25a431d0 Use dependencies instead of CONFIG+=ordered
Also drops a few instances where the dependency was purely runtime,
especially for examples.

Change-Id: I2a0476f79928143596bdb3b8f01193af90574ae8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-12-02 11:09:15 +00:00
Martin Smith
beb9ca92df doc: Correct all remaining clangqdoc warnings in qpointer.cpp
This update corrects many qdoc warnings in qpointer.cpp caused by
incomplete \fn commands. Template stuff was added to the \fn commands.

Change-Id: I39bcd5db1cb4257d574918155dc49414a8b00c3d
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-02 09:38:53 +00:00
Martin Smith
6bc994f3fd doc: Correct all remaining clangqdoc warnings in qdebug.cpp
This update corrects many qdoc warnings in qdebug.cpp caused by
incomplete \fn commands. It also corrects many undocumented parameter
errors caused by clang's requirement that the formal parameter names
be the same in both the declaration in the include file and the \fn
command. The name changes don't seem to be objectionable in this file.

Change-Id: I0630a0e05e651b58608b2f2116df70dcf0e83a45
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-02 09:38:36 +00:00
Martin Smith
1ca60025d9 doc: Add missing template text and parameters
This update corrects many qdoc warnings in the documentation
for the QFuture classes caused by incomplete \fn commands.
Template text and parameters was added.

Change-Id: I360c9db191230b19a9b174a43468d3de1eb24549
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-02 09:38:12 +00:00
Martin Smith
e2cdfd54c9 doc: Fix qdoc errors for \fn commands in algorithm functions
This change updates the \fn commands in qalgorithms.qdoc.
clangqdoc now parses these \fn commands and expects to see
all the template stuff in the signatures.

Change-Id: Id9492bf80eca494eb2b5b8d7364b8485ed1a047e
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-02 09:37:49 +00:00
Martin Smith
bac26da9af Add template text to \fn commands in QPair
The \fn commands were not recognized by clang-qdoc because
the template stuff was missing from the \fn commands. This
update adds the correct template text and parameters.

Change-Id: I49302d0792c8a4c5a36c671142796a48d384b548
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-02 09:37:22 +00:00
Martin Smith
4411848026 Add template text to \fn commands in cache classes
The \fn commands were not recognized by clang-qdoc because
the template stuff was missing from the \fn commands. This
update adds the correct template text and parameters.
Removes about 150 qdoc warnings.

Change-Id: I63c6cae5613f0bb23527607230b6edf7fac33740
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-01 19:35:53 +00:00
Martin Smith
6530b036c7 Add template text to \fn commands in QVarLengthArray
The \fn commands were not recognized by clang-qdoc because
the template stuff was missing from the \fn commands. This
update adds the correct template text and parameters. This
change eliminates about 150 qdoc warnings.

Change-Id: I23632e739b529cd56a6cae1a29df2e7131a05292
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-01 19:35:37 +00:00
Alexander Volkov
7c7a95cd09 Revert "QApp: Method to check for native style usage."
This reverts commit 958a4c9087.

QApplicationPrivate::usesNativeStyle() introduced by that commit
was never used. We have an untested method that is furthermore
may return wrong results because it relies on the comparison
'app_style->objectName() != QApplicationPrivate::desktopStyleKey()',
but not all styles set their object names.

Conflicts:
    src/widgets/kernel/qapplication.cpp
    src/widgets/kernel/qapplication_p.h

Change-Id: I48d221f9387381db9ed51a7a068bfd0a0c2ed58d
Reviewed-by: Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
2017-12-01 19:29:29 +00:00
Alexander Volkov
a6b7447058 Disable some implicit conversions with QT_RESTRICTED_CAST_FROM_ASCII
Non-const arrays are not literals, so their encoding may be
not defined at compile-time and they should be converted
explicitly.

Change-Id: I2a65e095224f48efafeaa97fd85134697a1e5bf0
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-12-01 19:29:14 +00:00
Marc Mutz
4c704fad08 QMetaObject::Connection: mark move ctors Q_DECL_NOTHROW
Drop the #ifdef Q_COMPILER_RVALUE_REFS - we require that since Qt 5.7.

Change-Id: Ib4c6f559b014915f43875ec6791bfda3f24a109b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-12-01 18:52:14 +00:00
Friedemann Kleint
15557a12de QImage: Output some bytes of first scanline on verbose debug streams
Change-Id: I1003c2b4109112fb2d2733a156120a041d7bd695
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-12-01 18:08:09 +00:00
Andy Shaw
c4ba2b1c70 Copy the numericalPrecisionPolicy when copying the QSqlDatabase
As the numercialPrecisionPolicy can be set and subsequently retrieved
from the QSqlDatabase's driver, then when copying the QSqlDatabase, we
need to set that appropriately too.

Task-number: QTBUG-10452
Change-Id: I2c63748365ab4e9fbc29d8d460d80d2e2a0ee385
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-12-01 10:52:44 +00:00
Andy Shaw
33b03d99cd Remove code that refers to PostgreSQL 7.2 or older
We haven't had support for anything older than 7.3 for a long time, so
this removes the code to save having to maintain it any further.

Task-number: QTBUG-644
Change-Id: If0635f3bef5138a00a0e77011a70f23d0bffda32
Reviewed-by: Robert Szefner <robertsz27@interia.pl>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-12-01 10:52:32 +00:00
Martin Smith
b23c52ea81 Add template text to \fn commands in container classes
The \fn commands were not recognized by clang-qdoc because
the template stuff was missing from the \fn commands. This
update adds the correct template text and parameters. It
eliminates nearly 2000 qdoc warnings.

Change-Id: Ibe047424396a8f99f8bd64efea1b0d8cc7c7527d
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-01 10:48:22 +00:00
Gabriel de Dietrich
32326a4b3b macx-clang: Opt-in xcb QPA support with XQuartz
Enable xcb QPA plugin when XQuartz is available. This is done
in a single build, alongside the Cocoa version.

We delegate part of the configuration stage to pkg-config, so
this becomes a requirement. Ensure that

    PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig:/opt/X11/share/pkgconfig

is in your environment, or pkg-config is properly set up.

Tested with the following configure options:

configure \
   -pkg-config \
   -fontconfig -system-freetype \
   -system-xcb -xkb -no-opengl \
   -qt-xkbcommon -qt-xkbcommon-x11

Change-Id: I2eb5a0491172368afc4c629c540cbef08580348d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-12-01 01:19:46 +00:00
Gabriel de Dietrich
728c325a51 QtServiceSupport: Remove redundant condition
The condition for the 'services' sub-project in platformsupport.pro
was identical to the one guarding genericunix.pri in services.pro.

We can't remove the condition in platformsupport.pro because that
would result on an empty static library, which is not supported on
some platforms, like macOS.

Change-Id: I5c80737d9527bdd75dde44e33e5063f3d7aeecb7
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-12-01 01:19:38 +00:00
Edward Welbourne
c27348985d Simplify date-time formatting in textForRole()
QAbstractItemDelegatePrivate::textForRole() was formatting date and
time separately, then gluing the parts back together with space.
QLocale can do that just fine itself (it has a toString() overload
that handles a QDateTime) and might even (some day) do it better.  To
my mild surprise, this proved sufficient to fix a problem with
date-time display in tool-tips, when the date-time includes a zone.

Extracted the date-time part of an existing selftest into a test of
its own and extended it to test times of each spec-type; verified that
the non-local spec cases of this all failed before this fix.

Task-number: QTBUG-61069
Change-Id: I6d6be0c27be9a557d8afc3ced200a10b2aaff816
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-11-30 20:21:42 +00:00
Edward Welbourne
454bbbe787 Clean up in TZP-Win's calculateTransitionLocalDate()
It's decoding a SYSTEMTIME in the slightly quirky manner of MS's
timezone APIs (year 0 means annual, with wDay as 1 through 4 for the
first through fourth, or 5 for the last, of a specified week-day
within a month) and the calculations to go with it were a little
opaque.  So clean it up, document what it's doing (and why) and assert
some things that should be true.  Also, only copy one int, instead of
a whole structure, to change from their day-numbering to ours.
Expand on a related TODO comment in its caller, at the same time.

Change-Id: Iffd95c094c37fc1081b73b2a267cfdcd29aeb4ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 20:20:40 +00:00
Edward Welbourne
205df620a0 Pull several structs and static functions into an anonymous namespace
The implementation of QWinTimeZonePrivate used many static functions
and at least one struct; to which I've added.  Put these all into an
anonymous namespace (thereby keeping the struct types out of the
linker's sight): make them local the C++ way, rather than the C way.

Change-Id: Ibdce0865234b5d4ebbdc90628cc4d9e790ed6321
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 20:20:35 +00:00
Edward Welbourne
92fad720af Add a check of selected time-zone offset data
Task-number: QTBUG-64122
Change-Id: I6b113f2f05db9659b8c542744846096e39f285ab
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 20:20:29 +00:00
Edward Welbourne
6deb0f0dcc Fake a "first transition" at the start of time
QTimeZonePrivate::dataForLocalTime() needs a transition before the
time it starts at; MS's time-zone data tends to omit old zones (before
2007, in the case of Win7 for Casablanca - which had interesting
transitions before that), so all we can do is extrapolate backwards
from there; but a first rule is indeed apt to be a no-transition rule,
describing the zone's status up to the first known transition.  So
fake a "start of time" transition to return for this case, that
describes this prefix of history.

Change-Id: Iaf178cbebc3b1e599cbde3437a0af75d9f6ca432
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 20:20:15 +00:00
Edward Welbourne
35176c2289 Avoid underflow on arithmetic with possibly-first transition times
A transition time may represent the beginning of time; as such,
arithmetic on it might underflow, e.g. on adding a negative zone
offset to compare with a given time.  So move the arithmetic to the
other side of the comparison in such cases.

Change-Id: I1697a03ebf74679ff86059664dd2b173b9c4c367
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 20:20:10 +00:00
Edward Welbourne
68bcccac22 Take account of single-transition hacks in MS time-zone APIs
When a year contains a real change of standard time without any DST,
MS's APIs still claim to have both a DST start and a DST end; one of
them is bogus and positioned on the start (or end) of the year,
producing no change in offset from the end of the previous (or into
the start of the next) year.  So code round that.

Task-number: QTBUG-42021
Change-Id: Ieb6161cfb77db8a57dc181097f117316f9d1c13c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 20:20:05 +00:00
Edward Welbourne
88d5ba5409 QWinTimeZonePrivate: make transition searches more efficient
Iterate rules (now that there's fewer of them than years) with only a
secondary iteration on years (when needed - in which case it should
never need more than two iterations).  In particular, avoid iterating
years to the MIN_YEAR and MAX_YEAR extremes on failure; fail faster !

Change-Id: I354af8e0cb1e484c8abda279991e6e1824f9f7d4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 20:19:59 +00:00
Edward Welbourne
a99c773972 Refine handling of wMonth checks in QWinTimeZonePrivate
The MS API documents that the two TIME_ZONE_INFORMATION date fields
either both have wMonth clear (when there is no DST) or both have it
set (for each part of a DST pair).  This rule is followed even when
there's a standard time change without DST, with perverse results I'll
deal with in a later commit.  Add code in init() to verify the rule is
followed and qWarning() if not.

A year with no transitions doesn't imply no earlier or later year has
transitions, so don't give up on searches for transitions because of
it.  Also fix a potential uninitialized variable bug, related to
data() breaking out of a loop on such a year.

Change-Id: I1ad86c07e54b2eb835a2e02d18dc64022f52a0d9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 20:19:54 +00:00
Edward Welbourne
81ad5bc838 Tidy up QDateTimeParser code to make it easier to reason about
Note that the relevant cases are all numeric, eliminate a redundant
variable (the min of two others, one of which was provably <= the
other), invert and rename a boolean (that was always used negated),
eliminate a case that couldn't arise (and assert this).

Change-Id: I9ef9cedbeb608c7cd56ddc618ddfb921966edfbf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 20:19:35 +00:00
Edward Welbourne
b4ef4469ba QDateTimeParser: reject all short values in fixed-width fields
Previously, a 1, 2 or 3 for "dd" would be rejected because 10, 20 or
30 would fit in the field and be valid; but 4 or more was accepted,
even though it was too short for the field, because no suffix could
make it valid within the field-width.

[ChangeLog][QtCore][QDateTime] When parsing dates and times from
strings, fixed-width date-time fields, such as a "dd" for day,
QDateTime now rejects all values that should be padded, rather
than only doing so when the value is a prefix of some value that
would fill the field-width.  Use a single letter for the field,
e.g. "d" for day, if you want to accept short
values. (QDateTimeEdit is not affected.)

Task-number: QTBUG-63072
Change-Id: I22d223c50057c3edab4ef7f01d9ed0f58e9139c1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-11-30 20:19:29 +00:00
Edward Welbourne
a755c2e521 Raise the upper bound on years to 9999
Test-case taken from bug-report; fits in as an easy row in an existing
data-driven test.  Add similar tests for date-time and time; and an
isValid test on the end of year 9999.  The date-time parser was using
the end of year 7999 as maximum value for dates and date-times; extend
this to year 9999, as I can see no reason not to.

[ChangeLog][QtCore][QDateTime] Years up to 9999 can now be parsed
without error (previously 8000 and beyond were treated as invalid) in
all formats (not only in ISO format).  Widgets handling dates now
support dates to 9999, likewise.

Task-number: QTBUG-64401
Change-Id: I518cfa6c2cb4ecc5a85b896dc9e56b4fdd8a8bb1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 20:19:13 +00:00
Edward Welbourne
ba19363529 Mutex-lock QLocale's update of its globalLocaleData
For want of this, nothing that used QLocale::system(), inter alia,
could be thread-safe or re-entrant.

Task-number: QTBUG-49473
Change-Id: I3e017aa7d59c4c39828bb5cdc7ff0780ea66bafe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-30 20:19:03 +00:00
Marc Mutz
a0faf9e236 Optimize QThread::isInterruptionRequested()
To signal a thread to cancel, nothing more than a std::atomic_flag is
needed, but the implementation actually used mutexes, and weird
run-state introspection, so we can't just swap it out for a
std::atomic_flag.

Instead, we retain the principal logic, however weird it is, and just
optimize the common case where isInterruptionRequested() is called
from the secondary thread, repeatedly. We add a fast-path that just
checks that d->interruptionRequested is not set. That requires nothing
more than a relaxed atomic load, because there's no new value read
that could be used as a signal to the secondary thread that some
condition changed.

"What signal?", you may ask. Well, one can think of users doing this:

  void cancel() {
      m_why = tr("&Canceled");
      requestIterruption();
  }

  void run() override {
      while (!isInterruptionRequested()) {
          doWork();
      }
      emit progress(100, 100, m_why);
  }

We need to keep this code working, at least until Qt 6.

But the code can already now only rely on synchronization if
isInterruptionRequested() returns true. If it returns false, then
requestInterruption() has not been called, yet, and any modifications
done prior to the requestInterruption() call are not visible in the
secondary thead.

So we still lock the mutex, and in general don't change the semantics
of the functions, except that we don't lock the mutex in the case
where the flag wasn't set in the first place.

This makes calling isInterruptionRequested() as cheap as it can get,
assuming a lock-free implementation, of course.

I opted to use a std::atomic<bool> instead of QAtomicInt, as the
latter does not have loadRelaxed()/storeRelaxed(), and because it
future-proofs the code.

Change-Id: I67faf36b8de73d2723f9cdd66c416010d0873d98
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-11-30 20:16:21 +00:00
Christian Ehrlicher
1c0fcbc887 QSortFilterProxyModel: Clear persistent indexes on source model change
When a new source model was set to QSortFilterProxyModel, the model
tried to remap the persistent indexes to the new model which was wrong.
The correct solution is to clear the persistent indexes with
_q_sourceModelDestroyed() since the old source model went away.

Task-number: QTBUG-44962
Change-Id: Id39e9ac83324250e8bfa434aae467a9206d2590e
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2017-11-30 17:29:33 +00:00
Christian Ehrlicher
8a1f0d1f6c QItemSelectionRange: speedup intersects() in negative case
QItemSelectionRange::intersects() needs to check if the parent of both
QItemSelectionRanges is the same. This is a very expensive operation
which should be done last. Same goes for isValid() which itself calls
parent() for two indexes.
This rearrangement speeds up some worst-case usecases by at least 30%
as shown in the bug report.

Task-number: QTBUG-60940
Change-Id: If6111a73cb8b97a8a0d0640527b34448d21f3143
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2017-11-30 17:29:27 +00:00
Ulf Hermann
f0e9d268c2 Avoid compile warning in tst_qftp
setSession is only used if we have bearer management.

Change-Id: I64b9d29c01566e79bbca5d0dc11d6aee6d9b0bf0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-11-30 15:58:07 +00:00
Thiago Macieira
e1ffa594a1 Replace qrand() engine with C++11 <random> LCG and deprecate
Instead of trying to adapt to whatever the C library may have and using
QThreadLocalStorage, let's use a simple linear congruential generator
engine from <random>. We can't use a single instance because qsrand()
is documented to work per thread.

I thought of using QRandomEngine, but had to make the choice between
growing the QtCore code size and growing the per-thread data size. Code
is sharable and is actually smaller than the sizeof(QRandomEngine),
which is over 2500 bytes. sizeof(std::minstd_rand) is just
sizeof(uint_fast32_t).

Change-Id: I0a103569c81b4711a649fffd14ec8e641d02bf20
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-11-30 15:54:15 +00:00
Gatis Paeglis
09c1510060 qtest_gui.h: remove incorrect #ifdef
Originated from 6c06e14a49

Change-Id: Id93f33c8a00850c7b41593c85521d75e5293b36b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-11-30 15:05:45 +00:00
Gatis Paeglis
75e583b3fc qtestmouse: do not qWait for mocked events on macOS
This logic initially was copied from QTest::mouse* widget overload
(by d130382776) which uses QCursor::setPos()
to generate mouse move events via the windowing system. The QCursor API was
later removed by 1762bf3394, but now the redundant
qWait logic remained. Later this stray qWait was incorrectly moved to apply
for all mouse event types (by 268f41ec70), when
originally it was needed (arguably) only for mouse move events due to usage
of QCursor.

This patch also removes the waitForEvents() function as it is not a documented
qtestlib API (in qtestlib only the documented functions should be considered
public API, no matter what you can find in the header files). Removal does not
affect binary compatibility as this is not an exported symbol. And if somebody
has used this non public API, updating code is trivial.

Change-Id: Id1dec10f5cf276cee1ac0e8c8f8ba2edc493b667
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-11-30 15:05:40 +00:00