Commit Graph

40517 Commits

Author SHA1 Message Date
Marc Mutz
135aa77021 Revert "QDistanceField: add missing copy assignment operator"
The reverts commit 0624c99ea3, which
fixed a GCC 9 -Wdeprecated-copy warning by adding the copy assignment
operator.

The 5.12 change 0e162315 fixed the same warning by removing the copy
ctor. The merge ef37ab99 removed the copy ctor, but kept the
assignment operator added by 0624c99e, bringing the original warning
back, but with the roles of copy ctor and assignment operator
reversed.

One has to give.

Change-Id: Ib32841df94a5ff80402a68b5fe776eb82e94136f
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-07-11 22:07:38 +02:00
Marc Mutz
987dde2965 Optimize and fix handling of QtMessageHandlers
A function may almost always have static storage duration, but that
does not necessarily mean that we can store and load pointers to them
without memory ordering. Play it safe and use store-release and
load-acquire for them (which combines to ordered for the fetchAndSet
call in qInstall*Handler(), as we don't know what the caller will do
with the returned function pointer).

Also change the initial value of the atomic pointer to nullptr.
Nullptr already signified the default handler in qInstall*Handler(),
so the API doesn't change. But by using nullptr to mean default, we
place these variables in the BSS segment instead of TEXT, save dynamic
init, or at least a relocation, and we dodge the smelly comparison of
function pointers, using comparison against nullptr instead.

Also, as a drive-by, put the call to ungrabMessageHandler() in a
scope-guard. Both the message handler, as well as the Qt code calling
it (toLocal8Bit()!), may throw, and that would stop all further
logging. In Qt 5.9, we can't use qScopeGuard(), yet, so use a local
struct calling ungrabMessageHandler() in its dtor.

The code still has one problem: When a logging action is underway, and
another thread exchanges the message handler, we might still execute
code in the old handler. This is probably not a problem in practice,
since no-one will use a dynamically-compiled function for logging
(right? :), but should probably be documented or fixed. This patch
does not address this issue, though.

Change-Id: I21aa907288b9c8c6646787b4001002d145b114a5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cd401b74a1)
(cherry picked from commit ea16c860bd75a35134ebb1d4f3be5db58f4a4e21)
2019-07-11 20:05:19 +00:00
Friedemann Kleint
54684f10e9 QSaveFile: Fix changing the file name after hitting on readonly file
The call to QFileDevice::unsetError() in QSaveFile::open() does
not clear QSaveFilePrivate::writeError. Clear it in addition.

Fixes: QTBUG-77007
Change-Id: I5e5009750f1726d1c74c1b4eb1c33f3a5393fe4f
Reviewed-by: David Faure <david.faure@kdab.com>
2019-07-11 22:00:10 +02:00
Thiago Macieira
d01693733f QDirIterator: don't require NFD normalization on Darwin for validity
HFS+ filesystems do enforce NFD normalization, so the test worked for
those filesystems. But on APFS, the filesystem is normalization-
insensitive but preserves it, so our transformation caused valid files
to be rejected.

This commit also optimizes the solution for all systems too. Instead of
converting from 8-bit to UTF-16 then back to 8-bit (allocating memory in
both steps), we only convert to UTF-16. And if we detect the locale is
UTF-8, then we use the further optimized QUtf8::isValidUtf8 function
that doesn't allocate any memory at all (ditto for US-ASCII, the case of
someone running with LANG=C).

Fixes: QTBUG-76522
Change-Id: Ief874765cd7b43798de3fffd15aa0d81620ad317
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-07-11 11:46:59 -07:00
André de la Rocha
786c588171 Windows QPA: Fix handling of mouse messages synthesized by the OS
The old handler only marked mouse events associated with mouse messages
synthesized by the OS with Qt::MouseEventSynthesizedBySystem when these
messages resulted from touch screen, not tablet input. Quick seems to
depend on this behavior.

Fixes: QTBUG-76617
Change-Id: Ib863d73ae9325f9a19d8a175817fef4e82f7df0b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-07-11 20:03:01 +02:00
Kai Koehne
3f8e754f07 CMake: Properly escape '.lib' in regex
In a CMake regex, you need two backslashes to escape a character. The
.in file therefore needs four backslashes ...

This amends ba4fdd99ff

Fixes:  QTBUG-76698
Change-Id: Ic757354ba596bf020c3ee5e90ee6d2d0fe3ba352
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-11 14:13:19 +00:00
Friedemann Kleint
6aa6623437 QTestLib: Fix class declarations/structure
- Remove virtual from functions declared as override
- Use " = default" for trivial constructors/destructors
- Remove all special functions from QTestLog

Apply Fixits by Qt Creator with some amendments.

Task-number: QTBUG-69413
Change-Id: I812b8116e5b4c927e4e5cee44e63bc705385d866
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-07-11 14:42:04 +02:00
Friedemann Kleint
225dd568af QTestLib: Introduce nullptr
Apply Fixits by Qt Creator with some amendments.

Task-number: QTBUG-69413
Change-Id: I620e40a277dc2b20b0ec26fc32577e66b0456bb3
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-07-11 14:41:50 +02:00
Friedemann Kleint
2d8d738657 QTestLib: Use member initialization
Apply Fixits by Qt Creator with some amendments.

Task-number: QTBUG-69413
Change-Id: Iba0834dc89cbfc215acc5873f31fa6eeed74177d
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-07-11 14:40:29 +02:00
Robert Loehning
3bee5a470a Fix typos in readme
Change-Id: Ifecb1bac475512241de9bcf195955409bb3adaff
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-07-11 14:17:08 +02:00
Kai Koehne
de8bd9ec6b Fix build with -no-feature-printer
Skip printsupport subdirectory if printer feature is disabled. Also
removed android-embedded condition for the plugin: Such a
configuration should just disable the printer feature.

Fixes: QTBUG-76941
Change-Id: Ifca7d2311a575c1589ad6a87a775bd016591ee2c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-07-11 13:58:36 +02:00
Volker Hilsheimer
cc32226e64 Windows: handle errors correctly when connecting to unreachable host
The previous code handled only some error codes, in a very inefficient
way, for some code paths. This change standardizes error handling using
a helper function that maps winsock WSAE* codes to Qt error codes.

The test for connecting to unreachable hosts or ports is now more
generic, and enabled on Windows, where it passes in local tests,
but dependency on network configuration still makes it fragile,
so ignoring some failures without completely skipping the test.

[ChangeLog][Network][Windows] Correctly emit errors when trying to
reach unreachable hosts or services

Change-Id: Icaca3e6fef88621d683f6d6fa3016212847de4ea
Fixes: QTBUG-42567
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-07-11 10:46:23 +02:00
Felix Barz
36a15a87de syncqt: Fix module header install target creation
Modified a regular expression in syncqt.pl so that the special case of
a class beginning with another class does not lead to the exclusion of
the first one. This affects the generation of the install target for
generated class headers of Qt modules. Now the expression verifies the
class names are not identical.

Fixes: QTBUG-71323
Change-Id: I210b4d4c3ed64cf189594b95b10aa0e8495a19d2
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-07-11 09:50:18 +02:00
Tasuku Suzuki
fc15cdb4d0 return value in QOrderedMutexLocker::relock when thread is disabled
Change-Id: Ic96e777491cc8d304be056a3476a4de4c4700a0f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-11 12:56:56 +09:00
Tasuku Suzuki
f6d815922d Fix build without feature.temporaryfile
Change-Id: I096b6a7d9cc8e17165e07657f6647a14baafefa5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-11 01:48:59 +09:00
Edward Welbourne
a9aa206b7b Move text-related code out of corelib/tools/ to corelib/text/
This includes byte array, string, char, unicode, locale, collation and
regular expressions.

Change-Id: I8b125fa52c8c513eb57a0f1298b91910e5a0d786
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-10 17:05:30 +02:00
Qt Forward Merge Bot
85d3061c1c Merge "Merge remote-tracking branch 'origin/5.13' into dev" 2019-07-10 17:01:22 +02:00
Tasuku Suzuki
ca6a037d95 Fix testlib build without features.properties
Change-Id: I3ca7f8cdb59a9a1e61d2702e92cd5e2d1420ac84
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2019-07-10 22:20:41 +09:00
Marc Mutz
eb48b3c0e1 qsslsocket_openssl_symbols.cpp: replace manual memory management with std::unique_ptr
Also fix the name mismatch between the Windows- and non-Windows
versions of loadOpenSsl(), which, presumably, were caused by having
two different return values, something easily fixed by defining a
small struct instead of using a QPair.

Some #ifdef'ery saved, and a lot of brittle deletes on early returns.

Change-Id: I77440de2f6fa51759510506ff4ef51917eb5b3ea
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-07-10 13:38:02 +02:00
Eirik Aavitsland
2d597c0e1a QPixmapCache: guard against usage from non-main threads
Depending on the active QPA plugin, QPixmaps may now be created and
used also in non-main threads. But QPixmapCache is not designed to be
used from such threads, so add guards to ignore such access attempts,
both from application code and from Qt library code.

Such unsafe access would often cause a cryptical "~QObject: Timers
cannot be stopped from another thread" warning; that also disappears
with this fix.

[ChangeLog][QtGui][QPixmapCache] Ignore unsafe access from non-main
threads

Task-number: QTBUG-76694
Task-number: QTBUG-72523
Change-Id: Ia2db37e528aec08bfb48808630bdf5e543689039
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-10 12:43:23 +02:00
Joerg Bornemann
3052e621a4 Fix duplicates in QMAKE_DIR_REPLACE
When building Qt, qt_build_config.prf adds all directory variables but
DESTDIR to QMAKE_DIR_REPLACE_SANE. We must not add the content of
QMAKE_DIR_REPLACE_SANE unconditionally to QMAKE_DIR_REPLACE in order
to avoid duplicate entries.

Duplicate entries result in an interesting build folder structure like

.obj
├───debug
│   └───debug
└───release
    └───release

This commit amends 274882a5.

Change-Id: Ifa8178410d82f58635babc46d43774bab522fbf8
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-07-10 12:35:52 +02:00
Martin Smith
ffaf3cfc21 doc: Enable a declaration for qdoc
A declaration of fromStdVariant() was not visible to qdoc
because it was ifdef'ed out. This update ensures that qdoc
sees the declaration.

Change-Id: I4b00a895aa61175296ec80806b43311eff4f25ca
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-07-10 12:14:13 +02:00
Joerg Bornemann
89aa6e780a Fix determination of host_arch test binary
The host architecture detection binary's file extension is determined by
the host platform, not the target platform. Respect the host variable
that's set in configure.json.

This amends commit d9fb502.

Change-Id: I134cd7cf12d6a6fe458ac5e37c48dd311d6c4418
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-10 10:53:04 +02:00
Joerg Bornemann
605062b21f Fix MinGW cross-build with precompiled headers on Linux
We need localtime_r() in several places. To have this function
declared when including time.h, _POSIX_THREAD_SAFE_FUNCTIONS must be
defined. E.g. qdatetime.cpp includes unistd.h before time.h to define
said macro.

However, this falls apart when precompiled headers are used, because
of the following include chain in qt_pch.h:
qcoreapplication.h -> qobject.h -> chrono -> time.h

This patch ensures that _POSIX_THREAD_SAFE_FUNCTIONS is defined before
including time.h in qt_pch.h by including unistd.h early.

Fixes: QTBUG-76680
Change-Id: I3875072edf37f45492f29d84fc297a9682e11db4
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-07-10 10:41:23 +02:00
Qt Forward Merge Bot
6fd20defb9 Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
	src/corelib/time/qdatetime.cpp
	src/widgets/widgets/qcombobox.h

Change-Id: Ib84352e8fe34aed2986a1c94e7346a46a71c803b
2019-07-10 10:39:33 +02:00
Mårten Nordheim
16158e1132 Win: qdiriterator bench: fix missing null-terminator issues
It's not done by toWCharArray. This caused some issues as we were using
API requiring a null-terminator. wcslen for instance was measuring the
string as being millions of characters long, causing fairly quick
crashes when appending.

Change-Id: Iedaaf9f195be22a610543ab649da92a87cb71973
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-07-10 07:18:05 +00:00
Volker Hilsheimer
b426cff1e0 Make tst_QGraphicsItem painting tests most robust
Counting absolute paint events is fragile, as there are no guarantees
that a single call to QApp::processEvents only delivers a single paint
event to a widget. As of QTBUG-76566, we see that the items occasionally
receive three calls to paint, which can be simulated by activating other
windows while the test is running and waiting for events to be
processed.

Instead, verify that we do receive any paint events as the first test,
and then verify increments when we expect updates.

This also reverts change 24b9424adc.

Change-Id: Ib51853e918f31acd3aea10d4109c95f34012a29f
Fixes: QTBUG-76566
Reviewed-by: Dimitrios Apostolou <dimitrios.apostolou@qt.io>
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
2019-07-10 06:17:09 +02:00
Volker Hilsheimer
59b29d03b2 Further stabilization of QGraphicsItem::cursor test
The QTest::mouseMove calls are not reliable, and seem to produce
flakiness, at least on WinRT. Removing them, and only depending on
handling of the synchronously delivered QMouseEVent for simulated
mouse moves.

Also, initialize the expected cursor shape from an empty scene;
this avoids that showing the view with the cursor accidentially
on an item results in the wrong default shape. Remove hard
coded coordinates, just test what we know.

Fixes: QTBUG-73545
Change-Id: I6f81d6b16bb613ec77aaa776d6a80aac739aeb58
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-10 06:16:52 +02:00
Sze Howe Koh
f4b5fa76d7 [Doc] Fix minor typos
Change-Id: I7e74806218dcc07d800f4ec08e94abce32483f5e
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2019-07-10 07:35:06 +08:00
Allan Sandfeld Jensen
d9fb502b20 Fix android architecture detection
Android is also unix, so can pick up the host 'arch' binary when
rerunning configure. This patch splits the names so we don't end up
confusing target and host binaries.

Task-number: QTBUG-76445
Change-Id: Ib65251a514e45ad8873f523d71c17e13e56ea58a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-09 22:53:48 +02:00
Friedemann Kleint
94aa350621 QTestLib: Speed up QCOMPARE for float, double, int, unsigned
Factor out a helper template formatting the QCOMPARE failure message
delaying the formatting of the parameters with toString() and use that
for float, double, int and unsigned. This removes the need to always
format and allocate strings for the operands even in the success case,
speeding up the QColor test from 3.3s to 700ms (Windows/release).

Task-number: QTBUG-38890
Change-Id: I999484765bdaed921d3fc35f35a9fbbcd82a9704
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-07-09 20:15:58 +02:00
Friedemann Kleint
9c8d1ca18b QTestlib: Check compared images for device pixel ratio
When accidentally running a test doing screen-grabbing
with High DPI scaling active, sizes of the obtained pixmaps
can differ due to the device pixel ratio. Add a check to make that
clearer.

[ChangeLog][QtTestLib] Comparison of QImage, QPixmap now checks for the
device pixel ratio.

Change-Id: Id8d5187e99c565c44a7bfb8b9cfb09737815fb15
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-07-09 20:15:34 +02:00
Friedemann Kleint
e81ece3f8f QFileSystemModel: Improve class structure
Use member initialization in private classes and repack members to
minimize padding.

Use delegating constructors and default constructors/destructors.

Task-number: QTBUG-76493
Change-Id: Iaea8880811782ee5846c128590b83c23e6fae445
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-09 20:15:07 +02:00
Ryan Chu
d72ea9cbd3 Revert "QFtp: Skip the flaky QTestEventLoop::timeout in Coin network"
This reverts commit 33d2715dd3.

Reason for revert: <QTBUG-76367>

Change-Id: I134514e729d7066ab5f67a0536e653868bf15ed7
Reviewed-by: Dimitrios Apostolou <dimitrios.apostolou@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-07-09 17:40:50 +00:00
Volker Hilsheimer
89984a8a61 Fix the systray example to only show an icon when requested
The "None" and "Custom icon" cases where using the same value for icon
type, which resulted in both options showing the application icon.

Use -1 to indicate the custom option, and treat all other options
the same.

Task-number: QTBUG-76916
Change-Id: Ib715f5d328175bd6e221b3f507087954fa542838
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-07-09 18:32:48 +02:00
Marc Mutz
0a3107dd30 QHostInfo: fix a race condition on QHostInfoCache::enabled
In auto-test-enabled builds, QHostInfoCache can be enabled and
disabled using qt_qhostinfo_enable_cache() at any time. We cannot rule
out that users use this function, or, indeed, that the auto-test never
gets a threading stress-test. Under the assumption, then, that
QHostInfoCache::enabled can be set by any thread at any time, and is
read by any thread using QHostInfo::lookupHost(), we're presented with
a data race, thus UB.

Fix by making the accesses to QHostInfoCache::enabed atomic. Relaxed
operations are suffcient, as the bool is the only data of interest in
these situations. In particular, access to the cache itself is
protected by the cache's mutex.

We use std::atomic<bool> because QAtomicInteger<bool> doesn't exist on
all implementations, but std::atomic<bool> must. Commit a0faf9e236 set
the precedent that it works.

Change-Id: Ia1766753bb54c5fe8d8447b51a49a96a7a853eef
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-07-09 13:09:24 +00:00
Yulong Bai
211830b233 QFusionStyle: fix excessive top margin of groupbox
The users voted for smaller top margin while there was neither title
nor checkbox.

Task-number: QTBUG-44056
Change-Id: I5bd5cabb094c9cdec379f20e206196f1b5432182
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-07-09 13:49:22 +02:00
Ryan Chu
17ac9f8ced Revert "Disable Docker-based test servers on Windows temporarily"
This reverts commit 17512d497d.

Reason for revert: force vmx instructions to Coin level B virtual

Relates to qt/qt5 84ff024609e4eca003c604294b4102e73deba8c3

Change-Id: Id87a5629a5cd6ebc18c676eae390466e280fc600
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-07-09 13:49:18 +02:00
Martin Smith
4bb975717b doc: Add missing class qualifier
A glass qualifier was missing in a \fn command.
This caused clang to report an error. The class
qualifier is added by this ubdate.

Change-Id: I1c4928183f4c8eb1b28f0fde2ce659a1feb24175
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-07-09 12:46:08 +02:00
Marc Mutz
e6c646a678 QHostInfoRunnable: make the lookupFinished() call more robust
Use a scope guard to reliably mark the runnable as finished with the
manager, lest a deleted runnable lingers in the manager's
currentLookups for too long/ever.

Change-Id: I89eff49931d0428f4e75789a0a1188edb1f66220
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-09 07:09:51 +02:00
Marc Mutz
60ca2f5f7c Be less laissez-faire with implicit conversions to QChar
QChar currently is convertible from nearly every integral type. This
is bad code hygiene and should be fixed come Qt 6.

The present patch is the result of compile fixes from marking these
constructors explicit. As is clear from the distribution of fixes,
only low-level string handling code used these implicit conversions,
an indication that they're not in widespread use elsewhere.

Change-Id: Ief5336f21e6d181e03ab92893b3d13a14adc7cb0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-09 07:09:44 +02:00
Marc Mutz
36f6bd7cf0 QHash: mark the equality operator for QHashDummyValue constexpr noexcept
Who knows what this may end up being good for.

Change-Id: Ib5e73b0170ebba54f87f36e75b7c407f801c52a0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-08 23:34:06 +02:00
Andre Hartmann
a776d6ec5b QTextObject: One more 0 to nullptr conversion
Change-Id: I61446afa882304400d3ae8045e4f17bb7a020600
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2019-07-08 21:20:06 +02:00
Marc Mutz
1c6828b9d6 QFreeList: fix memory order on block deletion
Blocks are likely to have been created in a differnt thread from the one
performing their deletion, so we need an acquire fence.

The rest of the atomics use in the class looks ok, but nevertheless warrants
a deeper analysis.

Change-Id: I1571ded3a06695b0d58b5bf1d80d6283ac21f959
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6fa34930c2)
(cherry picked from commit 51bcc7e07e2bb5b42bb200dcd5269e9e9e2fe240)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-07-08 18:52:55 +00:00
Marc Mutz
fc95af3621 QSimpleTextCodec: fix load memory order of atomic pointer
The pointer value is not the only data we're interested in, but
instead points to indirect data, so we need a release fence on store
(present) and a corresponding acquire fence on load (was missing).

Change-Id: I51f8251c0c7f4056192880430f2be5e0836dbed6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6f84829031)
(cherry picked from commit 4cc6e1419294a729e53d698bace2254903c1429b)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-07-08 18:52:43 +00:00
Volker Hilsheimer
d8688d4484 Don't set the mouse cursor for items that are disabled
As with widgets, items that are disabled should not receive any input
events.

Similar to QGraphicsScene, which ignores disabled items when handling
mouse presses, the view should also ignore them when handling mouse
moves to update the cursor.

Since QGraphicsView only adjusts the cursors on mouse moves, reenabling
an item that is currently under the mouse will not change the cursor.
This is consistent with other changes of item attributes that would
position the item under the mouse (such as moving it). The overhead of
hit-testing items for every such attribute change would be too large,
and applications can generate a mouse move event if they really need
to adjust the cursor in all situations.

[ChangeLog][QtWidgets][QGraphicsView] Ignore disabled items when setting
the mouse cursor.

Fixes: QTBUG-76765
Change-Id: Ifcd31fc0581e8421e58eeb436a55b031909eed7e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-07-08 20:51:22 +02:00
Volker Hilsheimer
307403f8b4 Stabilize QGraphicsItem::cursor and select_multi tests
The tests send QEvent::MouseMove events to the view, but don't fully
construct the event with both local and global position. Consequently,
QMouseEvent will use QCursor::pos as the global position, which is
unreliable, as QTest::mouseMove can not guarantee that the mouse really
moves - when running the tests locally on e.g macOS, it never does.

So instead construct the QMouseEvent with the trivially calculated
global position.

Change-Id: Ic4c914e3af7f15751545080d4743b06d3887cce8
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
2019-07-08 20:51:19 +02:00
Sona Kurazyan
e96cea51da Fix compilation with disabled deprecated APIs
The QImageIOHandler::name() has been deprecated since 5.13, but its
overrides weren't. Enabled compilation of the overrides only when the
QImageIOHandler::name() is compiled.

Task-number: QTBUG-76491
Change-Id: I8fea0032427d25bb0de01be8920c723fc21f6b7a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2019-07-08 20:41:33 +02:00
Shawn Rutledge
8f75910dea Add mouseDoubleClickDistance and touchDoubleTapDistance to QStyleHints
Amends ca280bfe3b and
705e3f68df which added these enums only to
QPlatformTheme::ThemeHint but not to QPlatformIntegration::StyleHint.
Those patches did not add accessors to QStyleHints, probably because
the accessors in QStyleHints use the themeableHint() function which
takes both enums; so to have an accessor implemented this way, we need
it in both enums.  But it's getting too silly, since the only platform
plugin that modifies MouseDoubleClickDistance is Android, implemented by
QAndroidPlatformTheme overriding QPlatformTheme::themeHint(), and thus
illustrating that adding the enum to QPlatformIntegration::StyleHint
is not the only way to allow a platform plugin to customize the hint.

So it seems we need a new way of writing these accessors without needing
to duplicate the enum value in QPlatformIntegration::StyleHint.  The new
version of themeableHint(QPlatformTheme::ThemeHint) falls back on the
static QPlatformTheme::defaultThemeHint() accessor.

Users should at least be able to see what the default value is; and
having these getters will also provide link targets for QtQuick's
TapHandler docs.

Change-Id: I0f8560062bcd0ca5e6d580071d9fbcf3f07f625f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-07-08 20:29:17 +02:00
Gatis Paeglis
a41701904e xcb: fix thread synchronization issue in QXcbEventQueue::waitForNewEvents()
This patch amends 730cbad882

The issue was that the event reader thread (QXcbEventQueue::run()) can enqueue
events sometime between GUI thread has last time peeked at the queue and before
it has called waitForNewEvents() and hence started waiting for more events (via
QWaitCondition). This scenario is even mentioned in the QWaitCondition documentation:

"[..] if some of the threads are still in do_something() when the key is pressed,
they won't be woken up (since they're not waiting on the condition variable) and
so the task will not be performed for that key press. [..]"

And if there are no more events on the X11 connection, the waitForNewEvents()
in QXcbClipboard::waitForClipboardEvent() would timeout.

Fixes: QTBUG-75319
Change-Id: I8990a2a0c00571dfc334fb57d616dee999042885
Reviewed-by: Igor Kushnir <igorkuo@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-07-08 13:23:39 +02:00