MCPcopy Create free account
hub / github.com/davy7125/polyphone / commitData

Method commitData

sources/editor/widgets/tablewidget.cpp:208–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208void TableWidget::commitData(QWidget *editor)
209{
210 emit actionBegin();
211 QTableWidget::commitData(editor);
212
213 QVariant value = model()->data(currentIndex(), Qt::EditRole).toString();
214 int curRow = currentIndex().row();
215 int curCol = currentIndex().column();
216 QItemSelectionRange isr;
217
218 foreach (isr, selectionModel()->selection())
219 {
220 for (int row = isr.top(); row <= isr.bottom(); row++)
221 {
222 for (int col = isr.left(); col <= isr.right(); col++)
223 {
224 if (!(curRow == row && curCol == col))
225 {
226 const QModelIndex idx = this->model()->index(row, col);
227
228 if (this->isInstrumentLevel())
229 {
230 // Copy the data but not in grayed columns
231 if (!this->isGrayed(row))
232 {
233 if (curRow == 5)
234 {
235 if (row == 5)
236 {
237 // Copy the data in UserRole
238 model()->setData(idx, model()->data(currentIndex(), Qt::UserRole), Qt::UserRole);
239 }
240 else
241 {
242 // Copy from the loop combobox to a regular cell => do nothing
243 }
244 }
245 else
246 {
247 if (row == 5)
248 {
249 // Copy to a regular cell to the loop combobox => do nothing
250 }
251 else
252 {
253 model()->setData(idx, value, Qt::EditRole);
254 }
255 }
256
257 }
258 }
259 else
260 model()->setData(idx, value, Qt::EditRole); // simple case
261 }
262 }
263 }
264 }
265 emit actionFinished();

Callers

nothing calls this directly

Calls 3

toStringMethod · 0.45
dataMethod · 0.45
rowMethod · 0.45

Tested by

no test coverage detected