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) {
|
if (moveCursor) {
|
||||||
control->setTextCursor(cursor);
|
control->setTextCursor(cursor, moveMode == QTextCursor::KeepAnchor);
|
||||||
pageUpDownLastCursorYIsValid = true;
|
pageUpDownLastCursorYIsValid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ void QTextEditPrivate::pageUpDown(QTextCursor::MoveOperation op, QTextCursor::Mo
|
|||||||
vbar->triggerAction(QAbstractSlider::SliderPageStepAdd);
|
vbar->triggerAction(QAbstractSlider::SliderPageStepAdd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
control->setTextCursor(cursor);
|
control->setTextCursor(cursor, moveMode == QTextCursor::KeepAnchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_CONFIG(scrollbar)
|
#if QT_CONFIG(scrollbar)
|
||||||
|
@ -1944,10 +1944,15 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unknown)
|
if (unknown) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
else
|
} else {
|
||||||
|
#ifndef QT_NO_CLIPBOARD
|
||||||
|
if (QApplication::clipboard()->supportsSelection())
|
||||||
|
copy(QClipboard::Selection);
|
||||||
|
#endif
|
||||||
event->accept();
|
event->accept();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWidgetLineControl::isUndoAvailable() const
|
bool QWidgetLineControl::isUndoAvailable() const
|
||||||
|
@ -923,7 +923,7 @@ QTextDocument *QWidgetTextControl::document() const
|
|||||||
return d->doc;
|
return d->doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWidgetTextControl::setTextCursor(const QTextCursor &cursor)
|
void QWidgetTextControl::setTextCursor(const QTextCursor &cursor, bool selectionClipboard)
|
||||||
{
|
{
|
||||||
Q_D(QWidgetTextControl);
|
Q_D(QWidgetTextControl);
|
||||||
d->cursorIsFocusIndicator = false;
|
d->cursorIsFocusIndicator = false;
|
||||||
@ -937,6 +937,11 @@ void QWidgetTextControl::setTextCursor(const QTextCursor &cursor)
|
|||||||
d->repaintOldAndNewSelection(oldSelection);
|
d->repaintOldAndNewSelection(oldSelection);
|
||||||
if (posChanged)
|
if (posChanged)
|
||||||
emit cursorPositionChanged();
|
emit cursorPositionChanged();
|
||||||
|
|
||||||
|
#ifndef QT_NO_CLIPBOARD
|
||||||
|
if (selectionClipboard)
|
||||||
|
d->setClipboardSelection();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextCursor QWidgetTextControl::textCursor() const
|
QTextCursor QWidgetTextControl::textCursor() const
|
||||||
@ -1226,6 +1231,9 @@ void QWidgetTextControlPrivate::keyPressEvent(QKeyEvent *e)
|
|||||||
if (e == QKeySequence::SelectAll) {
|
if (e == QKeySequence::SelectAll) {
|
||||||
e->accept();
|
e->accept();
|
||||||
q->selectAll();
|
q->selectAll();
|
||||||
|
#ifndef QT_NO_CLIPBOARD
|
||||||
|
setClipboardSelection();
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifndef QT_NO_CLIPBOARD
|
#ifndef QT_NO_CLIPBOARD
|
||||||
@ -1377,6 +1385,10 @@ process:
|
|||||||
|
|
||||||
accept:
|
accept:
|
||||||
|
|
||||||
|
#ifndef QT_NO_CLIPBOARD
|
||||||
|
setClipboardSelection();
|
||||||
|
#endif
|
||||||
|
|
||||||
e->accept();
|
e->accept();
|
||||||
cursorOn = true;
|
cursorOn = true;
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ public:
|
|||||||
void setDocument(QTextDocument *document);
|
void setDocument(QTextDocument *document);
|
||||||
QTextDocument *document() const;
|
QTextDocument *document() const;
|
||||||
|
|
||||||
void setTextCursor(const QTextCursor &cursor);
|
void setTextCursor(const QTextCursor &cursor, bool selectionClipboard = false);
|
||||||
QTextCursor textCursor() const;
|
QTextCursor textCursor() const;
|
||||||
|
|
||||||
void setTextInteractionFlags(Qt::TextInteractionFlags flags);
|
void setTextInteractionFlags(Qt::TextInteractionFlags flags);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user