From ab8c6dbb698e78ca68255103c1cc7c9dfeebf18b Mon Sep 17 00:00:00 2001 From: Arnaud Bienner Date: Thu, 15 Oct 2015 19:45:08 +0200 Subject: [PATCH] Use Cocoa actions for search field copy/cut/paste instead of trying to reimplement the same thing with some Qt. So unlike previously, actions now also works as expected if some part of the text is selected, or if some text is already present (for paste action: doesn't replace previous text) --- 3rdparty/qocoa/qsearchfield_mac.mm | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/3rdparty/qocoa/qsearchfield_mac.mm b/3rdparty/qocoa/qsearchfield_mac.mm index d7c20deb5..29b5b06b8 100644 --- a/3rdparty/qocoa/qsearchfield_mac.mm +++ b/3rdparty/qocoa/qsearchfield_mac.mm @@ -146,21 +146,17 @@ public: } else if (keyString == "c") // Cmd+c { - QClipboard* clipboard = QApplication::clipboard(); - clipboard->setText(toQString([self stringValue])); + [[self currentEditor] copy: nil]; return YES; } else if (keyString == "v") // Cmd+v { - QClipboard* clipboard = QApplication::clipboard(); - [self setStringValue:fromQString(clipboard->text())]; + [[self currentEditor] paste: nil]; return YES; } else if (keyString == "x") // Cmd+x { - QClipboard* clipboard = QApplication::clipboard(); - clipboard->setText(toQString([self stringValue])); - [self setStringValue:@""]; + [[self currentEditor] cut: nil]; return YES; } }