History

adding Q_INVOKABLE method for copying to Application clipboard

Wayne Chen committed 8 years ago

Commit 0facbed1 parent 3994ec44 files · +10 −20Browse files

Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all

Unified · Split

interface/src/Application.cpp+4−13
@@ -8306,23 +8306,14 @@ void Application::saveNextPhysicsStats(QString filename) { · 8305 unmodified lines
8306 _physicsEngine->saveNextPhysicsStats(filename);8306 _physicsEngine->saveNextPhysicsStats(filename);
8307}8307}
8308 8308
8309void Application::copyAddress() {8309void Application::copyToClipboard(const QString& text) {
8310 if (QThread::currentThread() != thread()) {8310 if (QThread::currentThread() != qApp->thread()) {
8311 QMetaObject::invokeMethod(this, "copyAddress");8311 QMetaObject::invokeMethod(this, "copyToClipboard");
8312 return;8312 return;
8313 }8313 }
8314 8314
8315 // assume that the address is being copied because the user wants a shareable address8315 // assume that the address is being copied because the user wants a shareable address
8316 QApplication::clipboard()->setText(QString("copyAddress worked!"));8316 QApplication::clipboard()->setText(text);
8317}
8318
8319void Application::copyPath() {
8320 if (QThread::currentThread() != thread()) {
8321 QMetaObject::invokeMethod(this, "copyPath");
8322 return;
8323 }
8324
8325 QApplication::clipboard()->setText(QString("copyPath worked!"));
8326}8317}
8327 8318
8328#if defined(Q_OS_ANDROID)8319#if defined(Q_OS_ANDROID)