| 317 | } |
| 318 | |
| 319 | void ColorMapsWidget::detailsCopy(bool copyAll) { |
| 320 | auto* tw = ui.twColorMapDetails; |
| 321 | QString str; |
| 322 | QString rowStr; |
| 323 | |
| 324 | if (copyAll) { |
| 325 | for (int i = 1; i < tw->columnCount(); ++i) { |
| 326 | if (!str.isEmpty()) |
| 327 | str += QLatin1Char('\t'); |
| 328 | str += tw->horizontalHeaderItem(i)->text(); |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | // copy the content of the table |
| 333 | for (int i = 0; i < tw->rowCount(); ++i) { |
| 334 | for (int j = 0; j < tw->columnCount(); ++j) { |
| 335 | if (!tw->item(i, j)) |
| 336 | continue; |
| 337 | if (!copyAll && !tw->item(i, j)->isSelected()) |
| 338 | continue; |
| 339 | |
| 340 | if (!rowStr.isEmpty()) |
| 341 | rowStr += QLatin1Char('\t'); |
| 342 | |
| 343 | rowStr += tw->item(i, j)->text(); |
| 344 | } |
| 345 | if (!rowStr.isEmpty()) { |
| 346 | if (!str.isEmpty()) |
| 347 | str += QLatin1Char('\n'); |
| 348 | str += rowStr; |
| 349 | rowStr.clear(); |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | QApplication::clipboard()->setText(str); |
| 354 | DEBUG(STDSTRING(QApplication::clipboard()->text())); |
| 355 | } |
| 356 | |
| 357 | void ColorMapsWidget::detailsCopyAll() { |
| 358 | detailsCopy(true); |
nothing calls this directly
no test coverage detected