qt5base-lts/tests/auto
Volker Hilsheimer 0f1008a593 QAbstractItemView: don't lose items if model only allows MoveAction
If a model only allows MoveAction, then calls in the view/widget subclasses'
dropEvent implementation to set the event's drop action to CopyAction
will fail. QAbstractItemView will then remove the item when QDrag::exec
returns.

Instead of abusing the event actions for this, store explicitly that the
dropEvent implementation already moved the item. If the flag is set,
don't remove the item.

In QListView, which uses moveRow to move items in the dropEvent handler,
handle the case that the model might not implement moveRows. In that
case, or when dropping an item onto another item (to overwrite data),
fall back to the default implementation of QAbstractItemView. Sadly, it
is impossible to know whether a model doesn't implement moveRows, or
whether the move failed for other reasons, so this requires a bit of
extra special case handling. QListView in IconMode is particularly odd
in that it moves the item in the view, but not in the model.

This follows up on fd894fd68e and fixes
additional issues discovered during debugging. Extend the existing unit
test; since drag'n'drop runs a modal, native event loop on most systems,
it still only runs on the Xcb platform.

Change-Id: I6c5377e2b097c8080001afe904d6d3e4aed33df4
Pick-to: 5.15
Fixes: QTBUG-87057
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2020-10-16 13:53:03 +02:00
..
cmake Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
concurrent Loosen the requirements on the container passed to QtConcurrent::map* 2020-10-13 09:49:51 +02:00
corelib Fix warning in test: unused capture in lambda 2020-10-16 13:53:03 +02:00
dbus Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
gui Fallback to using the family when doing an exact match 2020-10-12 14:08:06 +02:00
guiapplauncher Move QStateMachine from QtCore to QtScxml 2020-08-24 20:10:25 +02:00
installed_cmake Add a unit test for testing Qt in its install location. 2013-07-02 23:08:54 +02:00
network QSslSocket (autotest) - defuse a time bomb 2020-10-16 05:21:34 +02:00
opengl Remove tst_QGL 2020-08-28 11:43:11 +02:00
other Get rid of all usage of QApplication:desktop 2020-10-14 06:38:43 +02:00
printsupport Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
shared Remove most compiler warnings about missing overrides 2020-09-11 00:20:47 +02:00
sql Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
testlib Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
tools Fix compile time type normalization code 2020-10-14 21:37:39 +02:00
widgets QAbstractItemView: don't lose items if model only allows MoveAction 2020-10-16 13:53:03 +02:00
xml CMake: Regenerate projects to use new qt_internal_ API 2020-09-23 16:59:06 +02:00
.prev_CMakeLists.txt CMake: Regenerate projects 2020-09-22 19:08:53 +02:00
auto.pro Don't error out when configuring Qt on a headless system 2020-09-26 14:36:13 +02:00
CMakeLists.txt CMake: Fix building with -DQT_FEATURE_gui=OFF 2020-09-15 20:05:32 +02:00
network-settings.h Revert "QAbstractSocket: deprecate 'error' member-function" 2020-02-26 23:07:52 +03:00