Skip to content

Commit

Permalink
Fix lyrics pasting on Linux
Browse files Browse the repository at this point in the history
and relying more on the default mode
  • Loading branch information
Jojo-Schmitz committed May 15, 2023
1 parent 3d24e6a commit 3f36511
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
7 changes: 1 addition & 6 deletions libmscore/lyrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
4 changes: 2 additions & 2 deletions libmscore/textbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}

//---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion libmscore/textedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion mscore/scoreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 3f36511

Please sign in to comment.