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