summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/qmldesigner/components/integration/designdocument.cpp4
-rw-r--r--src/plugins/qmldesigner/components/timelineeditor/timelineactions.cpp29
2 files changed, 7 insertions, 26 deletions
diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp
index 2b567a8e69..7f83f652e7 100644
--- a/src/plugins/qmldesigner/components/integration/designdocument.cpp
+++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp
@@ -50,6 +50,7 @@
#include <coreplugin/idocument.h>
#include <coreplugin/editormanager/editormanager.h>
#include <utils/algorithm.h>
+#include <timelineactions.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
@@ -473,6 +474,9 @@ static void scatterItem(const ModelNode &pastedNode, const ModelNode &targetNode
void DesignDocument::paste()
{
+ if (TimelineActions::clipboardContainsKeyframes()) // pasting keyframes is handled in TimelineView
+ return;
+
QScopedPointer<Model> pasteModel(DesignDocumentView::pasteToModel());
if (!pasteModel)
diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelineactions.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelineactions.cpp
index c9271e490c..74a543ae9d 100644
--- a/src/plugins/qmldesigner/components/timelineeditor/timelineactions.cpp
+++ b/src/plugins/qmldesigner/components/timelineeditor/timelineactions.cpp
@@ -33,13 +33,12 @@
#include <designdocumentview.h>
#include <nodelistproperty.h>
#include <nodemetainfo.h>
-#include <rewritertransaction.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <variantproperty.h>
-#include <qmldesignerplugin.h>
#include <qmlobjectnode.h>
#include <qmltimelinekeyframegroup.h>
+#include <QClipboard>
namespace QmlDesigner {
@@ -291,30 +290,8 @@ void TimelineActions::pasteKeyframes(AbstractView *timelineView, const QmlTimeli
bool TimelineActions::clipboardContainsKeyframes()
{
- QScopedPointer<Model> pasteModel(DesignDocumentView::pasteToModel());
-
- if (!pasteModel)
- return false;
-
- DesignDocumentView view;
- pasteModel->attachView(&view);
-
- if (!view.rootModelNode().isValid())
- return false;
-
- ModelNode rootNode = view.rootModelNode();
-
- if (!rootNode.hasAnySubModelNodes())
- return false;
-
- //Sanity check
- if (!QmlTimelineKeyframeGroup::checkKeyframesType(rootNode)) {
- for (const ModelNode &node : rootNode.directSubModelNodes())
- if (!QmlTimelineKeyframeGroup::checkKeyframesType(node))
- return false;
- }
-
- return true;
+ QRegularExpression rxp("\\bKeyframe\\s*{.*}", QRegularExpression::DotMatchesEverythingOption);
+ return rxp.match(QApplication::clipboard()->text()).hasMatch();
}
} // namespace QmlDesigner