diff options
author | Nie Cheng <niecheng@uniontech.com> | 2020-08-20 10:28:14 +0800 |
---|---|---|
committer | Nie Cheng <niecheng@uniontech.com> | 2020-08-25 23:59:10 +0800 |
commit | e1d7df5ce9eb1d370e1b6dcd31ced4029082d63d (patch) | |
tree | 4240fe7c608ac4a73f3a032d656481ce0f0ce3e1 /src/widgets | |
parent | 1ff82d1ebaa7b9151bab449fd29b76d59654037b (diff) |
Code style fix
Change-Id: I0174293421d866f3b124a9ff4344052749e8a1b9
Reviewed-by: Nie Cheng <niecheng@uniontech.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/widgets/qabstractscrollarea.cpp | 82 |
1 files changed, 37 insertions, 45 deletions
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index bbf76ab553..be6a0c3288 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -1230,57 +1230,49 @@ void QAbstractScrollArea::contextMenuEvent(QContextMenuEvent *e) void QAbstractScrollArea::keyPressEvent(QKeyEvent * e) { Q_D(QAbstractScrollArea); - if (false){ -#ifndef QT_NO_SHORTCUT - } else if (e == QKeySequence::MoveToPreviousPage) { - d->vbar->triggerAction(QScrollBar::SliderPageStepSub); - } else if (e == QKeySequence::MoveToNextPage) { - d->vbar->triggerAction(QScrollBar::SliderPageStepAdd); -#endif - } else { + #ifdef QT_KEYPAD_NAVIGATION - if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus()) { - e->ignore(); - return; - } + if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus()) { + e->ignore(); + return; + } #endif - switch (e->key()) { - case Qt::Key_Up: - d->vbar->triggerAction(QScrollBar::SliderSingleStepSub); - break; - case Qt::Key_Down: - d->vbar->triggerAction(QScrollBar::SliderSingleStepAdd); - break; - case Qt::Key_Left: + switch (e->key()) { + case Qt::Key_Up: + d->vbar->triggerAction(QScrollBar::SliderSingleStepSub); + break; + case Qt::Key_Down: + d->vbar->triggerAction(QScrollBar::SliderSingleStepAdd); + break; + case Qt::Key_Left: #ifdef QT_KEYPAD_NAVIGATION - if (QApplicationPrivate::keypadNavigationEnabled() && hasEditFocus() - && (!d->hbar->isVisible() || d->hbar->value() == d->hbar->minimum())) { - //if we aren't using the hbar or we are already at the leftmost point ignore - e->ignore(); - return; - } + if (QApplicationPrivate::keypadNavigationEnabled() && hasEditFocus() + && (!d->hbar->isVisible() || d->hbar->value() == d->hbar->minimum())) { + //if we aren't using the hbar or we are already at the leftmost point ignore + e->ignore(); + return; + } #endif - d->hbar->triggerAction( - layoutDirection() == Qt::LeftToRight - ? QScrollBar::SliderSingleStepSub : QScrollBar::SliderSingleStepAdd); - break; - case Qt::Key_Right: + d->hbar->triggerAction( + layoutDirection() == Qt::LeftToRight + ? QScrollBar::SliderSingleStepSub : QScrollBar::SliderSingleStepAdd); + break; + case Qt::Key_Right: #ifdef QT_KEYPAD_NAVIGATION - if (QApplicationPrivate::keypadNavigationEnabled() && hasEditFocus() - && (!d->hbar->isVisible() || d->hbar->value() == d->hbar->maximum())) { - //if we aren't using the hbar or we are already at the rightmost point ignore - e->ignore(); - return; - } + if (QApplicationPrivate::keypadNavigationEnabled() && hasEditFocus() + && (!d->hbar->isVisible() || d->hbar->value() == d->hbar->maximum())) { + //if we aren't using the hbar or we are already at the rightmost point ignore + e->ignore(); + return; + } #endif - d->hbar->triggerAction( - layoutDirection() == Qt::LeftToRight - ? QScrollBar::SliderSingleStepAdd : QScrollBar::SliderSingleStepSub); - break; - default: - e->ignore(); - return; - } + d->hbar->triggerAction( + layoutDirection() == Qt::LeftToRight + ? QScrollBar::SliderSingleStepAdd : QScrollBar::SliderSingleStepSub); + break; + default: + e->ignore(); + return; } e->accept(); } |