History

Fix copying to clipboard from JS scripts

Mohammed Nafees committed 8 years ago

Commit 885801c1 parent 38796262 files · +16 −0Browse files

Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 2 files). Show all

Unified · Split

interface/src/scripting/WindowScriptingInterface.cpp+5−0
@@ -411,6 +411,11 @@ int WindowScriptingInterface::getY() { · 410 unmodified lines
411411 }
412412
413413 void WindowScriptingInterface::copyToClipboard(const QString& text) {
414+ if (QThread::currentThread() != qApp->thread()) {
415+ QMetaObject::invokeMethod(this, "copyToClipboard", Q_ARG(QString, text));
416+ return;
417+ }
418+
414419 qDebug() << "Copying";
415420 QApplication::clipboard()->setText(text);
416421 }