Fix populating selection clipboard with keyboard
Task-number: QTBUG-59879 Change-Id: I6948919fc90995c60a34b5bd6b4a225c1a59fd9b Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 976f28e7bb7cddb11459600f293868abcf7da948) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
257caeec0a
commit
3947279d68
@ -962,7 +962,7 @@ void QPlainTextEditPrivate::pageUpDown(QTextCursor::MoveOperation op, QTextCurso
|
||||
}
|
||||
|
||||
if (moveCursor) {
|
||||
control->setTextCursor(cursor);
|
||||
control->setTextCursor(cursor, moveMode == QTextCursor::KeepAnchor);
|
||||
pageUpDownLastCursorYIsValid = true;
|
||||
}
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ void QTextEditPrivate::pageUpDown(QTextCursor::MoveOperation op, QTextCursor::Mo
|
||||
vbar->triggerAction(QAbstractSlider::SliderPageStepAdd);
|
||||
}
|
||||
}
|
||||
control->setTextCursor(cursor);
|
||||
control->setTextCursor(cursor, moveMode == QTextCursor::KeepAnchor);
|
||||
}
|
||||
|
||||
#if QT_CONFIG(scrollbar)
|
||||
|
@ -1944,10 +1944,15 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
|
||||
return;
|
||||
}
|
||||
|
||||
if (unknown)
|
||||
if (unknown) {
|
||||
event->ignore();
|
||||
else
|
||||
} else {
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
if (QApplication::clipboard()->supportsSelection())
|
||||
copy(QClipboard::Selection);
|
||||
#endif
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
||||
bool QWidgetLineControl::isUndoAvailable() const
|
||||
|
@ -923,7 +923,7 @@ QTextDocument *QWidgetTextControl::document() const
|
||||
return d->doc;
|
||||
}
|
||||
|
||||
void QWidgetTextControl::setTextCursor(const QTextCursor &cursor)
|
||||
void QWidgetTextControl::setTextCursor(const QTextCursor &cursor, bool selectionClipboard)
|
||||
{
|
||||
Q_D(QWidgetTextControl);
|
||||
d->cursorIsFocusIndicator = false;
|
||||
@ -937,6 +937,11 @@ void QWidgetTextControl::setTextCursor(const QTextCursor &cursor)
|
||||
d->repaintOldAndNewSelection(oldSelection);
|
||||
if (posChanged)
|
||||
emit cursorPositionChanged();
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
if (selectionClipboard)
|
||||
d->setClipboardSelection();
|
||||
#endif
|
||||
}
|
||||
|
||||
QTextCursor QWidgetTextControl::textCursor() const
|
||||
@ -1226,6 +1231,9 @@ void QWidgetTextControlPrivate::keyPressEvent(QKeyEvent *e)
|
||||
if (e == QKeySequence::SelectAll) {
|
||||
e->accept();
|
||||
q->selectAll();
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
setClipboardSelection();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
@ -1377,6 +1385,10 @@ process:
|
||||
|
||||
accept:
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
setClipboardSelection();
|
||||
#endif
|
||||
|
||||
e->accept();
|
||||
cursorOn = true;
|
||||
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
void setDocument(QTextDocument *document);
|
||||
QTextDocument *document() const;
|
||||
|
||||
void setTextCursor(const QTextCursor &cursor);
|
||||
void setTextCursor(const QTextCursor &cursor, bool selectionClipboard = false);
|
||||
QTextCursor textCursor() const;
|
||||
|
||||
void setTextInteractionFlags(Qt::TextInteractionFlags flags);
|
||||
|
Loading…
x
Reference in New Issue
Block a user