mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #13559 from wayne-chen/fixCopyAddress-case-16444
Fix AddressManager copyAddress/copyPath functionality
This commit is contained in:
commit
01610a1520
3 changed files with 15 additions and 3 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <QtCore/QFileSelector>
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
|
||||
#include <QtGui/QClipboard>
|
||||
#include <QtGui/QScreen>
|
||||
#include <QtGui/QWindow>
|
||||
#include <QtGui/QDesktopServices>
|
||||
|
@ -8320,6 +8321,16 @@ void Application::saveNextPhysicsStats(QString filename) {
|
|||
_physicsEngine->saveNextPhysicsStats(filename);
|
||||
}
|
||||
|
||||
void Application::copyToClipboard(const QString& text) {
|
||||
if (QThread::currentThread() != qApp->thread()) {
|
||||
QMetaObject::invokeMethod(this, "copyToClipboard");
|
||||
return;
|
||||
}
|
||||
|
||||
// assume that the address is being copied because the user wants a shareable address
|
||||
QApplication::clipboard()->setText(text);
|
||||
}
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
void Application::enterBackground() {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
|
||||
|
|
|
@ -310,6 +310,8 @@ public:
|
|||
void loadAvatarScripts(const QVector<QString>& urls);
|
||||
void unloadAvatarScripts();
|
||||
|
||||
Q_INVOKABLE void copyToClipboard(const QString& text);
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
void enterBackground();
|
||||
void enterForeground();
|
||||
|
|
|
@ -852,17 +852,16 @@ void AddressManager::refreshPreviousLookup() {
|
|||
|
||||
void AddressManager::copyAddress() {
|
||||
if (QThread::currentThread() != qApp->thread()) {
|
||||
QMetaObject::invokeMethod(this, "copyAddress");
|
||||
QMetaObject::invokeMethod(qApp, "copyToClipboard", Q_ARG(QString, currentShareableAddress().toString()));
|
||||
return;
|
||||
}
|
||||
|
||||
// assume that the address is being copied because the user wants a shareable address
|
||||
QGuiApplication::clipboard()->setText(currentShareableAddress().toString());
|
||||
}
|
||||
|
||||
void AddressManager::copyPath() {
|
||||
if (QThread::currentThread() != qApp->thread()) {
|
||||
QMetaObject::invokeMethod(this, "copyPath");
|
||||
QMetaObject::invokeMethod(qApp, "copyToClipboard", Q_ARG(QString, currentPath()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue