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)
This commit is contained in:
Arnaud Bienner 2015-10-15 19:45:08 +02:00
parent 5984c881c6
commit ab8c6dbb69

View File

@ -146,21 +146,17 @@ public:
} }
else if (keyString == "c") // Cmd+c else if (keyString == "c") // Cmd+c
{ {
QClipboard* clipboard = QApplication::clipboard(); [[self currentEditor] copy: nil];
clipboard->setText(toQString([self stringValue]));
return YES; return YES;
} }
else if (keyString == "v") // Cmd+v else if (keyString == "v") // Cmd+v
{ {
QClipboard* clipboard = QApplication::clipboard(); [[self currentEditor] paste: nil];
[self setStringValue:fromQString(clipboard->text())];
return YES; return YES;
} }
else if (keyString == "x") // Cmd+x else if (keyString == "x") // Cmd+x
{ {
QClipboard* clipboard = QApplication::clipboard(); [[self currentEditor] cut: nil];
clipboard->setText(toQString([self stringValue]));
[self setStringValue:@""];
return YES; return YES;
} }
} }