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

Method copy

src/backend/core/AbstractAspect.cpp:733–762  ·  view source on GitHub ↗

! * copies the aspect to the clipboard. The standard XML-serialization * via AbstractAspect::load() is used. */

Source from the content-addressed store, hash-verified

731 * via AbstractAspect::load() is used.
732 */
733void AbstractAspect::copy() {
734 QString output;
735 QXmlStreamWriter writer(&output);
736 writer.writeStartDocument();
737
738 // add LabPlot's copy&paste "identifier"
739 writer.writeDTD(QLatin1String("<!DOCTYPE LabPlotCopyPasteXML>"));
740 writer.writeStartElement(QStringLiteral("copy_content")); // root element
741
742 // write the type of the copied aspect
743 writer.writeStartElement(QStringLiteral("type"));
744 writer.writeAttribute(QStringLiteral("value"), QString::number(static_cast<int>(m_type)));
745 writer.writeEndElement();
746
747 setSuppressWriteUuid(true);
748 const auto& children = this->children(AspectType::AbstractAspect, {ChildIndexFlag::IncludeHidden, ChildIndexFlag::Recursive});
749 for (const auto& child : children)
750 child->setSuppressWriteUuid(true);
751
752 // write the aspect itself
753 save(&writer);
754
755 for (const auto& child : children)
756 child->setSuppressWriteUuid(false);
757 setSuppressWriteUuid(false);
758
759 writer.writeEndElement(); // end the root-element
760 writer.writeEndDocument();
761 QApplication::clipboard()->setText(output);
762}
763
764/*!
765 * duplicates the aspect in the project hierarchy, the copy of the duplicated aspect is

Callers

nothing calls this directly

Calls 3

childrenMethod · 0.95
setSuppressWriteUuidMethod · 0.80
setTextMethod · 0.45

Tested by

no test coverage detected