src/editmodes/magicWandMode.cpp

Sun, 11 Mar 2018 16:13:22 +0200

author
Santeri Piippo
date
Sun, 11 Mar 2018 16:13:22 +0200
changeset 1280
5c30efc9032b
parent 1251
e75cc5bff076
child 1326
69a90bd2dba2
permissions
-rw-r--r--

fixed: LDDocument created one removal connection to the model for each object added, so removing an object from a model of 9 objects added 9 deletion entries to history

818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
1072
9ce9496427f2 Happy new year 2017!
Teemu Piippo <teemu@hecknology.net>
parents: 1065
diff changeset
3 * Copyright (C) 2013 - 2017 Teemu Piippo
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 819
diff changeset
19 #include <QMouseEvent>
830
a741a0b9df49 - updated filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents: 828
diff changeset
20 #include "magicWandMode.h"
1145
02264bf0108d Renamed ldDocument.cpp → lddocument.cpp
Teemu Piippo <teemu@hecknology.net>
parents: 1139
diff changeset
21 #include "../lddocument.h"
962
a4b463a7ee82 Rename MainWindow files
Teemu Piippo <crimsondusk64@gmail.com>
parents: 952
diff changeset
22 #include "../mainwindow.h"
1104
edddb9b0db9e Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents: 1073
diff changeset
23 #include "../canvas.h"
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
25 MagicWandMode::MagicWandMode(Canvas* canvas) :
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
26 Super {canvas}
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 {
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
28 QSet<LineSegment> boundarySegments;
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
29
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 // Get vertex<->object data
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
31 for (const QModelIndex& index : currentDocument()->indices())
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 {
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 // Note: this deliberately only takes vertex-objects into account.
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 // The magic wand does not process subparts.
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
35 LDObject* object = currentDocument()->lookup(index);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
36
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
37 for (int i = 0; i < object->numVertices(); ++i)
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
38 {
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
39 LineSegment segment {
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
40 object->vertex(i),
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
41 object->vertex((i + 1) % object->numVertices())
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
42 };
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
43 m_vertices[object->vertex(i)].insert(index);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
44
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
45 if (object->type() == LDObjectType::EdgeLine)
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
46 boundarySegments.insert(segment);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
47 else
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
48 this->segments[segment].insert(index);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
49 }
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 }
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
51
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
52 // Remove all edge lines from the set of available segments because they get in the way.
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
53 for (const LineSegment& boundarySegment : boundarySegments)
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
54 this->segments.remove(boundarySegment);
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 }
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 819
diff changeset
57 EditModeType MagicWandMode::type() const
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 819
diff changeset
58 {
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 819
diff changeset
59 return EditModeType::MagicWand;
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 819
diff changeset
60 }
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 819
diff changeset
61
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
62 void MagicWandMode::edgeFill(
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
63 QModelIndex index,
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
64 QItemSelection& selection,
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
65 QSet<QModelIndex>& processed
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
66 ) const {
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
67 QItemSelection result;
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
68 processed.insert(index);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
69 result.select(index, index);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
70 QSet<QPersistentModelIndex> candidates;
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
71 LDObject* object = currentDocument()->lookup(index);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
72
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
73 // Get the list of objects that touch this object, i.e. share a vertex with it.
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
74 for (int i = 0; i < object->numVertices(); ++i)
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
75 candidates |= m_vertices[object->vertex(i)];
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
76
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
77 candidates.remove(index);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
78
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
79 for (const QModelIndex& candidate : candidates)
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 {
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
81 LDObject* candidateObject = currentDocument()->lookup(candidate);
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
83 if (candidateObject->type() == LDObjectType::EdgeLine
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
84 and candidateObject->color() == object->color()
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
85 ) {
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
86 selection.select(candidate, candidate);
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
88 if (not processed.contains(candidate))
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
89 edgeFill(candidate, selection, processed);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
90 }
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
91 }
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
92 }
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
93
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
94 void MagicWandMode::surfaceFill(
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
95 QModelIndex index,
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
96 QItemSelection& selection,
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
97 QSet<QModelIndex>& processed
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
98 ) const {
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
99 LDObject* object = currentDocument()->lookup(index);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
100 selection.select(index, index);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
101 processed.insert(index);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
102
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
103 for (int i = 0; i < object->numVertices(); i += 1)
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
104 {
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
105 Vertex v_1 = object->vertex(i);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
106 Vertex v_2 = object->vertex((i + 1) % object->numVertices());
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
107 LineSegment segment {v_1, v_2};
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
108
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
109 for (const QModelIndex& candidate : this->segments[segment])
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110 {
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
111 if (currentDocument()->lookup(candidate)->color() == object->color())
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
112 {
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
113 selection.select(candidate, candidate);
833
ad681d97d341 - magic wand: when flood-selecting surfaces, also pick any matching conditional lines
Santeri Piippo <crimsondusk64@gmail.com>
parents: 830
diff changeset
114
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
115 if (not processed.contains(candidate))
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
116 surfaceFill(candidate, selection, processed);
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
117 }
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
118 }
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
119 }
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
120 }
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
121
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
122 QItemSelection MagicWandMode::doMagic(const QModelIndex& index) const
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
123 {
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
124 QItemSelection selection;
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
125 LDObject* object = currentDocument()->lookup(index);
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
126
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
127 if (object)
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128 {
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
129 QSet<QModelIndex> processed;
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
130
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
131 if (object->type() == LDObjectType::EdgeLine)
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
132 edgeFill(index, selection, processed);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
133 else if (object->numPolygonVertices() >= 3)
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
134 surfaceFill(index, selection, processed);
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
135 }
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
136
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
137 return selection;
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
138 }
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 819
diff changeset
139
824
6add2126e7ff - more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents: 823
diff changeset
140 bool MagicWandMode::mouseReleased (MouseEventData const& data)
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 819
diff changeset
141 {
824
6add2126e7ff - more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents: 823
diff changeset
142 if (Super::mouseReleased (data))
6add2126e7ff - more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents: 823
diff changeset
143 return true;
6add2126e7ff - more work on edit modes
Santeri Piippo <crimsondusk64@gmail.com>
parents: 823
diff changeset
144
840
d077dd19bf9a - changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents: 833
diff changeset
145 if (data.releasedButtons & Qt::LeftButton and not data.mouseMoved)
827
82469b40567e - now compiles
Santeri Piippo <crimsondusk64@gmail.com>
parents: 824
diff changeset
146 {
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
147 QItemSelection selection = this->doMagic(renderer()->pick(data.ev->x(), data.ev->y()));
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
148 QItemSelectionModel::SelectionFlags command = QItemSelectionModel::ClearAndSelect;
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 819
diff changeset
149
827
82469b40567e - now compiles
Santeri Piippo <crimsondusk64@gmail.com>
parents: 824
diff changeset
150 if (data.keymods & Qt::ShiftModifier)
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
151 command = QItemSelectionModel::Select;
967
eb586d3e1a6a elif -> else if
Teemu Piippo <crimsondusk64@gmail.com>
parents: 966
diff changeset
152 else if (data.keymods & Qt::ControlModifier)
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
153 command = QItemSelectionModel::Deselect;
827
82469b40567e - now compiles
Santeri Piippo <crimsondusk64@gmail.com>
parents: 824
diff changeset
154
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1240
diff changeset
155 renderer()->selectionModel()->select(selection, command);
827
82469b40567e - now compiles
Santeri Piippo <crimsondusk64@gmail.com>
parents: 824
diff changeset
156 return true;
82469b40567e - now compiles
Santeri Piippo <crimsondusk64@gmail.com>
parents: 824
diff changeset
157 }
82469b40567e - now compiles
Santeri Piippo <crimsondusk64@gmail.com>
parents: 824
diff changeset
158
82469b40567e - now compiles
Santeri Piippo <crimsondusk64@gmail.com>
parents: 824
diff changeset
159 return false;
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 819
diff changeset
160 }

mercurial