Commit d86e0a2
committed
QRM: set ItemIsDrag/DropEnabled flags if there are mime types
Items in a read-only models that implement support for any mime type can
be dragged. If the model is mutable, then data can also be dropped on
items. In addition, items can also be dropped into invalid indexes, i.e.
into the empty areas of a view.
Since mimeTypes() is likely to construct a QStringList on each call, and
since that list is implementation-static and never changes, cache the
value.
[ChangeLog][QtCore][QRangeModel] The flags() implementation sets the
ItemIsDragEnabled flag for all items in a model that supports mime types
(including the default mime type), and the ItemIsDropEnabled flag for
items in models that are not read-only. ItemIsDropEnabled is also set
for the invalid index to allow dropping of data into empty spaces of a
view.
Task-number: QTBUG-145800
Change-Id: I81567e4a8a11e21eedb10ec4e542369e4c220260
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>1 parent 4261142 commit d86e0a2
5 files changed
Lines changed: 38 additions & 10 deletions
File tree
- src/corelib/itemmodels
- tests
- auto/corelib/itemmodels/qrangemodel
- manual/corelib/itemmodels/qrangemodel
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
1053 | 1054 | | |
1054 | 1055 | | |
1055 | 1056 | | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
1056 | 1064 | | |
1057 | 1065 | | |
1058 | 1066 | | |
| |||
1426 | 1434 | | |
1427 | 1435 | | |
1428 | 1436 | | |
1429 | | - | |
1430 | | - | |
1431 | | - | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
1432 | 1443 | | |
1433 | 1444 | | |
1434 | 1445 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1360 | 1360 | | |
1361 | 1361 | | |
1362 | 1362 | | |
1363 | | - | |
1364 | | - | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
1365 | 1369 | | |
1366 | 1370 | | |
1367 | 1371 | | |
| |||
1384 | 1388 | | |
1385 | 1389 | | |
1386 | 1390 | | |
1387 | | - | |
| 1391 | + | |
1388 | 1392 | | |
1389 | 1393 | | |
1390 | 1394 | | |
1391 | 1395 | | |
1392 | 1396 | | |
1393 | 1397 | | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
1394 | 1404 | | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
1395 | 1409 | | |
1396 | 1410 | | |
1397 | 1411 | | |
| |||
1416 | 1430 | | |
1417 | 1431 | | |
1418 | 1432 | | |
1419 | | - | |
| 1433 | + | |
1420 | 1434 | | |
1421 | 1435 | | |
1422 | 1436 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
776 | 776 | | |
777 | 777 | | |
778 | 778 | | |
| 779 | + | |
779 | 780 | | |
780 | 781 | | |
781 | 782 | | |
| |||
787 | 788 | | |
788 | 789 | | |
789 | 790 | | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
790 | 794 | | |
791 | 795 | | |
792 | 796 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
| 64 | + | |
66 | 65 | | |
67 | 66 | | |
68 | 67 | | |
| |||
0 commit comments