| 118 | } |
| 119 | |
| 120 | void |
| 121 | NodeGraph::copySelectedNodes() |
| 122 | { |
| 123 | if ( _imp->_selection.empty() ) { |
| 124 | Dialogs::warningDialog( tr("Copy").toStdString(), tr("You must select at least a node to copy first.").toStdString() ); |
| 125 | |
| 126 | return; |
| 127 | } |
| 128 | |
| 129 | NodeClipBoard& cb = appPTR->getNodeClipBoard(); |
| 130 | _imp->copyNodesInternal(_imp->_selection, cb); |
| 131 | |
| 132 | std::ostringstream ss; |
| 133 | try { |
| 134 | boost::archive::xml_oarchive oArchive(ss); |
| 135 | oArchive << boost::serialization::make_nvp("Clipboard", cb); |
| 136 | } catch (...) { |
| 137 | qDebug() << "Failed to copy selection to system clipboard"; |
| 138 | } |
| 139 | |
| 140 | QMimeData* mimedata = new QMimeData; |
| 141 | QByteArray data( ss.str().c_str() ); |
| 142 | mimedata->setData(QLatin1String("text/plain"), data); |
| 143 | QClipboard* clipboard = QApplication::clipboard(); |
| 144 | |
| 145 | //ownership is transferred to the clipboard |
| 146 | clipboard->setMimeData(mimedata); |
| 147 | } |
| 148 | |
| 149 | void |
| 150 | NodeGraph::cutSelectedNodes() |
nothing calls this directly
no test coverage detected