Skip to content

Commit

Permalink
fix: read-only mode cannot drag text.
Browse files Browse the repository at this point in the history
Change-Id: I530619ddd307b5de1efbcee78050fc4df89ddcc7
rekols committed Sep 25, 2018
1 parent 1e90cbc commit a3e4398
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/dtextedit.cpp
Original file line number Diff line number Diff line change
@@ -1428,6 +1428,10 @@ void DTextEdit::keyPressEvent(QKeyEvent *keyEvent)
copyLines();
} else if (key == Utils::getKeyshortcutFromKeymap(m_settings, "editor", "togglereadonlymode")) {
toggleReadOnlyMode();
} else {
// If press another key
// the main window does not receive
keyEvent->ignore();
}
} else {
if (key == Utils::getKeyshortcutFromKeymap(m_settings, "editor", "indentline")) {
@@ -2379,6 +2383,10 @@ void DTextEdit::dragEnterEvent(QDragEnterEvent *event)

void DTextEdit::dragMoveEvent(QDragMoveEvent *event)
{
if (m_readOnlyMode) {
return;
}

const QMimeData *data = event->mimeData();

if (data->hasUrls()) {
@@ -2394,7 +2402,7 @@ void DTextEdit::dropEvent(QDropEvent *event)

if (data->hasUrls() && data->urls().first().isLocalFile()) {
qobject_cast<Window *>(this->window())->requestDropEvent(event);
} else if (data->hasText()) {
} else if (data->hasText() && !m_readOnlyMode) {
QPlainTextEdit::dropEvent(event);
}
}

0 comments on commit a3e4398

Please sign in to comment.