From 3f36511d7913eaa062ef3eafdac3ad5f141d3d2f Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Wed, 10 May 2023 17:38:31 +0200 Subject: [PATCH] Fix lyrics pasting on Linux and relying more on the default mode --- libmscore/lyrics.cpp | 7 +------ libmscore/textbase.cpp | 4 ++-- libmscore/textedit.cpp | 2 +- mscore/scoreview.cpp | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/libmscore/lyrics.cpp b/libmscore/lyrics.cpp index 9a92878546a9f..ea4766652c0e0 100644 --- a/libmscore/lyrics.cpp +++ b/libmscore/lyrics.cpp @@ -400,12 +400,7 @@ void Lyrics::layout2(int nAbove) void Lyrics::paste(EditData& ed) { MuseScoreView* scoreview = ed.view; -#if defined(Q_OS_MAC) || defined(Q_OS_WIN) - QClipboard::Mode mode = QClipboard::Clipboard; -#else - QClipboard::Mode mode = QClipboard::Selection; -#endif - QString txt = QApplication::clipboard()->text(mode); + QString txt = QApplication::clipboard()->text(); QString regex = QString("[^\\S") + QChar(0xa0) + QChar(0x202F) + "]+"; QStringList sl = txt.split(QRegExp(regex), QString::SkipEmptyParts); if (sl.empty()) diff --git a/libmscore/textbase.cpp b/libmscore/textbase.cpp index 297f97f4e6e2c..ea2519df2a05b 100644 --- a/libmscore/textbase.cpp +++ b/libmscore/textbase.cpp @@ -3042,7 +3042,7 @@ void TextBase::editCut(EditData& ed) QString s = _cursor->selectedText(); if (!s.isEmpty()) { - QApplication::clipboard()->setText(s, QClipboard::Clipboard); + QApplication::clipboard()->setText(s); ed.curGrip = Grip::START; ed.key = Qt::Key_Delete; ed.s = QString(); @@ -3063,7 +3063,7 @@ void TextBase::editCopy(EditData& ed) TextCursor* _cursor = &ted->cursor; QString s = _cursor->selectedText(); if (!s.isEmpty()) - QApplication::clipboard()->setText(s, QClipboard::Clipboard); + QApplication::clipboard()->setText(s); } //--------------------------------------------------------- diff --git a/libmscore/textedit.cpp b/libmscore/textedit.cpp index 233e463851e56..4bffbb977b17a 100644 --- a/libmscore/textedit.cpp +++ b/libmscore/textedit.cpp @@ -618,7 +618,7 @@ Element* TextBase::drop(EditData& ed) void TextBase::paste(EditData& ed) { - QString txt = QApplication::clipboard()->text(QClipboard::Clipboard); + QString txt = QApplication::clipboard()->text(); if (MScore::debugMode) qDebug("<%s>", qPrintable(txt)); diff --git a/mscore/scoreview.cpp b/mscore/scoreview.cpp index e8f53a846d91a..81fcf7093d7ef 100644 --- a/mscore/scoreview.cpp +++ b/mscore/scoreview.cpp @@ -1972,7 +1972,7 @@ void ScoreView::editSwap() QString s = text->selectedText(); text->paste(this); if (!s.isEmpty()) - QApplication::clipboard()->setText(s, QClipboard::Clipboard); + QApplication::clipboard()->setText(s); } #endif }