Commit Graph

37770 Commits

Author SHA1 Message Date
Oswald Buddenhagen
127005d360 qmake: fix return type of toLongLong()
Fixes: QTBUG-71886
Change-Id: I62880e7ad8a1707c9094b07cf89d5c0c7841d235
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-11-21 05:37:02 +00:00
Lars Knoll
ac4b2a2b8e Don't start a new page when printing very large images
Don't start a new page to print a very high line of text if
that line wouldn't fit on one page in any case. In that case
we have to break the image up onto several pages anyway, so
we might as well start it immediately.

Change-Id: I823aa4961df179054476755c8f5df2e03874661f
Fixes: QTBUG-59885
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-11-21 05:36:46 +00:00
André Klitzing
be92e67fbf Add log output if library does not exists
Any other method logs this here, too. This helped
to find the problem of QTBUG-71027.

Change-Id: I2d1f6199837d778ada62dac357764b0609e99692
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2018-11-21 05:36:31 +00:00
Timur Pocheptsov
d5b3ddffae QMacStyle: account for QStyleSheetStyle using QTabBar directly
in this case w->parentWidget() is not QTabBar, but QTabWidget and we
never draw PE_IndicatorTabClose control (before the recent major
re-write in qmacstyle we never tested the actual type).

Task-number: QTBUG-61092
Change-Id: I87c4813258cc2b483b2ef278c4a2f8796973af1c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-11-21 05:35:21 +00:00
Tor Arne Vestbø
aa75697b63 Add makefile target to generate Xcode project
Removes need to manually build up qmake command line when there's
already a Makefile generated (from a recursive qmake_all run e.g.)

Instead, just run 'make xcodeproj'.

Change-Id: Ibe91b183230721a4bcaddfde53b623df00f7adb5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2018-11-20 19:51:25 +00:00
Tor Arne Vestbø
9c560eb8b5 macOS: Improve logging during QNSView/QNSWindow deallocation
Change-Id: Ie6945f2a1f35db6d1259b77ee63137abcaf68318
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-11-20 19:51:18 +00:00
Tor Arne Vestbø
666f3b4a78 Take device-pixel-ratio into account in openglwindow example
Also affects the windowcontainer example, which includes an OpenGL
window.

Change-Id: Ic9f0f2aa66410b657e08c0225b085dd8df44e2a7
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2018-11-20 19:51:12 +00:00
Tor Arne Vestbø
12045801f7 macOS: Use shared NSWindowDelegate instead of one per window
All the delegate callbacks give us the relevant NSWindow, so we don't
need one delegate per window just to be able to resolve the correct
platform window.

Change-Id: I8e44186da63bf01f029bb0b1fefcd8880f49dda6
Fixes: QTBUG-65693
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-11-20 19:51:05 +00:00
Tor Arne Vestbø
6c1656397a macOS: Ensure NSWindow delegate is released in sync with its NSWindow
Releasing it in [QNSWindow closeAndRelease] is wrong, as we only call
that method from a few call sites, and can easily end up with a normal
dealloc by means of e.g. the [m_nsWindow release] in ~QCocoaWindow.

This still leaves Xcode thinking we have a single leaking delegate
per active NSWindow, as it apparently doesn't realize we're calling
release manually. This needs to be investigated further.

Task-number: QTBUG-65693
Change-Id: I9105602274d8532465e5108aba2b05bf253268e9
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-11-20 19:51:00 +00:00
Liang Qi
574bf5d9aa Correct QT_FEATURE_settings in qconfig-bootstrapped.h
This amends 4d180586cd.

Change-Id: Ia008e618f726f113f84cf4caa8d5f30442dbbb64
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-11-20 13:26:21 +00:00
Frederik Gladhorn
e00c73911a Reduce run time of tst_QRegularExpression::threadSafety
This test was taking so much time that it regularly timed out on WinRT
and when running in qemu. Reduce it from around 40 to 7 seconds on a
powerful desktop.
Now it either runs for two full seconds for each test function or until
it has done 50 iterations.

Fixes: QTBUG-71405
Change-Id: If752c1e65d3b19009b883f64edc96d020df479d1
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-11-19 11:45:38 +00:00
Christian Ehrlicher
ca3ac2e1c7 Documentation: update Q_DISABLE_COPY documentation
Q_DISABLE_COPY annotates the functions as deleted but this was not
mentioned in the documentation.
As a drive-by adjust some indentations.

Change-Id: I808fe3f1ce9f949d2ba41436661569ab0f2a9f73
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2018-11-19 11:45:29 +00:00
Christian Ehrlicher
8ad9bdf957 QScrollBar: fix horizontal scrollbars in RTL mode
When a QScrollBar had a stylesheet the subControlRect() was not properly
mirrored which lead to a wrong scrolling behavior.
Fix it by adjusting the resulting rect with visualRect().
This reverts 00c9ec63a5 since it did not
completely fixed the issue for all use cases.

Fixes: QTBUG-27279
Fixes: QTBUG-38748
Fixes: QTBUG-40443
Change-Id: I19718287be7b4cfc9dbe6951fff99ae48264a855
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2018-11-19 11:45:24 +00:00
BogDan Vatra
6fdf398ab4 Android: Prepare for the worst, when the NDK will remove all GNU tools
In NDKr18 Google removed GCC, most probably the massacre will not end
there and they will remove all GNU tools, so we need to start using LLVM
ones.

This patch still keeps the compatibility with GNU tools if the Qt was
built with android-g++ mkspec.

Change-Id: Ibe1979577e08ce63604d55fc5bbd5f64b3737675
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-11-19 11:45:20 +00:00
Vitaly Fanaskov
5242540ee4 Fix message about licensing options in the About Qt box
Removed versions count.
Replaced "different" -> "multiple".

Fixes: QTBUG-57697
Change-Id: I924e4706a089fe244f0ea6c3a660a8a4529502a2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-11-19 11:45:14 +00:00
Lars Knoll
199f9c5448 Fix vertical alignment of inline images
Inline images can have 4 different alignments. Unfortunately,
AlignTop and AlignBottom can only be set once we have laid out
the whole line and know the total height of the line, as one
could otherwise end up with lines that are too high.

To fix this, position the images for these cases in a second loop
after we have calculated the length of the line and the maximal
image height in that line.

Task-number: QTBUG-59310
Change-Id: I1fd4cd39e43a13d1967b9f5c9ce8270a99269cd9
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-11-19 11:45:09 +00:00
Liang Qi
4d180586cd Merge remote-tracking branch 'origin/5.11' into 5.12
Conflicts:
	src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm

Change-Id: I66a08c770767a93cd26535689e3e7806486aab06
2018-11-19 12:42:10 +01:00
Thiago Macieira
6b088b7a1d QResourceFileEngine: fix use of mapped files after close()
QFile::map() is documented to continue working after the QFile is
closed, so this should work for the resource file engine too.

Change-Id: I343f2beed55440a7ac0bfffd1563243a3966441f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-11-19 09:09:36 +00:00
Thiago Macieira
6a792d6f0b QResourceFileEngine: fix map() for compressed files
We were returning a pointer to the compressed data and comparing to the
compressed data size.

Change-Id: I343f2beed55440a7ac0bfffd1563232d557c9427
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-11-19 09:09:31 +00:00
Thiago Macieira
460866ee47 tst_QResourceEngine: use QTest::addRow instead of QString concatenation
Change-Id: I343f2beed55440a7ac0bfffd156322c95aebb847
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2018-11-19 09:09:26 +00:00
Thiago Macieira
6125fce799 tst_QResourceEngine: store the actual byte contents that we expect
Instead of using a QString with only the prefix, let's do a full
comparison to make sure there's no junk at the end of the file.

Take the opportunity to remove the nonsense of a space at the end of
most of these files (I didn't remove from all).

Change-Id: I343f2beed55440a7ac0bfffd15632228c1bfe78f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-11-19 09:09:20 +00:00
Liang Qi
7a4f41bad9 tests: Distinguish tst_qeventdispatcher and tst_qguieventdispatcher
Both use same source, but link without and with Qt Gui library.

Task-number: QTBUG-71751
Change-Id: I5643a07a8067f5fc10fc66f717f19bc3e16a33ab
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-11-16 14:16:09 +00:00
Liang Qi
37d3bc9ad7 Merge remote-tracking branch 'origin/5.12.0' into 5.12
Change-Id: Ic1dd39044e19f50e1068d4ac70dacaad6440e570
2018-11-16 08:10:15 +01:00
Kai Koehne
1983abddc0 Remove support for qml1 plugins and modules
The Qt Quick 1 module got dropped in Qt 5.6, and
almost certainly doesn't compile anymore.

Change-Id: Ia1ae6937e9cc4d99508be8eeeff9b12d0f001002
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-11-15 19:52:13 +00:00
Liang Qi
527406cbd9 Modernize the "settings" feature
Change-Id: I9b8a61ecb1413b513ae5c9e77d3ee1b3e8b6562c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-11-15 17:20:15 +00:00
Andre de la Rocha
a94a3098d0 Windows QPA: Fix building with -no-feature-tabletevent
This change fixes building Qt with the -no-feature-tabletevent configure
option by disabling handling of pointer messages associated with tablet
events within the pointer message handler.

Fixes: QTBUG-71774
Change-Id: Icb47a39793edb9a0f87c07c656b6ea6573d5f947
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-11-15 12:47:47 +00:00
Ulf Hermann
900b57ea90 Re-blacklist tst_QEventDispatcher::registerTimer() on macOS
The test has been failing over and over since it was removed from the
blacklist. Obviously it is not stable.

This is a partial revert of commit
b10ee45546.

Task-number: QTBUG-71773
Change-Id: Ie2588538ee704652c2f09ce6ad947da3011e7dad
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-11-15 12:08:20 +00:00
Ulf Hermann
16830c827b Make sure QEventDispatcher::registerTimer() cleans up after itself
The test needs to also unregister its timers when it fails. Therefore,
wrap the registering and unregistering in an RAII class.

Task-number: QTBUG-71773
Change-Id: I6ef44e580880deecb32763b5b0cd71e1c26929be
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-11-15 12:08:11 +00:00
Tor Arne Vestbø
d804146ced macOS: Remove incorrect statement about layer-backing in changelog
Change-Id: Id31783227690445d06c21fcab40db1042d2fb33f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-11-15 06:49:57 +00:00
Andre de la Rocha
ad2c7f5883 Windows QPA: Fix input context visibility status
QWindowsInputContext::isInputPanelVisible() was ignoring the visibility
status of the IME, only returning the status of the Win10 virtual keyboard.
This issue caused qtwebengine to try to show the IME multiple times,
breaking Asian languages input.

Task-number: QTBUG-71753
Change-Id: Iaa4cef37b7dc98a9e0a787750a34d2e98a87a777
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-11-15 06:49:48 +00:00
Lars Knoll
c3d2d83fcb Correctly initialize the logClusters array for tabs and objects
The logclusters where never correctly initialized for tabs or
inline objects.

Change-Id: I376fd2dba19994eb5add24cdb8a93c38bde8cd1e
Fixes: QTBUG-70946
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-11-14 20:16:31 +00:00
Laszlo Agocs
800cd53c7e Increase QOpenGLTextureCache max size
From 64 to 256 MB. Note that this is especially important
because bindTexture() will fail and return an invalid
texture for image data larger than this. That is not ideal
but is trickier to correct. Until that is available, increase
the cache size to alleviate the pain somewhat.

Task-number: QTBUG-59207
Change-Id: Ibc22524acad0b42a632eb7e4cd8ea86225174837
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-11-14 20:15:47 +00:00
Friedemann Kleint
ae0cacb383 QFileDialog: Document that options need to be applied first
Flesh out the existing note on QFileDialog::setOptions(),
add it to QFileDialog::setOption() and add a small note
to the DontUseNativeDialogs option value.

Fixes: QTBUG-68590
Change-Id: I3a2011c8210d499114b01dfe09ad2dc797dfc2ab
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2018-11-14 20:15:04 +00:00
Anton Kudryavtsev
67c29f15bd QPixmapFilter: use rvalue more
Change-Id: I38b84d0cd1db10078ef663a64e62717fedf7697c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-11-14 20:14:34 +00:00
Oliver Wolff
6bdf1e337d tst_qguieventdispatcher: Sync blacklist with tst_qeventdispatcher
Windows and WinRT only have on event dispatcher class so that failing
test cases in one test will most likely also happen in the other.

Change-Id: Ib047c6870e6e02f3cf8deaaa6e438ed0ac7e2d5a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-11-14 18:36:05 +00:00
Allan Sandfeld Jensen
a52d7861ed Fix compile issue with gcc 9
It appears messenne_twisters in the latest libstdc++ has one more
requirement before it is willing to construct with our
SystemGenerator struct as an sseq provider.

Change-Id: If38151d1fa6f40a80274acc26d9ed6b4ac6049fe
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-11-14 18:35:59 +00:00
Friedemann Kleint
79af4ec056 Manual dialogs test: Fix shortcut
Fix:
QAction::event: Ambiguous shortcut overload: Ctrl+Q

when pressing CTRL+Q

Amends b5eb850e0d .

Change-Id: Ie31d5830ea357cd34cdd422e667ceca507c7b53f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2018-11-14 18:35:51 +00:00
Edward Welbourne
cd201b2c2c Adjust QTRY_IMPL()'s default timestep
It was previously using 50ms steps, which was a bad choice for client
code whose total time-out was comparable to 50ms or less.  Reduce the
time-step so that we loop several times within the timeout (but make
sure it's never zero, by adding 1ms).

Change-Id: I0428a7741c0741dfb312e40ae1eda900050195ab
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2018-11-14 14:40:08 +00:00
Andre de la Rocha
d9200fcac5 Windows QPA: Fix broken focus for native child windows
This issue was caused by missing logic in the implementation of the
pointer message handler, necessary to support "click to focus" for
native child windows.

Fixes: QTBUG-71352
Change-Id: I2e261caa8dfab096647799ec1e7d781bec40654e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-11-14 10:43:43 +00:00
Antti Kokko
98a445fa23 Add changes file for Qt 5.12.0
Edited-by: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: I65a59400c802db282fdbd87b1b9b89e9e5e962f6
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tuukka Turunen <tuukka.turunen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-11-14 07:17:45 +00:00
Oliver Wolff
299734c3ee Revert "Revert "qmake: Work around MSVC compiler bug.""
The assert still happens on MSVC 2015 64 bit when running
qmake -tp vc -r.

This reverts commit f4169a633b.

Fixes: QTBUG-71228
Change-Id: I05bd3e0677414edb970f07e0555cdc95ce32f592
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 4be8168ff7)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-11-14 07:15:11 +00:00
Tor Arne Vestbø
ee3c66ca91 macOS: Disable threaded GL rendering on SDK 10.14+
AppKit expects rendering to happen on the main thread, or at least any
interaction with AppKit UI classes such as NSView. Our OpenGL helpers,
such as QOpenGLContext, do not enforce this, and we may end up calling
into AppKit UI classes on the render thread, deadlocking the application.

Until this can be investigated and new APIs possibly introduced that allow
a more fine grained control in our own classes, we disable threaded GL
as a capability of the platform, which will inform clients such as
QtQuick to use the basic render loop.

[ChangeLog][macOS] Threaded OpenGL usage has been disabled when building
using Xcode 10/SDK 10.14 and later. Qt Quick defaults to the 'basic' render
loop now on macOS.

Task-number: QTBUG-71731
Change-Id: I6fc3295e833ecd48ad49382b8275c762fa7978a6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-11-13 12:48:07 +00:00
Allan Sandfeld Jensen
2393551665 Fix precision in parsing hex format QColors
We document being able to parse more than 8-bit per color, but were
ignoring everything after the first 8 bits.

Change-Id: Ic85ab04b0836e6979a623e294eebd5084c1a9478
Fixes: QTBUG-71373
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2018-11-12 22:18:43 +00:00
Andy Shaw
1446cde812 Android: Make sure that the path is using / for separators
When passing \ to Gradle it will strip these out, so by using / it
ensures that it is able to find the Android SDK directory fine.

Change-Id: I053f087438ade6c30d015abe00e9958beb90a947
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-11-12 18:59:45 +00:00
Edward Welbourne
15b1c3fd9b Purge some unused code for the OpenGL library name
We had a global static, a setter for it (that's nowhere used within Qt
code) and a getter for it whose only use was commented out.  Neither
was declared in any header; the getter's commented-out client had a
local extern declaration at the point of (non-)use.

Found while reviewing a change to the next few lines of code after the
commented-out use of the getter.

Change-Id: I393d56219cb7dd7cf836ca80e1bdd605a2914003
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-11-12 14:58:54 +00:00
Christian Ehrlicher
8c685b765b Itemviews: Cleanup examples
Cleanup some minor issues in the chart example:
 - remove unused members
 - use initializer list for members
 - pass a proper role to dataChanged()
 - honor roles parameter in PieView::dataChanged()
 - use nullptr instead 0
 - use new-style connect
 - fix indentation and other whitespaces

Change-Id: Idb212b07c006fe3ae31bee9cd9b1ba4d03043b5e
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2018-11-12 13:01:30 +00:00
Dmitry Shachnev
1c957bb8e5 Fix ambiguous definition of atime/mtime/ctime on alpha
One of the implementations is enabled when the stat struct has
::st_atim member, another — when it has ::st_atimensec member.

On alpha, the stat struct has both members, defined as union here:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/alpha/bits/stat.h#l48

and then used here:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/alpha/bits/stat.h#l92

This commit forcefully disables the second implementation on alpha.

Change-Id: Ifc284d72b68b9bac590b518f31960288df3a087d
Done-with: Michael Cree <mcree@orcon.net.nz>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-11-12 13:01:25 +00:00
Samuel Gaist
178bc49ac2 QImageWriter: improve documentation regarding use of resources
QImageWriter's plugin can open devices while operating and only free
them on destruction which means that if one wants to act on the file
written if must first destroy the writer's instance. This patch adds
the suggestion to use a scope to avoid that problem.

Change-Id: I239157ea86c4a93faab237fe1860312a3c7ac7a2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2018-11-12 13:01:20 +00:00
Filippo Cucchetto
104200d688 Fix QFileSystemWatcher::removePath after move operations
Foreword:
- During a file or directory move the inotify id for an
  entity is not changed.
- QFileSystemWatcher implementation uses a QMultiHash for
  mapping an id to its path.

Suppose this filesystem hypothetical directory structure
- A
|--> B
and user watches both A and B directories.

Suppose that the B directory gets moved by calling "mv B B1".
The user receives a directoryChanged event for parent directory
A and scan filesystem for changes. During this scan the
user notices:
- a new directory B1
- a deleted directory B
The user simply invoke QFileSystemWatcher::addPath(B1) and
QFileSystemWatcher::removePath(B).

With the actual implementation the second operation could fail:
- The call QFileSystemWatcher::addPath(B1) insert a duplicated
  records in the QFileSystemWatcher::idToPath
  multihash ( {0, "A"}, {1, "A/B"} {1, "A/B1"}
- The call QFileSystemWatcher::removePath(B) fails because
  - it first retrieves the the id for path B ---> pathToId("A/B")  <-- return 1
  - Then it calls idToPath.take with the id obtain in the
    previous step <--- idToPath.take(1)
This last operation could take the record {1, "A/B1"} instead
of the {1, "A/B"} (because both have the same key) meaning that
the next check "x != path" evaluates to true (making the
removePath function fail).

This patch fixes the problem in the following way:
- Use idToPath.equal_range in order to obtain all paths with
  the given id
- Remove the correct record that match (id, path)
- Prevent the removal of the inotify watch if another record
  with the same id is still present in the multihash (like a
  simple reference counting).

Change-Id: I9c8480b2a869d91e500af5c4aded596b9aa53b46
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-11-12 13:01:15 +00:00
Paul Olav Tvete
ac4f075274 Make sure mouse release events are delivered to correct widget
The initial mouse press should create an implicit mouse grab so
that all subsequent mouse events are delivered to the widget that
was pressed first. After commit a4f7bb8733, every mouse press
would reset the implicit grab. This change checks the previous
button state, and does not reset the mouse grab if other buttons
are already pressed.

Fixes: QTBUG-70816
Change-Id: Icdd215c2f4aaee3c3f34607d68c1d8878155ec17
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2018-11-12 13:01:10 +00:00