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>
This commit is contained in:
parent
19f72c17c0
commit
9c2f18d357
@ -44,6 +44,7 @@
|
||||
#include "qfiledialog.h"
|
||||
|
||||
#include "qfiledialog_p.h"
|
||||
#include <private/qapplication_p.h>
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <qfontmetrics.h>
|
||||
#include <qaction.h>
|
||||
@ -4035,7 +4036,7 @@ bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) {
|
||||
return true;
|
||||
case Qt::Key_Back:
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled())
|
||||
return false;
|
||||
#endif
|
||||
case Qt::Key_Left:
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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))
|
||||
|
@ -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);
|
||||
|
@ -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());
|
||||
|
@ -3843,8 +3843,6 @@ void QApplicationPrivate::openPopup(QWidget *popup)
|
||||
This feature is available in Qt for Embedded Linux only.
|
||||
|
||||
\since 4.6
|
||||
|
||||
\sa keypadNavigationEnabled()
|
||||
*/
|
||||
void QApplication::setNavigationMode(Qt::NavigationMode mode)
|
||||
{
|
||||
@ -3857,8 +3855,6 @@ void QApplication::setNavigationMode(Qt::NavigationMode mode)
|
||||
This feature is available in Qt for Embedded Linux only.
|
||||
|
||||
\since 4.6
|
||||
|
||||
\sa keypadNavigationEnabled()
|
||||
*/
|
||||
Qt::NavigationMode QApplication::navigationMode()
|
||||
{
|
||||
|
@ -136,6 +136,13 @@ public:
|
||||
static QWidget *tryModalHelper_sys(QWidget *top);
|
||||
bool canQuit();
|
||||
#endif
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
static bool keypadNavigationEnabled()
|
||||
{
|
||||
return navigationMode == Qt::NavigationModeKeypadTabOrder ||
|
||||
navigationMode == Qt::NavigationModeKeypadDirectional;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool notify_helper(QObject *receiver, QEvent * e);
|
||||
|
||||
|
@ -393,7 +393,7 @@ QPointer<QWidget> QWidgetPrivate::editingWidget;
|
||||
|
||||
This feature is only available in Qt for Embedded Linux.
|
||||
|
||||
\sa setEditFocus(), QApplication::keypadNavigationEnabled()
|
||||
\sa setEditFocus(), QApplication::navigationMode()
|
||||
*/
|
||||
bool QWidget::hasEditFocus() const
|
||||
{
|
||||
@ -413,7 +413,7 @@ bool QWidget::hasEditFocus() const
|
||||
|
||||
This feature is only available in Qt for Embedded Linux.
|
||||
|
||||
\sa hasEditFocus(), QApplication::keypadNavigationEnabled()
|
||||
\sa hasEditFocus(), QApplication::navigationMode()
|
||||
*/
|
||||
void QWidget::setEditFocus(bool on)
|
||||
{
|
||||
|
@ -161,6 +161,7 @@
|
||||
#include "QtWidgets/qapplication.h"
|
||||
#include "QtGui/qevent.h"
|
||||
#include "QtWidgets/qdesktopwidget.h"
|
||||
#include <private/qapplication_p.h>
|
||||
#include <private/qdesktopwidget_p.h>
|
||||
#if QT_CONFIG(lineedit)
|
||||
#include "QtWidgets/qlineedit.h"
|
||||
@ -1416,7 +1417,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e)
|
||||
// widget lost focus, hide the popup
|
||||
if (d->widget && (!d->widget->hasFocus()
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
|| (QApplication::keypadNavigationEnabled() && !d->widget->hasEditFocus())
|
||||
|| (QApplicationPrivate::keypadNavigationEnabled() && !d->widget->hasEditFocus())
|
||||
#endif
|
||||
))
|
||||
d->popup->hide();
|
||||
@ -1434,7 +1435,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e)
|
||||
switch (key) {
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
case Qt::Key_Select:
|
||||
if (!QApplication::keypadNavigationEnabled())
|
||||
if (!QApplicationPrivate::keypadNavigationEnabled())
|
||||
break;
|
||||
#endif
|
||||
case Qt::Key_Return:
|
||||
@ -1464,7 +1465,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e)
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
case QEvent::KeyRelease: {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(e);
|
||||
if (QApplication::keypadNavigationEnabled() && ke->key() == Qt::Key_Back) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && ke->key() == Qt::Key_Back) {
|
||||
// Send the event to the 'widget'. This is what we did for KeyPress, so we need
|
||||
// to do the same for KeyRelease, in case the widget's KeyPress event set
|
||||
// up something (such as a timer) that is relying on also receiving the
|
||||
@ -1481,7 +1482,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e)
|
||||
|
||||
case QEvent::MouseButtonPress: {
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
// if we've clicked in the widget (or its descendant), let it handle the click
|
||||
QWidget *source = qobject_cast<QWidget *>(o);
|
||||
if (source) {
|
||||
|
@ -44,6 +44,7 @@
|
||||
#endif
|
||||
#if QT_CONFIG(buttongroup)
|
||||
#include "qbuttongroup.h"
|
||||
#include "private/qapplication_p.h"
|
||||
#include "private/qbuttongroup_p.h"
|
||||
#endif
|
||||
#include "qabstractbutton_p.h"
|
||||
@ -319,7 +320,7 @@ void QAbstractButtonPrivate::moveFocus(int key)
|
||||
|
||||
if (exclusive
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
&& !QApplication::keypadNavigationEnabled()
|
||||
&& !QApplicationPrivate::keypadNavigationEnabled()
|
||||
#endif
|
||||
&& candidate
|
||||
&& fb->d_func()->checked
|
||||
@ -1063,7 +1064,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e)
|
||||
case Qt::Key_Right:
|
||||
case Qt::Key_Down: {
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if ((QApplication::keypadNavigationEnabled()
|
||||
if ((QApplicationPrivate::keypadNavigationEnabled()
|
||||
&& (e->key() == Qt::Key_Left || e->key() == Qt::Key_Right))
|
||||
|| (!QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional
|
||||
|| (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down))) {
|
||||
@ -1159,7 +1160,7 @@ void QAbstractButton::focusInEvent(QFocusEvent *e)
|
||||
{
|
||||
Q_D(QAbstractButton);
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (!QApplication::keypadNavigationEnabled())
|
||||
if (!QApplicationPrivate::keypadNavigationEnabled())
|
||||
#endif
|
||||
d->fixFocusPolicy();
|
||||
QWidget::focusInEvent(e);
|
||||
|
@ -1362,7 +1362,7 @@ void QAbstractScrollArea::keyPressEvent(QKeyEvent * e)
|
||||
#endif
|
||||
} else {
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus()) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
@ -1376,7 +1376,7 @@ void QAbstractScrollArea::keyPressEvent(QKeyEvent * e)
|
||||
break;
|
||||
case Qt::Key_Left:
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled() && hasEditFocus()
|
||||
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();
|
||||
@ -1389,7 +1389,7 @@ void QAbstractScrollArea::keyPressEvent(QKeyEvent * e)
|
||||
break;
|
||||
case Qt::Key_Right:
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled() && hasEditFocus()
|
||||
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();
|
||||
|
@ -47,6 +47,8 @@
|
||||
#endif
|
||||
#include <limits.h>
|
||||
|
||||
#include <private/qapplication_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
@ -816,13 +818,13 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
|
||||
switch (ev->key()) {
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
case Qt::Key_Select:
|
||||
if (QApplication::keypadNavigationEnabled())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled())
|
||||
setEditFocus(!hasEditFocus());
|
||||
else
|
||||
ev->ignore();
|
||||
break;
|
||||
case Qt::Key_Back:
|
||||
if (QApplication::keypadNavigationEnabled() && hasEditFocus()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && hasEditFocus()) {
|
||||
setValue(d->origValue);
|
||||
setEditFocus(false);
|
||||
} else
|
||||
@ -835,7 +837,7 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
|
||||
// In QApplication::KeypadNavigationDirectional, we want to change the slider
|
||||
// value if there is no left/right navigation possible and if this slider is not
|
||||
// inside a tab widget.
|
||||
if (QApplication::keypadNavigationEnabled()
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()
|
||||
&& (!hasEditFocus() && QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder
|
||||
|| d->orientation == Qt::Vertical
|
||||
|| !hasEditFocus()
|
||||
@ -843,7 +845,7 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
|
||||
ev->ignore();
|
||||
return;
|
||||
}
|
||||
if (QApplication::keypadNavigationEnabled() && d->orientation == Qt::Vertical)
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && d->orientation == Qt::Vertical)
|
||||
action = d->invertedControls ? SliderSingleStepSub : SliderSingleStepAdd;
|
||||
else
|
||||
#endif
|
||||
@ -855,7 +857,7 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
|
||||
case Qt::Key_Right:
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
// Same logic as in Qt::Key_Left
|
||||
if (QApplication::keypadNavigationEnabled()
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()
|
||||
&& (!hasEditFocus() && QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder
|
||||
|| d->orientation == Qt::Vertical
|
||||
|| !hasEditFocus()
|
||||
@ -863,7 +865,7 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
|
||||
ev->ignore();
|
||||
return;
|
||||
}
|
||||
if (QApplication::keypadNavigationEnabled() && d->orientation == Qt::Vertical)
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && d->orientation == Qt::Vertical)
|
||||
action = d->invertedControls ? SliderSingleStepAdd : SliderSingleStepSub;
|
||||
else
|
||||
#endif
|
||||
@ -876,7 +878,7 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
// In QApplication::KeypadNavigationDirectional, we want to change the slider
|
||||
// value if there is no up/down navigation possible.
|
||||
if (QApplication::keypadNavigationEnabled()
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()
|
||||
&& (QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder
|
||||
|| d->orientation == Qt::Horizontal
|
||||
|| !hasEditFocus() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical))) {
|
||||
@ -889,7 +891,7 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
|
||||
case Qt::Key_Down:
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
// Same logic as in Qt::Key_Up
|
||||
if (QApplication::keypadNavigationEnabled()
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()
|
||||
&& (QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder
|
||||
|| d->orientation == Qt::Horizontal
|
||||
|| !hasEditFocus() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical))) {
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include <qplatformdefs.h>
|
||||
#include <private/qabstractspinbox_p.h>
|
||||
#include <private/qapplication_p.h>
|
||||
#if QT_CONFIG(datetimeparser)
|
||||
#include <private/qdatetimeparser_p.h>
|
||||
#endif
|
||||
@ -803,7 +804,7 @@ bool QAbstractSpinBox::event(QEvent *event)
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
case QEvent::EnterEditFocus:
|
||||
case QEvent::LeaveEditFocus:
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
const bool b = d->edit->event(event);
|
||||
d->edit->setSelection(d->edit->displayText().size() - d->suffix.size(),0);
|
||||
if (event->type() == QEvent::LeaveEditFocus)
|
||||
@ -1025,7 +1026,7 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
|
||||
case Qt::Key_Up:
|
||||
case Qt::Key_Down: {
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
// Reserve up/down for nav - use left/right for edit.
|
||||
if (!hasEditFocus() && (event->key() == Qt::Key_Up
|
||||
|| event->key() == Qt::Key_Down)) {
|
||||
@ -1061,13 +1062,13 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
case Qt::Key_Left:
|
||||
case Qt::Key_Right:
|
||||
if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus()) {
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case Qt::Key_Back:
|
||||
if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus()) {
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
@ -1085,7 +1086,7 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
|
||||
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
case Qt::Key_Select:
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
// Toggles between left/right moving cursor and inc/dec.
|
||||
setEditFocus(!hasEditFocus());
|
||||
}
|
||||
@ -1221,7 +1222,7 @@ void QAbstractSpinBox::focusOutEvent(QFocusEvent *event)
|
||||
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
// editingFinished() is already emitted on LeaveEditFocus
|
||||
if (!QApplication::keypadNavigationEnabled())
|
||||
if (!QApplicationPrivate::keypadNavigationEnabled())
|
||||
#endif
|
||||
emit editingFinished();
|
||||
}
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include <qspinbox.h>
|
||||
#include <qmenu.h>
|
||||
#include <qapplication.h>
|
||||
#include <private/qapplication_p.h>
|
||||
#include <qbasictimer.h>
|
||||
#include <qstylepainter.h>
|
||||
|
||||
@ -1384,14 +1385,14 @@ void QCalendarView::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (event->key() == Qt::Key_Select) {
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (!hasEditFocus()) {
|
||||
setEditFocus(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Back) {
|
||||
if (QApplication::keypadNavigationEnabled() && hasEditFocus()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && hasEditFocus()) {
|
||||
if (qobject_cast<QCalendarModel *>(model())) {
|
||||
emit changeDate(origDate, true); //changes selection back to origDate, but doesn't activate
|
||||
setEditFocus(false);
|
||||
|
@ -223,7 +223,7 @@ void QComboBoxPrivate::_q_completerActivated(const QModelIndex &index)
|
||||
}
|
||||
|
||||
# ifdef QT_KEYPAD_NAVIGATION
|
||||
if ( QApplication::keypadNavigationEnabled()
|
||||
if ( QApplicationPrivate::keypadNavigationEnabled()
|
||||
&& q->isEditable()
|
||||
&& q->completer()
|
||||
&& q->completer()->completionMode() == QCompleter::UnfilteredPopupCompletion ) {
|
||||
@ -1534,7 +1534,7 @@ void QComboBox::setAutoCompletion(bool enable)
|
||||
Q_D(QComboBox);
|
||||
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (Q_UNLIKELY(QApplication::keypadNavigationEnabled() && !enable && isEditable()))
|
||||
if (Q_UNLIKELY(QApplicationPrivate::keypadNavigationEnabled() && !enable && isEditable()))
|
||||
qWarning("QComboBox::setAutoCompletion: auto completion is mandatory when combo box editable");
|
||||
#endif
|
||||
|
||||
@ -1881,7 +1881,7 @@ void QComboBox::setLineEdit(QLineEdit *edit)
|
||||
setAutoCompletion(d->autoCompletion);
|
||||
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
// Editable combo boxes will have a completer that is set to UnfilteredPopupCompletion.
|
||||
// This means that when the user enters edit mode they are immediately presented with a
|
||||
// list of possible completions.
|
||||
@ -2653,7 +2653,7 @@ void QComboBox::showPopup()
|
||||
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
#if QT_CONFIG(completer)
|
||||
if (QApplication::keypadNavigationEnabled() && d->completer) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && d->completer) {
|
||||
// editable combo box is line edit plus completer
|
||||
setEditFocus(true);
|
||||
d->completer->complete(); // show popup
|
||||
@ -2859,7 +2859,7 @@ void QComboBox::showPopup()
|
||||
|
||||
container->update();
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled())
|
||||
view()->setEditFocus(true);
|
||||
#endif
|
||||
if (startTimer) {
|
||||
@ -2931,7 +2931,7 @@ void QComboBox::hidePopup()
|
||||
d->container->hide();
|
||||
}
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled() && isEditable() && hasFocus())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && isEditable() && hasFocus())
|
||||
setEditFocus(true);
|
||||
#endif
|
||||
d->_q_resetButton();
|
||||
@ -3190,7 +3190,7 @@ void QComboBoxPrivate::showPopupFromMouseEvent(QMouseEvent *e)
|
||||
}
|
||||
} else {
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled() && sc == QStyle::SC_ComboBoxEditField && lineEdit) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && sc == QStyle::SC_ComboBoxEditField && lineEdit) {
|
||||
lineEdit->event(e); //so lineedit can move cursor, etc
|
||||
return;
|
||||
}
|
||||
@ -3239,7 +3239,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
|
||||
Q_FALLTHROUGH();
|
||||
case Qt::Key_PageUp:
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled())
|
||||
e->ignore();
|
||||
else
|
||||
#endif
|
||||
@ -3254,7 +3254,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
|
||||
Q_FALLTHROUGH();
|
||||
case Qt::Key_PageDown:
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled())
|
||||
e->ignore();
|
||||
else
|
||||
#endif
|
||||
@ -3288,7 +3288,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
|
||||
break;
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
case Qt::Key_Select:
|
||||
if (QApplication::keypadNavigationEnabled()
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()
|
||||
&& (!hasEditFocus() || !d->lineEdit)) {
|
||||
showPopup();
|
||||
return;
|
||||
@ -3296,11 +3296,11 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
|
||||
break;
|
||||
case Qt::Key_Left:
|
||||
case Qt::Key_Right:
|
||||
if (QApplication::keypadNavigationEnabled() && !hasEditFocus())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus())
|
||||
e->ignore();
|
||||
break;
|
||||
case Qt::Key_Back:
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (!hasEditFocus() || !d->lineEdit)
|
||||
e->ignore();
|
||||
} else {
|
||||
|
@ -37,6 +37,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <private/qapplication_p.h>
|
||||
#include <private/qdatetimeedit_p.h>
|
||||
#include <qabstractspinbox.h>
|
||||
#include <qapplication.h>
|
||||
@ -642,7 +643,7 @@ QDateTimeEdit::Section QDateTimeEdit::currentSection() const
|
||||
{
|
||||
Q_D(const QDateTimeEdit);
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled() && d->focusOnButton)
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && d->focusOnButton)
|
||||
return NoSection;
|
||||
#endif
|
||||
return QDateTimeEditPrivate::convertToPublic(d->sectionType(d->currentSectionIndex));
|
||||
@ -1055,7 +1056,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
|
||||
switch (event->key()) {
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
case Qt::Key_NumberSign: //shortcut to popup calendar
|
||||
if (QApplication::keypadNavigationEnabled() && d->calendarPopupEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && d->calendarPopupEnabled()) {
|
||||
d->initCalendarPopup();
|
||||
d->positionCalendarPopup();
|
||||
d->monthCalendar->show();
|
||||
@ -1063,7 +1064,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
|
||||
}
|
||||
break;
|
||||
case Qt::Key_Select:
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (hasEditFocus()) {
|
||||
if (d->focusOnButton) {
|
||||
d->initCalendarPopup();
|
||||
@ -1095,7 +1096,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
|
||||
return;
|
||||
default:
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled() && !hasEditFocus()
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus()
|
||||
&& !event->text().isEmpty() && event->text().at(0).isLetterOrNumber()) {
|
||||
setEditFocus(true);
|
||||
|
||||
@ -1117,8 +1118,8 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
|
||||
if (event->key() == Qt::Key_Left || event->key() == Qt::Key_Right) {
|
||||
if (
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
QApplication::keypadNavigationEnabled() && !hasEditFocus()
|
||||
|| !QApplication::keypadNavigationEnabled() &&
|
||||
QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus()
|
||||
|| !QApplicationPrivate::keypadNavigationEnabled() &&
|
||||
#endif
|
||||
!(event->modifiers() & Qt::ControlModifier)) {
|
||||
select = false;
|
||||
@ -1127,7 +1128,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
|
||||
#if 0 // Used to be included in Qt4 for Q_WS_MAC
|
||||
else
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (!QApplication::keypadNavigationEnabled())
|
||||
if (!QApplicationPrivate::keypadNavigationEnabled())
|
||||
#endif
|
||||
{
|
||||
select = (event->modifiers() & Qt::ShiftModifier);
|
||||
@ -1147,7 +1148,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
|
||||
&& (event->key() != Qt::Key_Tab || !(event->modifiers() & Qt::ShiftModifier));
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
int newSection = d->nextPrevSection(d->currentSectionIndex, forward);
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (d->focusOnButton) {
|
||||
newSection = forward ? 0 : d->sectionNodes.size() - 1;
|
||||
d->focusOnButton = false;
|
||||
@ -1290,7 +1291,7 @@ void QDateTimeEdit::stepBy(int steps)
|
||||
Q_D(QDateTimeEdit);
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
// with keypad navigation and not editFocus, left right change the date/time by a fixed amount.
|
||||
if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus()) {
|
||||
// if date based, shift by day. else shift by 15min
|
||||
if (d->sections & DateSections_Mask) {
|
||||
setDateTime(dateTime().addDays(steps));
|
||||
@ -1417,7 +1418,7 @@ QDateTimeEdit::StepEnabled QDateTimeEdit::stepEnabled() const
|
||||
QAbstractSpinBox::StepEnabled ret = 0;
|
||||
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus()) {
|
||||
if (d->wrapping)
|
||||
return StepEnabled(StepUpEnabled | StepDownEnabled);
|
||||
// 3 cases. date, time, datetime. each case look
|
||||
@ -1702,7 +1703,7 @@ void QDateTimeEditPrivate::updateEdit()
|
||||
|
||||
if (!specialValue()
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
&& !(QApplication::keypadNavigationEnabled() && !edit->hasEditFocus())
|
||||
&& !(QApplicationPrivate::keypadNavigationEnabled() && !edit->hasEditFocus())
|
||||
#endif
|
||||
) {
|
||||
int cursor = sectionPos(currentSectionIndex);
|
||||
@ -1731,7 +1732,7 @@ void QDateTimeEditPrivate::setSelected(int sectionIndex, bool forward)
|
||||
{
|
||||
if (specialValue()
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
|| (QApplication::keypadNavigationEnabled() && !edit->hasEditFocus())
|
||||
|| (QApplicationPrivate::keypadNavigationEnabled() && !edit->hasEditFocus())
|
||||
#endif
|
||||
) {
|
||||
edit->selectAll();
|
||||
@ -2426,7 +2427,7 @@ void QDateTimeEditPrivate::init(const QVariant &var)
|
||||
break;
|
||||
}
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled())
|
||||
q->setCalendarPopup(true);
|
||||
#endif
|
||||
q->setInputMethodHints(Qt::ImhPreferNumbers);
|
||||
@ -2602,7 +2603,7 @@ QCalendarWidget *QCalendarPopup::verifyCalendarInstance()
|
||||
QCalendarWidget *cw = new QCalendarWidget(this);
|
||||
cw->setVerticalHeaderFormat(QCalendarWidget::NoVerticalHeader);
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled())
|
||||
cw->setHorizontalHeaderFormat(QCalendarWidget::SingleLetterDayNames);
|
||||
#endif
|
||||
setCalendarWidget(cw);
|
||||
|
@ -1481,7 +1481,7 @@ bool QLineEdit::event(QEvent * e)
|
||||
d->initMouseYThreshold();
|
||||
}
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (e->type() == QEvent::EnterEditFocus) {
|
||||
end(false);
|
||||
d->setCursorVisible(true);
|
||||
@ -1513,7 +1513,7 @@ void QLineEdit::mousePressEvent(QMouseEvent* e)
|
||||
if (e->button() == Qt::RightButton)
|
||||
return;
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) {
|
||||
if (QApplication::QApplicationPrivate() && !hasEditFocus()) {
|
||||
setEditFocus(true);
|
||||
// Get the completion list to pop up.
|
||||
if (d->control->completer())
|
||||
@ -1722,7 +1722,7 @@ void QLineEdit::keyPressEvent(QKeyEvent *event)
|
||||
bool select = false;
|
||||
switch (event->key()) {
|
||||
case Qt::Key_Select:
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (hasEditFocus()) {
|
||||
setEditFocus(false);
|
||||
if (d->control->completer() && d->control->completer()->popup()->isVisible())
|
||||
@ -1733,13 +1733,13 @@ void QLineEdit::keyPressEvent(QKeyEvent *event)
|
||||
break;
|
||||
case Qt::Key_Back:
|
||||
case Qt::Key_No:
|
||||
if (!QApplication::keypadNavigationEnabled() || !hasEditFocus()) {
|
||||
if (!QApplicationPrivate::keypadNavigationEnabled() || !hasEditFocus()) {
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (!hasEditFocus() && !(event->modifiers() & Qt::ControlModifier)) {
|
||||
if (!event->text().isEmpty() && event->text().at(0).isPrint()
|
||||
&& !isReadOnly())
|
||||
@ -1754,7 +1754,7 @@ void QLineEdit::keyPressEvent(QKeyEvent *event)
|
||||
|
||||
|
||||
|
||||
if (QApplication::keypadNavigationEnabled() && !select && !hasEditFocus()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && !select && !hasEditFocus()) {
|
||||
setEditFocus(true);
|
||||
if (event->key() == Qt::Key_Select)
|
||||
return; // Just start. No action.
|
||||
@ -1801,7 +1801,7 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e)
|
||||
// Focus in if currently in navigation focus on the widget
|
||||
// Only focus in on preedits, to allow input methods to
|
||||
// commit text as they focus out without interfering with focus
|
||||
if (QApplication::keypadNavigationEnabled()
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()
|
||||
&& hasFocus() && !hasEditFocus()
|
||||
&& !e->preeditString().isEmpty())
|
||||
setEditFocus(true);
|
||||
@ -1874,7 +1874,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e)
|
||||
d->clickCausedFocus = 1;
|
||||
}
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && ( e->reason() == Qt::PopupFocusReason))) {
|
||||
if (!QApplicationPrivate::keypadNavigationEnabled() || (hasEditFocus() && ( e->reason() == Qt::PopupFocusReason))) {
|
||||
#endif
|
||||
d->control->setBlinkingCursorEnabled(true);
|
||||
QStyleOptionFrame opt;
|
||||
@ -1918,7 +1918,7 @@ void QLineEdit::focusOutEvent(QFocusEvent *e)
|
||||
d->control->setBlinkingCursorEnabled(false);
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
// editingFinished() is already emitted on LeaveEditFocus
|
||||
if (!QApplication::keypadNavigationEnabled())
|
||||
if (!QApplicationPrivate::keypadNavigationEnabled())
|
||||
#endif
|
||||
if (reason != Qt::PopupFocusReason
|
||||
|| !(QApplication::activePopupWidget() && QApplication::activePopupWidget()->parentWidget() == this)) {
|
||||
@ -2041,7 +2041,7 @@ void QLineEdit::paintEvent(QPaintEvent *)
|
||||
int flags = QWidgetLineControl::DrawText;
|
||||
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (!QApplication::keypadNavigationEnabled() || hasEditFocus())
|
||||
if (!QApplicationPrivate::keypadNavigationEnabled() || hasEditFocus())
|
||||
#endif
|
||||
if (d->control->hasSelectedText() || (d->cursorVisible && !d->control->inputMask().isEmpty() && !d->control->isReadOnly())){
|
||||
flags |= QWidgetLineControl::DrawSelections;
|
||||
|
@ -2392,7 +2392,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
|
||||
}
|
||||
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (!atAction && QApplication::keypadNavigationEnabled()) {
|
||||
if (!atAction && QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
// Try to have one item activated
|
||||
if (d->defaultAction && d->defaultAction->isEnabled()) {
|
||||
atAction = d->defaultAction;
|
||||
|
@ -54,6 +54,7 @@
|
||||
#endif
|
||||
#include <qstyle.h>
|
||||
#include <qtimer.h>
|
||||
#include "private/qapplication_p.h"
|
||||
#include "private/qtextdocumentlayout_p.h"
|
||||
#include "private/qabstracttextdocumentlayout_p.h"
|
||||
#include "qtextdocument.h"
|
||||
@ -1573,7 +1574,7 @@ bool QPlainTextEdit::event(QEvent *e)
|
||||
}
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
else if (e->type() == QEvent::EnterEditFocus || e->type() == QEvent::LeaveEditFocus) {
|
||||
if (QApplication::keypadNavigationEnabled())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled())
|
||||
d->sendControlEvent(e);
|
||||
}
|
||||
#endif
|
||||
@ -1691,7 +1692,7 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e)
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
switch (e->key()) {
|
||||
case Qt::Key_Select:
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (!(d->control->textInteractionFlags() & Qt::LinksAccessibleByKeyboard))
|
||||
setEditFocus(!hasEditFocus());
|
||||
else {
|
||||
@ -1709,14 +1710,14 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e)
|
||||
break;
|
||||
case Qt::Key_Back:
|
||||
case Qt::Key_No:
|
||||
if (!QApplication::keypadNavigationEnabled()
|
||||
|| (QApplication::keypadNavigationEnabled() && !hasEditFocus())) {
|
||||
if (!QApplicationPrivate::keypadNavigationEnabled()
|
||||
|| (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus())) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (!hasEditFocus() && !(e->modifiers() & Qt::ControlModifier)) {
|
||||
if (e->text()[0].isPrint()) {
|
||||
setEditFocus(true);
|
||||
@ -1792,7 +1793,7 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e)
|
||||
switch (e->key()) {
|
||||
case Qt::Key_Up:
|
||||
case Qt::Key_Down:
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
// Cursor position didn't change, so we want to leave
|
||||
// these keys to change focus.
|
||||
e->ignore();
|
||||
@ -1801,7 +1802,7 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e)
|
||||
break;
|
||||
case Qt::Key_Left:
|
||||
case Qt::Key_Right:
|
||||
if (QApplication::keypadNavigationEnabled()
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()
|
||||
&& QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) {
|
||||
// Same as for Key_Up and Key_Down.
|
||||
e->ignore();
|
||||
@ -1810,7 +1811,7 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e)
|
||||
break;
|
||||
case Qt::Key_Back:
|
||||
if (!e->isAutoRepeat()) {
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (document()->isEmpty()) {
|
||||
setEditFocus(false);
|
||||
e->accept();
|
||||
@ -1836,7 +1837,7 @@ void QPlainTextEdit::keyReleaseEvent(QKeyEvent *e)
|
||||
{
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
Q_D(QPlainTextEdit);
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (!e->isAutoRepeat() && e->key() == Qt::Key_Back
|
||||
&& d->deleteAllTimer.isActive()) {
|
||||
d->deleteAllTimer.stop();
|
||||
@ -2080,7 +2081,7 @@ void QPlainTextEdit::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
Q_D(QPlainTextEdit);
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled() && !hasEditFocus())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus())
|
||||
setEditFocus(true);
|
||||
#endif
|
||||
d->sendControlEvent(e);
|
||||
@ -2212,7 +2213,7 @@ void QPlainTextEdit::inputMethodEvent(QInputMethodEvent *e)
|
||||
Q_D(QPlainTextEdit);
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (d->control->textInteractionFlags() & Qt::TextEditable
|
||||
&& QApplication::keypadNavigationEnabled()
|
||||
&& QApplicationPrivate::keypadNavigationEnabled()
|
||||
&& !hasEditFocus()) {
|
||||
setEditFocus(true);
|
||||
selectAll(); // so text is replaced rather than appended to
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "qapplication.h"
|
||||
#include "qvariant.h"
|
||||
#include "qdebug.h"
|
||||
#include "private/qapplication_p.h"
|
||||
#include "private/qlayoutengine_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -300,7 +301,7 @@ bool QScrollArea::event(QEvent *e)
|
||||
d->updateScrollBars();
|
||||
}
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
else if (QApplication::keypadNavigationEnabled()) {
|
||||
else if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (e->type() == QEvent::Show)
|
||||
QApplication::instance()->installEventFilter(this);
|
||||
else if (e->type() == QEvent::Hide)
|
||||
@ -319,7 +320,7 @@ bool QScrollArea::eventFilter(QObject *o, QEvent *e)
|
||||
Q_D(QScrollArea);
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (d->widget && o != d->widget && e->type() == QEvent::FocusIn
|
||||
&& QApplication::keypadNavigationEnabled()) {
|
||||
&& QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (o->isWidgetType())
|
||||
ensureWidgetVisible(static_cast<QWidget *>(o));
|
||||
}
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "qpainter.h"
|
||||
#include "qstyle.h"
|
||||
#include "qstyleoption.h"
|
||||
#include "private/qapplication_p.h"
|
||||
#include "private/qabstractslider_p.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
@ -360,7 +361,7 @@ void QSlider::mousePressEvent(QMouseEvent *ev)
|
||||
return;
|
||||
}
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled())
|
||||
setEditFocus(true);
|
||||
#endif
|
||||
ev->accept();
|
||||
|
@ -65,6 +65,7 @@
|
||||
#endif
|
||||
|
||||
#include "qdebug.h"
|
||||
#include "private/qapplication_p.h"
|
||||
#include "private/qtabbar_p.h"
|
||||
|
||||
#if 0 // Used to be included in Qt4 for Q_WS_MAC
|
||||
@ -415,7 +416,7 @@ void QTabBarPrivate::init()
|
||||
QObject::connect(rightB, SIGNAL(clicked()), q, SLOT(_q_scrollTabs()));
|
||||
rightB->hide();
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
leftB->setFocusPolicy(Qt::NoFocus);
|
||||
rightB->setFocusPolicy(Qt::NoFocus);
|
||||
q->setFocusPolicy(Qt::NoFocus);
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "qtabwidget.h"
|
||||
|
||||
#include "private/qapplication_p.h"
|
||||
#include "private/qwidget_p.h"
|
||||
#include "private/qtabbar_p.h"
|
||||
#include "qapplication.h"
|
||||
@ -241,7 +242,7 @@ void QTabWidgetPrivate::init()
|
||||
q->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding,
|
||||
QSizePolicy::TabWidget));
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled())
|
||||
q->setFocusPolicy(Qt::NoFocus);
|
||||
else
|
||||
#endif
|
||||
@ -1108,14 +1109,14 @@ void QTabWidget::keyPressEvent(QKeyEvent *e)
|
||||
if (((e->key() == Qt::Key_Tab || e->key() == Qt::Key_Backtab) &&
|
||||
count() > 1 && e->modifiers() & Qt::ControlModifier)
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
|| QApplication::keypadNavigationEnabled() && (e->key() == Qt::Key_Left || e->key() == Qt::Key_Right) && count() > 1
|
||||
|| QApplicationPrivate::keypadNavigationEnabled() && (e->key() == Qt::Key_Left || e->key() == Qt::Key_Right) && count() > 1
|
||||
#endif
|
||||
) {
|
||||
int pageCount = d->tabs->count();
|
||||
int page = currentIndex();
|
||||
int dx = (e->key() == Qt::Key_Backtab || e->modifiers() & Qt::ShiftModifier) ? -1 : 1;
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled() && (e->key() == Qt::Key_Left || e->key() == Qt::Key_Right))
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && (e->key() == Qt::Key_Left || e->key() == Qt::Key_Right))
|
||||
dx = e->key() == (isRightToLeft() ? Qt::Key_Right : Qt::Key_Left) ? -1 : 1;
|
||||
#endif
|
||||
for (int pass = 0; pass < pageCount; ++pass) {
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
#include <qstack.h>
|
||||
#include <qapplication.h>
|
||||
#include <private/qapplication_p.h>
|
||||
#include <qevent.h>
|
||||
#include <qdesktopwidget.h>
|
||||
#include <qdebug.h>
|
||||
@ -1016,7 +1017,7 @@ void QTextBrowser::keyPressEvent(QKeyEvent *ev)
|
||||
Q_D(QTextBrowser);
|
||||
switch (ev->key()) {
|
||||
case Qt::Key_Select:
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (!hasEditFocus()) {
|
||||
setEditFocus(true);
|
||||
return;
|
||||
@ -1031,7 +1032,7 @@ void QTextBrowser::keyPressEvent(QKeyEvent *ev)
|
||||
}
|
||||
break;
|
||||
case Qt::Key_Back:
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (hasEditFocus()) {
|
||||
setEditFocus(false);
|
||||
ev->accept();
|
||||
@ -1041,7 +1042,7 @@ void QTextBrowser::keyPressEvent(QKeyEvent *ev)
|
||||
QTextEdit::keyPressEvent(ev);
|
||||
return;
|
||||
default:
|
||||
if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus()) {
|
||||
ev->ignore();
|
||||
return;
|
||||
}
|
||||
|
@ -70,6 +70,7 @@
|
||||
#include <qtextformat.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qapplication.h>
|
||||
#include <private/qapplication_p.h>
|
||||
#include <limits.h>
|
||||
#include <qtexttable.h>
|
||||
#include <qvariant.h>
|
||||
@ -1116,7 +1117,7 @@ bool QTextEdit::event(QEvent *e)
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (e->type() == QEvent::EnterEditFocus || e->type() == QEvent::LeaveEditFocus) {
|
||||
if (QApplication::keypadNavigationEnabled())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled())
|
||||
d->sendControlEvent(e);
|
||||
}
|
||||
#endif
|
||||
@ -1301,7 +1302,7 @@ void QTextEdit::keyPressEvent(QKeyEvent *e)
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
switch (e->key()) {
|
||||
case Qt::Key_Select:
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
// code assumes linksaccessible + editable isn't meaningful
|
||||
if (d->control->textInteractionFlags() & Qt::TextEditable) {
|
||||
setEditFocus(!hasEditFocus());
|
||||
@ -1322,14 +1323,14 @@ void QTextEdit::keyPressEvent(QKeyEvent *e)
|
||||
break;
|
||||
case Qt::Key_Back:
|
||||
case Qt::Key_No:
|
||||
if (!QApplication::keypadNavigationEnabled()
|
||||
|| (QApplication::keypadNavigationEnabled() && !hasEditFocus())) {
|
||||
if (!QApplicationPrivate::keypadNavigationEnabled()
|
||||
|| (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus())) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (!hasEditFocus() && !(e->modifiers() & Qt::ControlModifier)) {
|
||||
if (e->text()[0].isPrint())
|
||||
setEditFocus(true);
|
||||
@ -1418,7 +1419,7 @@ void QTextEdit::keyPressEvent(QKeyEvent *e)
|
||||
switch (e->key()) {
|
||||
case Qt::Key_Up:
|
||||
case Qt::Key_Down:
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
// Cursor position didn't change, so we want to leave
|
||||
// these keys to change focus.
|
||||
e->ignore();
|
||||
@ -1427,7 +1428,7 @@ void QTextEdit::keyPressEvent(QKeyEvent *e)
|
||||
break;
|
||||
case Qt::Key_Back:
|
||||
if (!e->isAutoRepeat()) {
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (document()->isEmpty() || !(d->control->textInteractionFlags() & Qt::TextEditable)) {
|
||||
setEditFocus(false);
|
||||
e->accept();
|
||||
@ -1453,7 +1454,7 @@ void QTextEdit::keyReleaseEvent(QKeyEvent *e)
|
||||
{
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
Q_D(QTextEdit);
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (!e->isAutoRepeat() && e->key() == Qt::Key_Back
|
||||
&& d->deleteAllTimer.isActive()) {
|
||||
d->deleteAllTimer.stop();
|
||||
@ -1665,7 +1666,7 @@ void QTextEdit::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
Q_D(QTextEdit);
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (QApplication::keypadNavigationEnabled() && !hasEditFocus())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus())
|
||||
setEditFocus(true);
|
||||
#endif
|
||||
d->sendControlEvent(e);
|
||||
@ -1796,7 +1797,7 @@ void QTextEdit::inputMethodEvent(QInputMethodEvent *e)
|
||||
Q_D(QTextEdit);
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (d->control->textInteractionFlags() & Qt::TextEditable
|
||||
&& QApplication::keypadNavigationEnabled()
|
||||
&& QApplicationPrivate::keypadNavigationEnabled()
|
||||
&& !hasEditFocus())
|
||||
setEditFocus(true);
|
||||
#endif
|
||||
|
@ -54,6 +54,7 @@
|
||||
#endif
|
||||
|
||||
#include "qapplication.h"
|
||||
#include "private/qapplication_p.h"
|
||||
#if QT_CONFIG(graphicsview)
|
||||
#include "qgraphicssceneevent.h"
|
||||
#endif
|
||||
@ -1662,7 +1663,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
|
||||
case Qt::Key_F4:
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
case Qt::Key_Select:
|
||||
if (!QApplication::keypadNavigationEnabled())
|
||||
if (!QApplicationPrivate::keypadNavigationEnabled())
|
||||
break;
|
||||
#endif
|
||||
if (!m_completer->currentCompletion().isEmpty() && hasSelectedText()
|
||||
@ -1912,7 +1913,7 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
|
||||
break;
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
case Qt::Key_Back:
|
||||
if (QApplication::keypadNavigationEnabled() && !event->isAutoRepeat()
|
||||
if (QApplicationPrivate::keypadNavigationEnabled() && !event->isAutoRepeat()
|
||||
&& !isReadOnly()) {
|
||||
if (text().length() == 0) {
|
||||
setText(m_cancelText);
|
||||
|
@ -55,6 +55,7 @@
|
||||
#endif
|
||||
#include <qstyle.h>
|
||||
#include <qtimer.h>
|
||||
#include "private/qapplication_p.h"
|
||||
#include "private/qtextdocumentlayout_p.h"
|
||||
#include "private/qabstracttextdocumentlayout_p.h"
|
||||
#include "qtextdocument.h"
|
||||
@ -294,7 +295,7 @@ bool QWidgetTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e)
|
||||
bool isNavigationEvent = e->key() == Qt::Key_Up || e->key() == Qt::Key_Down;
|
||||
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
ignoreNavigationEvents = ignoreNavigationEvents || QApplication::keypadNavigationEnabled();
|
||||
ignoreNavigationEvents = ignoreNavigationEvents || QApplicationPrivate::keypadNavigationEnabled();
|
||||
isNavigationEvent = isNavigationEvent ||
|
||||
(QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional
|
||||
&& (e->key() == Qt::Key_Left || e->key() == Qt::Key_Right));
|
||||
@ -1159,7 +1160,7 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
case QEvent::EnterEditFocus:
|
||||
case QEvent::LeaveEditFocus:
|
||||
if (QApplication::keypadNavigationEnabled())
|
||||
if (QApplicationPrivate::keypadNavigationEnabled())
|
||||
d->editFocusEvent(e);
|
||||
break;
|
||||
#endif
|
||||
@ -2218,7 +2219,7 @@ void QWidgetTextControlPrivate::focusEvent(QFocusEvent *e)
|
||||
emit q->updateRequest(q->selectionRect());
|
||||
if (e->gotFocus()) {
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (!QApplication::keypadNavigationEnabled() || (hasEditFocus && (e->reason() == Qt::PopupFocusReason))) {
|
||||
if (!QApplicationPrivate::keypadNavigationEnabled() || (hasEditFocus && (e->reason() == Qt::PopupFocusReason))) {
|
||||
#endif
|
||||
cursorOn = (interactionFlags & (Qt::TextSelectableByKeyboard | Qt::TextEditable));
|
||||
if (interactionFlags & Qt::TextEditable) {
|
||||
@ -2259,7 +2260,7 @@ void QWidgetTextControlPrivate::editFocusEvent(QEvent *e)
|
||||
{
|
||||
Q_Q(QWidgetTextControl);
|
||||
|
||||
if (QApplication::keypadNavigationEnabled()) {
|
||||
if (QApplicationPrivate::keypadNavigationEnabled()) {
|
||||
if (e->type() == QEvent::EnterEditFocus && interactionFlags & Qt::TextEditable) {
|
||||
const QTextCursor oldSelection = cursor;
|
||||
const int oldCursorPos = cursor.position();
|
||||
@ -3280,7 +3281,7 @@ QAbstractTextDocumentLayout::PaintContext QWidgetTextControl::getPaintContext(QW
|
||||
if (!d->dndFeedbackCursor.isNull())
|
||||
ctx.cursorPosition = d->dndFeedbackCursor.position();
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (!QApplication::keypadNavigationEnabled() || d->hasEditFocus)
|
||||
if (!QApplicationPrivate::keypadNavigationEnabled() || d->hasEditFocus)
|
||||
#endif
|
||||
if (d->cursor.hasSelection()) {
|
||||
QAbstractTextDocumentLayout::Selection selection;
|
||||
|
Loading…
Reference in New Issue
Block a user