This will chop a trailing linefeed for a single selected line, so you can paste it without
sending it. Note that the behavior for multi-line selecions is still the same (you'd be pasting
all but the last line in that case, which doesn't make much sense).
stringToClipboard(selection(), mode);
}
-void ChatScene::stringToClipboard(const QString &str, QClipboard::Mode mode) {
+void ChatScene::stringToClipboard(const QString &str_, QClipboard::Mode mode) {
+ QString str = str_;
+ // remove trailing linefeeds
+ if(str.endsWith('\n'))
+ str.chop(1);
+
switch(mode) {
case QClipboard::Clipboard:
QApplication::clipboard()->setText(str);