mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Merge pull request #12171 from mnafees/21671
CR for Job #21671 - Window.copyToClipboard() doesn't work in .js files
This commit is contained in:
commit
7af90d5429
2 changed files with 16 additions and 0 deletions
|
@ -411,6 +411,11 @@ int WindowScriptingInterface::getY() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowScriptingInterface::copyToClipboard(const QString& text) {
|
void WindowScriptingInterface::copyToClipboard(const QString& text) {
|
||||||
|
if (QThread::currentThread() != qApp->thread()) {
|
||||||
|
QMetaObject::invokeMethod(this, "copyToClipboard", Q_ARG(QString, text));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
qDebug() << "Copying";
|
qDebug() << "Copying";
|
||||||
QApplication::clipboard()->setText(text);
|
QApplication::clipboard()->setText(text);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
#include <BuildInfo.h>
|
#include <BuildInfo.h>
|
||||||
#include <GLMHelpers.h>
|
#include <GLMHelpers.h>
|
||||||
|
@ -761,11 +762,21 @@ void AddressManager::refreshPreviousLookup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressManager::copyAddress() {
|
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
|
// assume that the address is being copied because the user wants a shareable address
|
||||||
QApplication::clipboard()->setText(currentShareableAddress().toString());
|
QApplication::clipboard()->setText(currentShareableAddress().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressManager::copyPath() {
|
void AddressManager::copyPath() {
|
||||||
|
if (QThread::currentThread() != qApp->thread()) {
|
||||||
|
QMetaObject::invokeMethod(this, "copyPath");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QApplication::clipboard()->setText(currentPath());
|
QApplication::clipboard()->setText(currentPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue