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

Added possibility to select text on page with Shift+Arrow keys.

Shift+Right Arrow        => select next char
Shift+Left Arrow         => select previous char
Shift+Ctrl+Right Arrow   => select next word
Shift+Ctrl+Left Arrow    => select previous word
Shift+Home               => select start of line
Shift+End                => select end of line
Shift+Ctrl+Home          => select start of document
Shift+Ctrl+End           => select end of document
This commit is contained in:
nowrep 2013-02-17 11:07:02 +01:00
parent 91c88872f8
commit 742326bde7
2 changed files with 71 additions and 1 deletions

View File

@ -1226,6 +1226,74 @@ void WebView::keyPressEvent(QKeyEvent* event)
}
break;
case Qt::Key_Up:
if (event->modifiers() & Qt::ShiftModifier) {
triggerPageAction(QWebPage::SelectPreviousLine);
event->accept();
return;
}
break;
case Qt::Key_Down:
if (event->modifiers() & Qt::ShiftModifier) {
triggerPageAction(QWebPage::SelectNextLine);
event->accept();
return;
}
break;
case Qt::Key_Left:
if (event->modifiers() & Qt::ShiftModifier) {
if (event->modifiers() == Qt::ShiftModifier) {
triggerPageAction(QWebPage::SelectPreviousChar);
}
else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
triggerPageAction(QWebPage::SelectPreviousWord);
}
event->accept();
return;
}
break;
case Qt::Key_Right:
if (event->modifiers() & Qt::ShiftModifier) {
if (event->modifiers() == Qt::ShiftModifier) {
triggerPageAction(QWebPage::SelectNextChar);
}
else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
triggerPageAction(QWebPage::SelectNextWord);
}
event->accept();
return;
}
break;
case Qt::Key_Home:
if (event->modifiers() & Qt::ShiftModifier) {
if (event->modifiers() == Qt::ShiftModifier) {
triggerPageAction(QWebPage::SelectStartOfLine);
}
else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
triggerPageAction(QWebPage::SelectStartOfDocument);
}
event->accept();
return;
}
break;
case Qt::Key_End:
if (event->modifiers() & Qt::ShiftModifier) {
if (event->modifiers() == Qt::ShiftModifier) {
triggerPageAction(QWebPage::SelectEndOfLine);
}
else if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
triggerPageAction(QWebPage::SelectEndOfDocument);
}
event->accept();
return;
}
break;
default:
break;
}

View File

@ -38,7 +38,9 @@ public:
WebPage* page() const;
void setPage(QWebPage* page);
void load(const QNetworkRequest &request, QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, const QByteArray &body = QByteArray());
void load(const QNetworkRequest &request,
QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation,
const QByteArray &body = QByteArray());
bool loadingError() const;
bool isLoading() const;