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
83068306 _physicsEngine->saveNextPhysicsStats(filename);
83078307 }
83088308
8309−void Application::copyAddress() {
8310− if (QThread::currentThread() != thread()) {
8311− QMetaObject::invokeMethod(this, "copyAddress");
8309+void Application::copyToClipboard(const QString& text) {
8310+ if (QThread::currentThread() != qApp->thread()) {
8311+ QMetaObject::invokeMethod(this, "copyToClipboard");
83128312 return;
83138313 }
83148314
83158315 // assume that the address is being copied because the user wants a shareable address
8316− QApplication::clipboard()->setText(QString("copyAddress worked!"));
8317−}
8318−
8319−void Application::copyPath() {
8320− if (QThread::currentThread() != thread()) {
8321− QMetaObject::invokeMethod(this, "copyPath");
8322− return;
8323− }
8324−
8325− QApplication::clipboard()->setText(QString("copyPath worked!"));
8316+ QApplication::clipboard()->setText(text);
83268317 }
83278318
83288319 #if defined(Q_OS_ANDROID)