1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

LineEdit: Don't query clipboard when its contents changes

Apparently it can hang in QXcbClipboard

Closes #1945
This commit is contained in:
David Rosca 2017-10-31 18:24:10 +01:00
parent 845d59e5d7
commit dcf1cfd96e

View File

@ -163,10 +163,8 @@ void LineEdit::init()
// Connections to update edit actions
connect(this, SIGNAL(textChanged(QString)), this, SLOT(updateActions()));
connect(this, SIGNAL(selectionChanged()), this, SLOT(updateActions()));
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(updatePasteActions()));
updateActions();
updatePasteActions();
}
bool LineEdit::event(QEvent* event)
@ -205,11 +203,11 @@ QMenu* LineEdit::createContextMenu()
popup->addAction(m_editActions[Copy]);
if (!isReadOnly()) {
updatePasteActions();
popup->addAction(m_editActions[Paste]);
if (!m_editActions[PasteAndGo]->text().isEmpty())
if (!m_editActions[PasteAndGo]->text().isEmpty()) {
popup->addAction(m_editActions[PasteAndGo]);
}
popup->addAction(m_editActions[Delete]);
popup->addAction(m_editActions[ClearAll]);
}
@ -238,6 +236,8 @@ void LineEdit::updateActions()
m_editActions[Copy]->setEnabled(hasSelectedText() && echoMode() == QLineEdit::Normal);
m_editActions[Delete]->setEnabled(!isReadOnly() && hasSelectedText());
m_editActions[SelectAll]->setEnabled(!text().isEmpty() && selectedText() != text());
m_editActions[Paste]->setEnabled(true);
m_editActions[PasteAndGo]->setEnabled(true);
}
void LineEdit::updatePasteActions()