mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
LineEdit: Fix slow text selection with mouse
Regression from 2c0582b9a1
This commit is contained in:
parent
b81c45486f
commit
f698c0a78f
13
src/lib/3rdparty/lineedit.cpp
vendored
13
src/lib/3rdparty/lineedit.cpp
vendored
@ -154,9 +154,10 @@ 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(updateActions()));
|
||||
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(updatePasteActions()));
|
||||
|
||||
updateActions();
|
||||
updatePasteActions();
|
||||
}
|
||||
|
||||
bool LineEdit::event(QEvent* event)
|
||||
@ -236,11 +237,19 @@ void LineEdit::updateActions()
|
||||
m_editActions[Redo]->setEnabled(!isReadOnly() && isRedoAvailable());
|
||||
m_editActions[Cut]->setEnabled(!isReadOnly() && hasSelectedText() && echoMode() == QLineEdit::Normal);
|
||||
m_editActions[Copy]->setEnabled(hasSelectedText() && echoMode() == QLineEdit::Normal);
|
||||
m_editActions[Paste]->setEnabled(!isReadOnly() && !QApplication::clipboard()->text().isEmpty());
|
||||
m_editActions[Delete]->setEnabled(!isReadOnly() && hasSelectedText());
|
||||
m_editActions[SelectAll]->setEnabled(!text().isEmpty() && selectedText() != text());
|
||||
}
|
||||
|
||||
void LineEdit::updatePasteActions()
|
||||
{
|
||||
// Paste actions are updated in separate slot because accessing clipboard is expensive
|
||||
bool pasteEnabled = !isReadOnly() && !QApplication::clipboard()->text().isEmpty();
|
||||
|
||||
m_editActions[Paste]->setEnabled(pasteEnabled);
|
||||
m_editActions[PasteAndGo]->setEnabled(pasteEnabled);
|
||||
}
|
||||
|
||||
void LineEdit::slotDelete()
|
||||
{
|
||||
if (hasSelectedText()) {
|
||||
|
1
src/lib/3rdparty/lineedit.h
vendored
1
src/lib/3rdparty/lineedit.h
vendored
@ -124,6 +124,7 @@ protected:
|
||||
|
||||
private slots:
|
||||
void updateActions();
|
||||
void updatePasteActions();
|
||||
void slotDelete();
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user