diff options
author | Alessandro Portale <aportale@trolltech.com> | 2009-09-19 11:37:38 (GMT) |
---|---|---|
committer | Alessandro Portale <aportale@trolltech.com> | 2009-09-19 11:37:38 (GMT) |
commit | cd48ed92670a0d086589b202364f38f14e7221c9 (patch) | |
tree | a3e9d51e75822a1380699d7cd5fb87ee1522239d | |
parent | 3581668cd0ffbe47a05ce7467f8d89b8c9bb6101 (diff) | |
download | Qt-cd48ed92670a0d086589b202364f38f14e7221c9.zip Qt-cd48ed92670a0d086589b202364f38f14e7221c9.tar.gz Qt-cd48ed92670a0d086589b202364f38f14e7221c9.tar.bz2 |
Making Keypad Navigation more usable
All changes of this commit are #ifdef'ed in
QT_KEYPAD_NAVIGATION. Most desktop Qts won't notice
any change.
Navigating between QWidgets was not alwys a pleasure on
keypad devices. This commit fixes the navigation behavior
for some widgets, mostly itemviews.
Furthermore, it adds a 'directional' navigation mode. Until
now, the existing keypad navigation used the tab order
do go back and forth between widgets. The new mode is supposed
to provide a more intuitive navigation. It is the new default
mode on Symbian.
Screens (and their resolutions) become bigger, and also low
resolution screens can be used in landscape mode. That's
why the directional mode was requested.
Another popular request was to put some more convenience into
QSlider: If a (horizontal) slider has focus and the user presses
left/right, the value of the slider may directing change
without being selected (edit mode).
This commit also adds the manual test 'keypadnavigation'.
Reviewed-by: Shane Kearns
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 15 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 90 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_p.h | 12 | ||||
-rw-r--r-- | src/gui/styles/qs60style.cpp | 9 | ||||
-rw-r--r-- | src/gui/text/qtextcontrol.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/qabstractbutton.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/qabstractslider.cpp | 69 | ||||
-rw-r--r-- | src/gui/widgets/qmenu.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/qplaintextedit.cpp | 9 | ||||
-rw-r--r-- | tests/manual/keypadnavigation/keypadnavigation.pro | 2 | ||||
-rw-r--r-- | tests/manual/keypadnavigation/keypadnavigation.ui | 1226 | ||||
-rw-r--r-- | tests/manual/keypadnavigation/main.cpp | 69 |
13 files changed, 1493 insertions, 28 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 757ded9..5c68928 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2166,6 +2166,12 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) #endif case Qt::Key_Left: case Qt::Key_Right: +#ifdef QT_KEYPAD_NAVIGATION + if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) { + event->accept(); // don't change horizontal focus in directional mode + break; + } +#endif // QT_KEYPAD_NAVIGATION case Qt::Key_Home: case Qt::Key_End: case Qt::Key_PageUp: diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 0ff7314..df4a935 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -4781,13 +4781,13 @@ void QApplicationPrivate::emitLastWindowClosed() \note On Windows CE this feature is disabled by default for touch device mkspecs. To enable keypad navigation, build Qt with QT_KEYPAD_NAVIGATION defined. - + \note On Symbian, setting the mode to Qt::NavigationModeCursorAuto will enable a virtual mouse cursor on non touchscreen devices, which is controlled by the cursor keys if there is no analog pointer device. On other platforms and on touchscreen devices, it has the same meaning as Qt::NavigationModeNone. - + \since 4.6 \sa keypadNavigationEnabled() @@ -4810,10 +4810,10 @@ void QApplication::setNavigationMode(Qt::NavigationMode mode) \note On Windows CE this feature is disabled by default for touch device mkspecs. To enable keypad navigation, build Qt with QT_KEYPAD_NAVIGATION defined. - + \note On Symbian, the default mode is Qt::NavigationModeNone for touch devices, and Qt::NavigationModeKeypadDirectional. - + \since 4.6 \sa keypadNavigationEnabled() @@ -4829,12 +4829,11 @@ Qt::NavigationMode QApplication::navigationMode() This feature is available in Qt for Embedded Linux, Symbian and Windows CE only. - \note On Windows CE this feature is disabled by default for touch device mkspecs. To enable keypad navigation, build Qt with QT_KEYPAD_NAVIGATION defined. - + \deprecated \sa setNavigationMode() @@ -4846,7 +4845,7 @@ void QApplication::setKeypadNavigationEnabled(bool enable) QApplication::setNavigationMode(Qt::NavigationModeKeypadDirectional); #else QApplication::setNavigationMode(Qt::NavigationModeKeypadTabOrder); -#endif +#endif } else { QApplication::setNavigationMode(Qt::NavigationModeNone); @@ -4863,7 +4862,7 @@ void QApplication::setKeypadNavigationEnabled(bool enable) \note On Windows CE this feature is disabled by default for touch device mkspecs. To enable keypad navigation, build Qt with QT_KEYPAD_NAVIGATION defined. - + \deprecated \sa navigationMode() diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 860b98b..4f1ab94 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -410,7 +410,6 @@ void QWidget::setEditFocus(bool on) QApplication::sendEvent(f, &event); QApplication::sendEvent(f->style(), &event); } - f->repaint(); // Widget might want to repaint a focus indicator } #endif @@ -6449,6 +6448,8 @@ void QWidgetPrivate::reparentFocusWidgets(QWidget * oldtlw) This function is called from QDesktopwidget::screen(QPoint) to find the closest screen for a point. + In directional KeypadNavigation, it is called to find the closest + widget to the current focus widget center. */ int QWidgetPrivate::pointToRect(const QPoint &p, const QRect &r) { @@ -7929,10 +7930,21 @@ bool QWidget::event(QEvent *event) #ifdef QT_KEYPAD_NAVIGATION if (!k->isAccepted() && QApplication::keypadNavigationEnabled() && !(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::ShiftModifier))) { - if (k->key() == Qt::Key_Up) - res = focusNextPrevChild(false); - else if (k->key() == Qt::Key_Down) - res = focusNextPrevChild(true); + if (QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder) { + if (k->key() == Qt::Key_Up) + res = focusNextPrevChild(false); + else if (k->key() == Qt::Key_Down) + res = focusNextPrevChild(true); + } else if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) { + if (k->key() == Qt::Key_Up) + res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionNorth); + else if (k->key() == Qt::Key_Right) + res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionEast); + else if (k->key() == Qt::Key_Down) + res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionSouth); + else if (k->key() == Qt::Key_Left) + res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionWest); + } if (res) { k->accept(); break; @@ -11373,6 +11385,74 @@ QRect QWidgetPrivate::frameStrut() const return maybeTopData() ? maybeTopData()->frameStrut : QRect(); } +#ifdef QT_KEYPAD_NAVIGATION +/*! + \internal + + Changes the focus from the current focusWidget to a widget in + the \a direction. + + Returns true, if there was a widget in that direction +*/ +bool QWidgetPrivate::navigateToDirection(Direction direction) +{ + QWidget *targetWidget = widgetInNavigationDirection(direction); + if (targetWidget) + targetWidget->setFocus(); + return (targetWidget != 0); +} + +/*! + \internal + + Searches for a widget that is positioned in the \a direction, starting + from the current focusWidget. + + Returns the pointer to a found widget or 0, if there was no widget in + that direction. +*/ +QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction) +{ + const QWidget *sourceWidget = QApplication::focusWidget(); + if (!sourceWidget) + return 0; + const QRect sourceRect = sourceWidget->rect().translated(sourceWidget->mapToGlobal(QPoint())); + const int sourceX = + (direction == DirectionNorth || direction == DirectionSouth) ? + (sourceRect.left() + (sourceRect.right() - sourceRect.left()) / 2) + :(direction == DirectionEast ? sourceRect.right() : sourceRect.left()); + const int sourceY = + (direction == DirectionEast || direction == DirectionWest) ? + (sourceRect.top() + (sourceRect.bottom() - sourceRect.top()) / 2) + :(direction == DirectionSouth ? sourceRect.bottom() : sourceRect.top()); + const QPoint sourcePoint(sourceX, sourceY); + const QPoint sourceCenter = sourceRect.center(); + const QWidget *sourceWindow = sourceWidget->window(); + + QWidget *targetWidget = 0; + int shortestDistance = INT_MAX; + foreach(QWidget *targetCandidate, QApplication::allWidgets()) { + const QRect targetCandidateRect = targetCandidate->rect().translated(targetCandidate->mapToGlobal(QPoint())); + if ( targetCandidate != sourceWidget + && targetCandidate->focusPolicy() & Qt::TabFocus + && !(direction == DirectionNorth && targetCandidateRect.bottom() > sourceRect.top()) + && !(direction == DirectionEast && targetCandidateRect.left() < sourceRect.right()) + && !(direction == DirectionSouth && targetCandidateRect.top() < sourceRect.bottom()) + && !(direction == DirectionWest && targetCandidateRect.right() > sourceRect.left()) + && targetCandidate->isEnabled() + && targetCandidate->isVisible() + && targetCandidate->window() == sourceWindow) { + const int targetCandidateDistance = pointToRect(sourcePoint, targetCandidateRect); + if (targetCandidateDistance < shortestDistance) { + shortestDistance = targetCandidateDistance; + targetWidget = targetCandidate; + } + } + } + return targetWidget; +} +#endif + /*! \preliminary \since 4.2 diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 7eb8f04..5e06c29 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -252,6 +252,13 @@ public: CloseWithSpontaneousEvent }; + enum Direction { + DirectionNorth = 0x01, + DirectionEast = 0x10, + DirectionSouth = 0x02, + DirectionWest = 0x20 + }; + // Functions. explicit QWidgetPrivate(int version = QObjectPrivateVersion); ~QWidgetPrivate(); @@ -398,6 +405,11 @@ public: void updateFrameStrut(); QRect frameStrut() const; +#ifdef QT_KEYPAD_NAVIGATION + static bool navigateToDirection(Direction direction); + static QWidget *widgetInNavigationDirection(Direction direction); +#endif + void setWindowIconText_sys(const QString &cap); void setWindowIconText_helper(const QString &cap); void setWindowTitle_sys(const QString &cap); diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 664ee41..1e57167 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -706,10 +706,11 @@ void QS60StylePrivate::setThemePalette(QPalette *palette) const palette->setColor(QPalette::AlternateBase, Qt::transparent); palette->setBrush(QPalette::Base, Qt::transparent); // set button and tooltipbase based on pixel colors - const QColor buttonColor = this->colorFromFrameGraphics(SF_ButtonNormal); - palette->setColor(QPalette::Button, buttonColor ); - const QColor toolTipColor = this->colorFromFrameGraphics(SF_ToolTip); - palette->setColor(QPalette::ToolTipBase, toolTipColor ); +// After natitive pixmap support, colorFromFrameGraphics caused reproducable crashes on some setups. +// const QColor buttonColor = colorFromFrameGraphics(SF_ButtonNormal); +// palette->setColor(QPalette::Button, buttonColor); +// const QColor toolTipColor = colorFromFrameGraphics(SF_ToolTip); +// palette->setColor(QPalette::ToolTipBase, toolTipColor); palette->setColor(QPalette::Light, palette->color(QPalette::Button).lighter()); palette->setColor(QPalette::Dark, palette->color(QPalette::Button).darker()); palette->setColor(QPalette::Midlight, palette->color(QPalette::Button).lighter(125)); diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 25006b1..6def06e 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -271,7 +271,9 @@ bool QTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e) } #ifdef QT_KEYPAD_NAVIGATION else if (QApplication::keypadNavigationEnabled() - && (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down)) { + && ((e->key() == Qt::Key_Up || e->key() == Qt::Key_Down) + || QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional + && (e->key() == Qt::Key_Left || e->key() == Qt::Key_Right))) { return false; } #endif diff --git a/src/gui/widgets/qabstractbutton.cpp b/src/gui/widgets/qabstractbutton.cpp index d2f4baf..cb46791 100644 --- a/src/gui/widgets/qabstractbutton.cpp +++ b/src/gui/widgets/qabstractbutton.cpp @@ -1172,7 +1172,10 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e) case Qt::Key_Right: case Qt::Key_Down: #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled() && (e->key() == Qt::Key_Left || e->key() == Qt::Key_Right)) { + if ((QApplication::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))) { e->ignore(); return; } diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index 34fe340..a50c105 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -47,6 +47,9 @@ #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" #endif +#ifdef QT_KEYPAD_NAVIGATION +#include "qtabwidget.h" // Needed in inTabWidget() +#endif // QT_KEYPAD_NAVIGATION #include <limits.h> QT_BEGIN_NAMESPACE @@ -724,6 +727,45 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e) } } #endif +#ifdef QT_KEYPAD_NAVIGATION +/*! + \internal + + Tells us if it there is currently a reachable widget by keypad navigation in + a certain \a orientation. + If no navigation is possible, occuring key events in that \a orientation may + be used to interact with the value in the focussed widget, even though it + currently has not the editFocus. + + \sa QWidgetPrivate::widgetInNavigationDirection(), QWidget::hasEditFocus() +*/ +inline static bool canKeypadNavigate(Qt::Orientation orientation) +{ + return orientation == Qt::Horizontal? + (QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionEast) + || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionWest)) + :(QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionNorth) + || QWidgetPrivate::widgetInNavigationDirection(QWidgetPrivate::DirectionSouth)); +} +/*! + \internal + + Checks, if the \a widget is inside a QTabWidget. If is is inside + one, left/right key events will be used to switch between tabs in keypad + navigation. If there is no QTabWidget, the horizontal key events can be used to + interact with the value in the focussed widget, even though it currently has + not the editFocus. + + \sa QWidget::hasEditFocus() +*/ +inline static bool inTabWidget(QWidget *widget) +{ + for (QWidget *tabWidget = widget; tabWidget; tabWidget = tabWidget->parentWidget()) + if (qobject_cast<const QTabWidget*>(tabWidget)) + return true; + return false; +} +#endif // QT_KEYPAD_NAVIGATION /*! \reimp */ @@ -751,7 +793,13 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) // It seems we need to use invertedAppearance for Left and right, otherwise, things look weird. case Qt::Key_Left: #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { + // 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() + && (!hasEditFocus() && QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder + || d->orientation == Qt::Vertical + || !hasEditFocus() && (canKeypadNavigate(Qt::Horizontal) || inTabWidget(this)))) { ev->ignore(); return; } @@ -766,7 +814,11 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) break; case Qt::Key_Right: #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { + // Same logic as in Qt::Key_Left + if (QApplication::keypadNavigationEnabled() + && (!hasEditFocus() && QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder + || d->orientation == Qt::Vertical + || !hasEditFocus() && (canKeypadNavigate(Qt::Horizontal) || inTabWidget(this)))) { ev->ignore(); return; } @@ -781,7 +833,12 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) break; case Qt::Key_Up: #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled()) { + // In QApplication::KeypadNavigationDirectional, we want to change the slider + // value if there is no up/down navigation possible. + if (QApplication::keypadNavigationEnabled() + && (QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder + || d->orientation == Qt::Horizontal + || !hasEditFocus() && canKeypadNavigate(Qt::Vertical))) { ev->ignore(); break; } @@ -790,7 +847,11 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) break; case Qt::Key_Down: #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled()) { + // Same logic as in Qt::Key_Up + if (QApplication::keypadNavigationEnabled() + && (QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder + || d->orientation == Qt::Horizontal + || !hasEditFocus() && canKeypadNavigate(Qt::Vertical))) { ev->ignore(); break; } diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index d971ac2..925be02 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -570,11 +570,6 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason // Since the menu is a pop-up, it uses the popup reason. if (!q->hasFocus()) { q->setFocus(Qt::PopupFocusReason); -#ifdef QT_KEYPAD_NAVIGATION - // TODO: aportale, remove KEYPAD_NAVIGATION_HACK when softkey stack - // handles focus related and user related actions separately... - QActionToKeyEventMapper::addSoftKey(QAction::CancelSoftKey, Qt::Key_Back, q); -#endif } } } diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index fda063a..d519bfe 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -1639,6 +1639,15 @@ void QPlainTextEdit::keyPressEvent(QKeyEvent *e) return; } break; + case Qt::Key_Left: + case Qt::Key_Right: + if (QApplication::keypadNavigationEnabled() + && QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) { + // Same as for Key_Up and Key_Down. + e->ignore(); + return; + } + break; case Qt::Key_Back: if (!e->isAutoRepeat()) { if (QApplication::keypadNavigationEnabled()) { diff --git a/tests/manual/keypadnavigation/keypadnavigation.pro b/tests/manual/keypadnavigation/keypadnavigation.pro new file mode 100644 index 0000000..6d12606 --- /dev/null +++ b/tests/manual/keypadnavigation/keypadnavigation.pro @@ -0,0 +1,2 @@ +SOURCES += main.cpp +FORMS += keypadnavigation.ui diff --git a/tests/manual/keypadnavigation/keypadnavigation.ui b/tests/manual/keypadnavigation/keypadnavigation.ui new file mode 100644 index 0000000..e0db662 --- /dev/null +++ b/tests/manual/keypadnavigation/keypadnavigation.ui @@ -0,0 +1,1226 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>KeypadNavigation</class> + <widget class="QMainWindow" name="KeypadNavigation"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>264</width> + <height>378</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>KeypadNavigation</string> + </property> + <widget class="QWidget" name="centralWidget"> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QStackedWidget" name="m_stackWidget"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="m_pageVerticalSimple"> + <layout class="QVBoxLayout" name="verticalLayout_11"> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QScrollArea" name="scrollArea"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>248</width> + <height>501</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>'TabOrder' navigation mode friendly, vertical, 1-dimensional layout with basic widgets. The tab order goes from top to bottom.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Foo</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="lineEdit"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Bar</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSlider" name="horizontalSlider"> + <property name="maximum"> + <number>10</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Foo</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="lineEdit_4"> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Bar</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QSlider" name="horizontalSlider_2"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maximum"> + <number>10</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Foo</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QDateEdit" name="dateEdit"/> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>Bar</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QComboBox" name="comboBox"> + <item> + <property name="text"> + <string>Item 1</string> + </property> + </item> + <item> + <property name="text"> + <string>Item 2</string> + </property> + </item> + <item> + <property name="text"> + <string>Item 3</string> + </property> + </item> + <item> + <property name="text"> + <string>Item 4</string> + </property> + </item> + <item> + <property name="text"> + <string>Item 5</string> + </property> + </item> + <item> + <property name="text"> + <string>Item 6</string> + </property> + </item> + <item> + <property name="text"> + <string>Item 7</string> + </property> + </item> + <item> + <property name="text"> + <string>Item 9</string> + </property> + </item> + <item> + <property name="text"> + <string>Item 10</string> + </property> + </item> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QPlainTextEdit" name="plainTextEdit"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>80</height> + </size> + </property> + <property name="plainText"> + <string>Edit some text</string> + </property> + </widget> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QPushButton" name="pushButton"> + <property name="text"> + <string>Foo QPushButton</string> + </property> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Foo</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QRadioButton" name="radioButton"> + <property name="text"> + <string>Bar 1</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButton_2"> + <property name="text"> + <string>Bar 2</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Foo</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QCheckBox" name="checkBox"> + <property name="text"> + <string>CheckBox</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkBox_2"> + <property name="text"> + <string>CheckBox</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="m_pageVerticalComplex"> + <layout class="QVBoxLayout" name="verticalLayout_8"> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Tab 1</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_6"> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QScrollArea" name="scrollArea_2"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents_2"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>242</width> + <height>472</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout_7"> + <property name="margin"> + <number>9</number> + </property> + <item> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Challenes both navigation modes: Vertical, 1-dimensional layout with <span style=" font-weight:600;">complex</span> widgets. The tab order goes from top to bottom.</p></body></html></string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QListWidget" name="listWidget"> + <property name="minimumSize"> + <size> + <width>1</width> + <height>1</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>80</height> + </size> + </property> + <item> + <property name="text"> + <string>Item 1</string> + </property> + </item> + <item> + <property name="text"> + <string>Item 2</string> + </property> + </item> + <item> + <property name="text"> + <string>Item 3</string> + </property> + </item> + <item> + <property name="text"> + <string>Item 4</string> + </property> + </item> + <item> + <property name="text"> + <string>Item 5</string> + </property> + </item> + </widget> + </item> + <item> + <widget class="QTreeWidget" name="treeWidget"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>80</height> + </size> + </property> + <column> + <property name="text"> + <string/> + </property> + </column> + <column> + <property name="text"> + <string>B</string> + </property> + </column> + <item> + <property name="text"> + <string>A</string> + </property> + <property name="text"> + <string>Foo</string> + </property> + <item> + <property name="text"> + <string>1</string> + </property> + <property name="text"> + <string>Bar</string> + </property> + <item> + <property name="text"> + <string>a</string> + </property> + <property name="text"> + <string>Foo</string> + </property> + </item> + <item> + <property name="text"> + <string>b</string> + </property> + <property name="text"> + <string>Bar</string> + </property> + </item> + <item> + <property name="text"> + <string>c</string> + </property> + <property name="text"> + <string>Foo</string> + </property> + </item> + </item> + <item> + <property name="text"> + <string>2</string> + </property> + <property name="text"> + <string>Bar</string> + </property> + <item> + <property name="text"> + <string>a</string> + </property> + <property name="text"> + <string>Foo</string> + </property> + </item> + <item> + <property name="text"> + <string>b</string> + </property> + <property name="text"> + <string>Bar</string> + </property> + </item> + <item> + <property name="text"> + <string>c</string> + </property> + <property name="text"> + <string>Foo</string> + </property> + </item> + </item> + <item> + <property name="text"> + <string>3</string> + </property> + <property name="text"> + <string>Bar</string> + </property> + <item> + <property name="text"> + <string>a</string> + </property> + <property name="text"> + <string>Foo</string> + </property> + </item> + <item> + <property name="text"> + <string>b</string> + </property> + <property name="text"> + <string>Bar</string> + </property> + </item> + <item> + <property name="text"> + <string>c</string> + </property> + <property name="text"> + <string>Foo</string> + </property> + </item> + </item> + </item> + <item> + <property name="text"> + <string>B</string> + </property> + <property name="text"> + <string>Bar</string> + </property> + <item> + <property name="text"> + <string>1</string> + </property> + <property name="text"> + <string>Foo</string> + </property> + </item> + <item> + <property name="text"> + <string>2</string> + </property> + <property name="text"> + <string>Bar</string> + </property> + </item> + <item> + <property name="text"> + <string>3</string> + </property> + <property name="text"> + <string>Foo</string> + </property> + </item> + </item> + </widget> + </item> + <item> + <widget class="QTableWidget" name="tableWidget"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>80</height> + </size> + </property> + <row> + <property name="text"> + <string>1</string> + </property> + </row> + <row> + <property name="text"> + <string>2</string> + </property> + </row> + <row> + <property name="text"> + <string>3</string> + </property> + </row> + <column> + <property name="text"> + <string>A</string> + </property> + </column> + <column> + <property name="text"> + <string>B</string> + </property> + </column> + <column> + <property name="text"> + <string>C</string> + </property> + </column> + <item row="0" column="0"> + <property name="text"> + <string>Foo</string> + </property> + </item> + <item row="0" column="1"> + <property name="text"> + <string>Bar</string> + </property> + </item> + <item row="0" column="2"> + <property name="text"> + <string>Foo</string> + </property> + </item> + <item row="1" column="0"> + <property name="text"> + <string>Bar</string> + </property> + </item> + <item row="1" column="1"> + <property name="text"> + <string>Foo</string> + </property> + </item> + <item row="1" column="2"> + <property name="text"> + <string>Bar</string> + </property> + </item> + <item row="2" column="0"> + <property name="text"> + <string>Foo</string> + </property> + </item> + <item row="2" column="1"> + <property name="text"> + <string>Bar</string> + </property> + </item> + <item row="2" column="2"> + <property name="text"> + <string>Foo</string> + </property> + </item> + </widget> + </item> + <item> + <widget class="QCalendarWidget" name="calendarWidget"> + <property name="minimumSize"> + <size> + <width>100</width> + <height>80</height> + </size> + </property> + <property name="horizontalHeaderFormat"> + <enum>QCalendarWidget::SingleLetterDayNames</enum> + </property> + <property name="verticalHeaderFormat"> + <enum>QCalendarWidget::NoVerticalHeader</enum> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Tab 2</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_9"> + <item> + <widget class="QPlainTextEdit" name="plainTextEdit_2"> + <property name="plainText"> + <string>Congratulations! You changed the Tab :) + +As a reward you can try out the QDial, below.</string> + </property> + </widget> + </item> + <item> + <widget class="QDial" name="dial"/> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="m_pageTwoDimensional"> + <layout class="QVBoxLayout" name="verticalLayout_12"> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QScrollArea" name="scrollArea_3"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents_3"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>264</width> + <height>357</height> + </rect> + </property> + <layout class="QGridLayout" name="gridLayout_5"> + <item row="0" column="0" colspan="3"> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string>2-dimensional layout. Better usable with 'Directional' navigation mode.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0" colspan="3"> + <widget class="QLineEdit" name="lineEdit_13"/> + </item> + <item row="1" column="3"> + <widget class="QToolButton" name="toolButton_31"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QToolButton" name="toolButton_30"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLineEdit" name="lineEdit_2"/> + </item> + <item row="4" column="1"> + <widget class="QLineEdit" name="lineEdit_3"/> + </item> + <item row="4" column="2"> + <widget class="QLineEdit" name="lineEdit_5"/> + </item> + <item row="4" column="3"> + <widget class="QToolButton" name="toolButton_32"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLineEdit" name="lineEdit_6"/> + </item> + <item row="5" column="1"> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>Foo</string> + </property> + </widget> + </item> + <item row="5" column="2"> + <widget class="QLineEdit" name="lineEdit_8"/> + </item> + <item row="8" column="0" colspan="4"> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="1" column="1"> + <widget class="QPushButton" name="pushButton_23"> + <property name="text"> + <string>D</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="pushButton_7"> + <property name="text"> + <string>A</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QPushButton" name="pushButton_9"> + <property name="text"> + <string>B</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QPushButton" name="pushButton_20"> + <property name="text"> + <string>E</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QPushButton" name="pushButton_24"> + <property name="text"> + <string>C</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QPushButton" name="pushButton_29"> + <property name="text"> + <string>F</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="pushButton_28"> + <property name="text"> + <string>G</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="0" colspan="3"> + <widget class="QLineEdit" name="lineEdit_14"/> + </item> + <item row="7" column="0" colspan="4"> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>1</height> + </size> + </property> + </spacer> + </item> + <item row="6" column="0"> + <widget class="QLineEdit" name="lineEdit_7"/> + </item> + <item row="6" column="1"> + <widget class="QLineEdit" name="lineEdit_9"/> + </item> + <item row="6" column="2"> + <widget class="QLineEdit" name="lineEdit_10"/> + </item> + <item row="6" column="3"> + <widget class="QToolButton" name="toolButton_35"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="m_pageSliderMagic"> + <layout class="QVBoxLayout" name="verticalLayout_10"> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QScrollArea" name="scrollArea_4"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents_4"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>264</width> + <height>357</height> + </rect> + </property> + <layout class="QGridLayout" name="gridLayout_7"> + <item row="0" column="0" colspan="2"> + <widget class="QLabel" name="label_11"> + <property name="text"> + <string>If possible, the slider value changes on left/right. However, navigating horizontally and changing tabs has higher priority.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QSlider" name="horizontalSlider_4"> + <property name="maximum"> + <number>10</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2"> + <widget class="QSlider" name="horizontalSlider_3"> + <property name="maximum"> + <number>10</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="5" column="0" colspan="2"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item row="4" column="0" colspan="2"> + <widget class="QTabWidget" name="tabWidget_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>Tab 1</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="1" column="1"> + <widget class="QToolButton" name="toolButton_3"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QSlider" name="horizontalSlider_6"> + <property name="maximum"> + <number>10</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QSlider" name="horizontalSlider_7"> + <property name="maximum"> + <number>10</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_4"> + <attribute name="title"> + <string>Tab 2</string> + </attribute> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QSlider" name="horizontalSlider_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLCDNumber" name="lcdNumber"/> + </item> + </layout> + </widget> + </widget> + </item> + <item row="2" column="1"> + <widget class="QToolButton" name="toolButton_2"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="m_pageChaos"> + <layout class="QGridLayout" name="gridLayout_6"> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>0</number> + </property> + <item row="1" column="0"> + <widget class="QToolButton" name="toolButton_12"> + <property name="text"> + <string>o</string> + </property> + </widget> + </item> + <item row="2" column="5"> + <widget class="QToolButton" name="toolButton_10"> + <property name="text"> + <string>o</string> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QToolButton" name="toolButton_9"> + <property name="text"> + <string>o</string> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QToolButton" name="toolButton_14"> + <property name="text"> + <string>o</string> + </property> + </widget> + </item> + <item row="7" column="3"> + <widget class="QToolButton" name="toolButton_16"> + <property name="text"> + <string>o</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QToolButton" name="toolButton_11"> + <property name="text"> + <string>o</string> + </property> + </widget> + </item> + <item row="3" column="4"> + <widget class="QToolButton" name="toolButton_6"> + <property name="text"> + <string>o</string> + </property> + </widget> + </item> + <item row="6" column="4"> + <widget class="QToolButton" name="toolButton_15"> + <property name="text"> + <string>o</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QToolButton" name="toolButton_19"> + <property name="text"> + <string>o</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QToolButton" name="toolButton_7"> + <property name="text"> + <string>o</string> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QToolButton" name="toolButton_13"> + <property name="text"> + <string>o</string> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menuBar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>264</width> + <height>21</height> + </rect> + </property> + <widget class="QMenu" name="menuUi_layout"> + <property name="title"> + <string>Ui-layout</string> + </property> + <addaction name="m_actionLayoutVerticalSimple"/> + <addaction name="m_actionLayoutVerticalComplex"/> + <addaction name="m_actionLayoutTwoDimensional"/> + <addaction name="m_actionLayoutSliderMagic"/> + <addaction name="m_actionLayoutChaos"/> + </widget> + <widget class="QMenu" name="menuNavigation_mode"> + <property name="title"> + <string>Navigation mode</string> + </property> + <addaction name="m_actionModeNone"/> + <addaction name="m_actionModeKeypadTabOrder"/> + <addaction name="m_actionModeKeypadDirectional"/> + <addaction name="m_actionModeCursorAuto"/> + <addaction name="m_actionModeCursorForceVisible"/> + </widget> + <addaction name="menuUi_layout"/> + <addaction name="menuNavigation_mode"/> + </widget> + <action name="m_actionLayoutVerticalSimple"> + <property name="text"> + <string>Vertical Simple</string> + </property> + </action> + <action name="m_actionLayoutVerticalComplex"> + <property name="text"> + <string>Vertical Complex</string> + </property> + </action> + <action name="m_actionLayoutTwoDimensional"> + <property name="text"> + <string>Two-dimentional</string> + </property> + </action> + <action name="m_actionLayoutSliderMagic"> + <property name="text"> + <string>Slider magic</string> + </property> + </action> + <action name="m_actionLayoutChaos"> + <property name="text"> + <string>Chaos!</string> + </property> + </action> + <action name="m_actionModeNone"> + <property name="text"> + <string>None</string> + </property> + </action> + <action name="m_actionModeKeypadTabOrder"> + <property name="text"> + <string>KeypadTabOrder</string> + </property> + </action> + <action name="m_actionModeKeypadDirectional"> + <property name="text"> + <string>KeypadDirectional</string> + </property> + </action> + <action name="m_actionModeCursorAuto"> + <property name="text"> + <string>CursorAuto</string> + </property> + </action> + <action name="m_actionModeCursorForceVisible"> + <property name="text"> + <string>CursorForceVisible</string> + </property> + </action> + </widget> + <layoutdefault spacing="6" margin="11"/> + <tabstops> + <tabstop>lineEdit</tabstop> + <tabstop>horizontalSlider</tabstop> + <tabstop>lineEdit_4</tabstop> + <tabstop>horizontalSlider_2</tabstop> + <tabstop>dateEdit</tabstop> + <tabstop>comboBox</tabstop> + <tabstop>plainTextEdit</tabstop> + <tabstop>pushButton</tabstop> + <tabstop>radioButton</tabstop> + <tabstop>radioButton_2</tabstop> + <tabstop>checkBox</tabstop> + <tabstop>checkBox_2</tabstop> + <tabstop>listWidget</tabstop> + <tabstop>treeWidget</tabstop> + <tabstop>tableWidget</tabstop> + <tabstop>calendarWidget</tabstop> + <tabstop>plainTextEdit_2</tabstop> + <tabstop>dial</tabstop> + <tabstop>horizontalSlider_7</tabstop> + <tabstop>toolButton_3</tabstop> + <tabstop>horizontalSlider_6</tabstop> + <tabstop>horizontalSlider_5</tabstop> + <tabstop>scrollArea_3</tabstop> + <tabstop>lineEdit_13</tabstop> + <tabstop>toolButton_31</tabstop> + <tabstop>lineEdit_14</tabstop> + <tabstop>toolButton_30</tabstop> + <tabstop>lineEdit_2</tabstop> + <tabstop>lineEdit_3</tabstop> + <tabstop>lineEdit_5</tabstop> + <tabstop>toolButton_32</tabstop> + <tabstop>lineEdit_6</tabstop> + <tabstop>lineEdit_8</tabstop> + <tabstop>lineEdit_7</tabstop> + <tabstop>lineEdit_9</tabstop> + <tabstop>lineEdit_10</tabstop> + <tabstop>toolButton_35</tabstop> + <tabstop>pushButton_7</tabstop> + <tabstop>pushButton_9</tabstop> + <tabstop>pushButton_24</tabstop> + <tabstop>pushButton_23</tabstop> + <tabstop>pushButton_20</tabstop> + <tabstop>pushButton_29</tabstop> + <tabstop>pushButton_28</tabstop> + <tabstop>toolButton_12</tabstop> + <tabstop>toolButton_11</tabstop> + <tabstop>toolButton_10</tabstop> + <tabstop>toolButton_6</tabstop> + <tabstop>toolButton_19</tabstop> + <tabstop>toolButton_9</tabstop> + <tabstop>toolButton_15</tabstop> + <tabstop>toolButton_14</tabstop> + <tabstop>toolButton_16</tabstop> + <tabstop>tabWidget</tabstop> + <tabstop>scrollArea_2</tabstop> + <tabstop>scrollArea</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>horizontalSlider_5</sender> + <signal>valueChanged(int)</signal> + <receiver>lcdNumber</receiver> + <slot>display(int)</slot> + <hints> + <hint type="sourcelabel"> + <x>201</x> + <y>326</y> + </hint> + <hint type="destinationlabel"> + <x>245</x> + <y>324</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/tests/manual/keypadnavigation/main.cpp b/tests/manual/keypadnavigation/main.cpp new file mode 100644 index 0000000..28ba628 --- /dev/null +++ b/tests/manual/keypadnavigation/main.cpp @@ -0,0 +1,69 @@ +#include <QtGui> +#include "ui_keypadnavigation.h" + +class KeypadNavigation : public QMainWindow +{ + Q_OBJECT + +public: + KeypadNavigation(QWidget *parent = 0) + : QMainWindow(parent) + , ui(new Ui_KeypadNavigation) + { + ui->setupUi(this); + + connect(ui->m_actionLayoutVerticalSimple, SIGNAL(triggered()), &m_layoutSignalMapper, SLOT(map())); + m_layoutSignalMapper.setMapping(ui->m_actionLayoutVerticalSimple, ui->m_pageVerticalSimple); + connect(ui->m_actionLayoutVerticalComplex, SIGNAL(triggered()), &m_layoutSignalMapper, SLOT(map())); + m_layoutSignalMapper.setMapping(ui->m_actionLayoutVerticalComplex, ui->m_pageVerticalComplex); + connect(ui->m_actionLayoutTwoDimensional, SIGNAL(triggered()), &m_layoutSignalMapper, SLOT(map())); + m_layoutSignalMapper.setMapping(ui->m_actionLayoutTwoDimensional, ui->m_pageTwoDimensional); + connect(ui->m_actionLayoutSliderMagic, SIGNAL(triggered()), &m_layoutSignalMapper, SLOT(map())); + m_layoutSignalMapper.setMapping(ui->m_actionLayoutSliderMagic, ui->m_pageSliderMagic); + connect(ui->m_actionLayoutChaos, SIGNAL(triggered()), &m_layoutSignalMapper, SLOT(map())); + m_layoutSignalMapper.setMapping(ui->m_actionLayoutChaos, ui->m_pageChaos); + connect(&m_layoutSignalMapper, SIGNAL(mapped(QWidget*)), ui->m_stackWidget, SLOT(setCurrentWidget(QWidget*))); + + connect(ui->m_actionModeNone, SIGNAL(triggered()), &m_modeSignalMapper, SLOT(map())); + m_modeSignalMapper.setMapping(ui->m_actionModeNone, int(Qt::NavigationModeNone)); + connect(ui->m_actionModeKeypadTabOrder, SIGNAL(triggered()), &m_modeSignalMapper, SLOT(map())); + m_modeSignalMapper.setMapping(ui->m_actionModeKeypadTabOrder, int(Qt::NavigationModeKeypadTabOrder)); + connect(ui->m_actionModeKeypadDirectional, SIGNAL(triggered()), &m_modeSignalMapper, SLOT(map())); + m_modeSignalMapper.setMapping(ui->m_actionModeKeypadDirectional, int(Qt::NavigationModeKeypadDirectional)); + connect(ui->m_actionModeCursorAuto, SIGNAL(triggered()), &m_modeSignalMapper, SLOT(map())); + m_modeSignalMapper.setMapping(ui->m_actionModeCursorAuto, int(Qt::NavigationModeCursorAuto)); + connect(ui->m_actionModeCursorForceVisible, SIGNAL(triggered()), &m_modeSignalMapper, SLOT(map())); + m_modeSignalMapper.setMapping(ui->m_actionModeCursorForceVisible, int(Qt::NavigationModeCursorForceVisible)); + connect(&m_modeSignalMapper, SIGNAL(mapped(int)), SLOT(setNavigationMode(int))); + } + + ~KeypadNavigation() + { + delete ui; + } + +public slots: + void setNavigationMode(int mode) + { + QApplication::setNavigationMode(Qt::NavigationMode(mode)); + } + +private: + Ui_KeypadNavigation *ui; + QSignalMapper m_layoutSignalMapper; + QSignalMapper m_modeSignalMapper; +}; + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + KeypadNavigation w; +#ifdef Q_WS_S60 + w.showMaximized(); +#else + w.show(); +#endif + return a.exec(); +} + +#include "main.moc" |