MCPcopy Create free account
hub / github.com/KDE/labplot / detailsCopy

Method detailsCopy

src/frontend/colormaps/ColorMapsWidget.cpp:319–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319void 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
357void ColorMapsWidget::detailsCopyAll() {
358 detailsCopy(true);

Callers

nothing calls this directly

Calls 7

columnCountMethod · 0.45
isEmptyMethod · 0.45
textMethod · 0.45
rowCountMethod · 0.45
isSelectedMethod · 0.45
clearMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected