int InternalNodeProperty::indexOf(const InternalNode::Pointer &node) const { if (!node.isNull() && node == m_node) return 0; return -1; }
Paster::Paster(QMimeData *transferData, const InternalNode::Pointer &intoNode): m_targetNode(intoNode) { Q_ASSERT(!intoNode.isNull() && intoNode->isValid()); QList<TextLocation> locations = extractPasteData(transferData); m_pastedLocations = mergeNestedLocation(locations); }
/*! Inserts the copied data into the given node. \note The mime-type for the data must be <tt>"application/x-qt-bauhaus"</tt>, otherwise the paste will fail. \param transferData The clip-board contents to paste. \param intoNode The node into which the clip-board contents are to be pasted. \return true if successful, false otherwise. */ bool ModelRewriter::paste(QMimeData *transferData, const InternalNode::Pointer &intoNode) { if (!transferData) return false; if (intoNode.isNull() || !intoNode->isValid()) throw InvalidModelNodeException(__LINE__, Q_FUNC_INFO, __FILE__); Paster paster(transferData, intoNode); if (paster.doPaste(m_modelToTextMerger)) { if (!modificationGroupActive()) { m_modelToTextMerger.applyChanges(*m_textModifier); } return true; } else { m_modelToTextMerger.clear(); return false; } }