diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-07-22 11:12:38 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-07-23 20:48:33 +0200 |
commit | 9c2f18d35764fe4c5452d3aa500bd2824ebe7564 (patch) | |
tree | e12b70c175f90dedc081c7907260847425122d48 /src/widgets/itemviews | |
parent | 19f72c17c03b5065b98e0a7f3aae08ef7ca1ef03 (diff) |
Remove usages of deprecated QApplication::keypadNavigationEnabled
Added QApplicationPrivate::keypadNavigationEnabled() as a
replacement of deprecated QApplication::keypadNavigationEnabled(),
for the internal usage.
Task-number: QTBUG-76491
Change-Id: I75f4c628b72d86b5e428e7e285a786d23abbf3f2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r-- | src/widgets/itemviews/qabstractitemview.cpp | 14 | ||||
-rw-r--r-- | src/widgets/itemviews/qlistview.cpp | 5 | ||||
-rw-r--r-- | src/widgets/itemviews/qtableview.cpp | 5 | ||||
-rw-r--r-- | src/widgets/itemviews/qtreeview.cpp | 5 |
4 files changed, 17 insertions, 12 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 6ff0fe8132..c985b945f8 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -61,6 +61,7 @@ #include <qstyleditemdelegate.h> #include <private/qabstractitemview_p.h> #include <private/qabstractitemmodel_p.h> +#include <private/qapplication_p.h> #include <private/qguiapplication_p.h> #include <private/qscrollbar_p.h> #ifndef QT_NO_ACCESSIBILITY @@ -2290,7 +2291,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) #ifdef QT_KEYPAD_NAVIGATION switch (event->key()) { case Qt::Key_Select: - if (QApplication::keypadNavigationEnabled()) { + if (QApplicationPrivate::keypadNavigationEnabled()) { if (!hasEditFocus()) { setEditFocus(true); return; @@ -2298,7 +2299,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) } break; case Qt::Key_Back: - if (QApplication::keypadNavigationEnabled() && hasEditFocus()) { + if (QApplicationPrivate::keypadNavigationEnabled() && hasEditFocus()) { setEditFocus(false); } else { event->ignore(); @@ -2309,7 +2310,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) // Let's ignore vertical navigation events, only if there is no other widget // what can take the focus in vertical direction. This means widget can handle navigation events // even the widget don't have edit focus, and there is no other widget in requested direction. - if(QApplication::keypadNavigationEnabled() && !hasEditFocus() + if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) { event->ignore(); return; @@ -2318,14 +2319,14 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) case Qt::Key_Left: case Qt::Key_Right: // Similar logic as in up and down events - if(QApplication::keypadNavigationEnabled() && !hasEditFocus() + if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus() && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) || QWidgetPrivate::inTabWidget(this))) { event->ignore(); return; } break; default: - if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { + if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus()) { event->ignore(); return; } @@ -2413,7 +2414,8 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) case Qt::Key_Down: case Qt::Key_Up: #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) { + if (QApplicationPrivate::keypadNavigationEnabled() + && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) { event->accept(); // don't change focus break; } diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 7d18c06def..04cddf2926 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -54,6 +54,7 @@ #if QT_CONFIG(rubberband) #include <qrubberband.h> #endif +#include <private/qapplication_p.h> #include <private/qlistview_p.h> #include <private/qscrollbar_p.h> #include <qdebug.h> @@ -1185,7 +1186,7 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie rect.translate(0, -rect.height()); if (rect.bottom() <= 0) { #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled()) { + if (QApplicationPrivate::keypadNavigationEnabled()) { int row = d->batchStartRow() - 1; while (row >= 0 && d->isHiddenOrDisabled(row)) --row; @@ -1214,7 +1215,7 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie rect.translate(0, rect.height()); if (rect.top() >= contents.height()) { #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled()) { + if (QApplicationPrivate::keypadNavigationEnabled()) { int rowCount = d->model->rowCount(d->root); int row = 0; while (row < rowCount && d->isHiddenOrDisabled(row)) diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index 8860ef208d..e706af1a42 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -51,6 +51,7 @@ #if QT_CONFIG(abstractbutton) #include <qabstractbutton.h> #endif +#include <private/qapplication_p.h> #include <private/qtableview_p.h> #include <private/qheaderview_p.h> #include <private/qscrollbar_p.h> @@ -1710,7 +1711,7 @@ QModelIndex QTableView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifi case MoveUp: { int originalRow = visualRow; #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled() && visualRow == 0) + if (QApplicationPrivate::keypadNavigationEnabled() && visualRow == 0) visualRow = d->visualRow(model()->rowCount() - 1) + 1; // FIXME? visualRow = bottom + 1; #endif @@ -1739,7 +1740,7 @@ QModelIndex QTableView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifi visualRow = d->visualRow(d->rowSpanEndLogical(span.top(), span.height())); } #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled() && visualRow >= bottom) + if (QApplicationPrivate::keypadNavigationEnabled() && visualRow >= bottom) visualRow = -1; #endif int r = d->logicalRow(visualRow); diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 55b10d13c1..23a530821f 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -55,6 +55,7 @@ #include <qaccessible.h> #endif +#include <private/qapplication_p.h> #include <private/qtreeview_p.h> #include <private/qheaderview_p.h> @@ -2214,14 +2215,14 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie case MoveNext: case MoveDown: #ifdef QT_KEYPAD_NAVIGATION - if (vi == d->viewItems.count()-1 && QApplication::keypadNavigationEnabled()) + if (vi == d->viewItems.count()-1 && QApplicationPrivate::keypadNavigationEnabled()) return d->model->index(0, current.column(), d->root); #endif return d->modelIndex(d->below(vi), current.column()); case MovePrevious: case MoveUp: #ifdef QT_KEYPAD_NAVIGATION - if (vi == 0 && QApplication::keypadNavigationEnabled()) + if (vi == 0 && QApplicationPrivate::keypadNavigationEnabled()) return d->modelIndex(d->viewItems.count() - 1, current.column()); #endif return d->modelIndex(d->above(vi), current.column()); |