mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Fix copying to clipboard from JS scripts
This commit is contained in:
parent
3879626205
commit
885801c5ca
2 changed files with 16 additions and 0 deletions
|
@ -411,6 +411,11 @@ int WindowScriptingInterface::getY() {
|
|||
}
|
||||
|
||||
void WindowScriptingInterface::copyToClipboard(const QString& text) {
|
||||
if (QThread::currentThread() != qApp->thread()) {
|
||||
QMetaObject::invokeMethod(this, "copyToClipboard", Q_ARG(QString, text));
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "Copying";
|
||||
QApplication::clipboard()->setText(text);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <QJsonDocument>
|
||||
#include <QRegExp>
|
||||
#include <QStringList>
|
||||
#include <QThread>
|
||||
|
||||
#include <BuildInfo.h>
|
||||
#include <GLMHelpers.h>
|
||||
|
@ -761,11 +762,21 @@ void AddressManager::refreshPreviousLookup() {
|
|||
}
|
||||
|
||||
void AddressManager::copyAddress() {
|
||||
if (QThread::currentThread() != qApp->thread()) {
|
||||
QMetaObject::invokeMethod(this, "copyAddress");
|
||||
return;
|
||||
}
|
||||
|
||||
// assume that the address is being copied because the user wants a shareable address
|
||||
QApplication::clipboard()->setText(currentShareableAddress().toString());
|
||||
}
|
||||
|
||||
void AddressManager::copyPath() {
|
||||
if (QThread::currentThread() != qApp->thread()) {
|
||||
QMetaObject::invokeMethod(this, "copyPath");
|
||||
return;
|
||||
}
|
||||
|
||||
QApplication::clipboard()->setText(currentPath());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue