From cfe17692dc6c65b2979dbd648d2eebff78a83200 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 30 Mar 2009 11:19:15 +0200 Subject: Provide a previousInFocusChain for consistancy Task-number: 201649 Reviewed-by: Thierry --- src/gui/kernel/qwidget.cpp | 14 ++++++++++++++ src/gui/kernel/qwidget.h | 1 + tests/auto/qwidget/tst_qwidget.cpp | 12 ++++++++++++ 3 files changed, 27 insertions(+) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 09162ee..ce14c82 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -5897,6 +5897,8 @@ QWidget *QWidget::focusWidget() const /*! Returns the next widget in this widget's focus chain. + + \sa previousInFocusChain */ QWidget *QWidget::nextInFocusChain() const { @@ -5904,6 +5906,18 @@ QWidget *QWidget::nextInFocusChain() const } /*! + Returns the previous widget in this widget's focus chain. + + \sa nextInFocusChain + + \since 4.6 +*/ +QWidget *QWidget::previousInFocusChain() const +{ + return const_cast(d_func()->focus_prev); +} + +/*! \property QWidget::isActiveWindow \brief whether this widget's window is the active window diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index f54ebf9..309463e 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -539,6 +539,7 @@ public: QWidget *focusWidget() const; QWidget *nextInFocusChain() const; + QWidget *previousInFocusChain() const; // drag and drop bool acceptDrops() const; diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index dfd0792..9197144 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -1544,6 +1544,10 @@ void tst_QWidget::focusChainOnReparent() QCOMPARE(w, expectedOriginalChain[i]); w = w->nextInFocusChain(); } + for (int i = 7; i >= 0; --i) { + w = w->previousInFocusChain(); + QCOMPARE(w, expectedOriginalChain[i]); + } QWidget window2; child2->setParent(&window2); @@ -1554,6 +1558,10 @@ void tst_QWidget::focusChainOnReparent() QCOMPARE(w, expectedNewChain[i]); w = w->nextInFocusChain(); } + for (int i = 4; i >= 0; --i) { + w = w->previousInFocusChain(); + QCOMPARE(w, expectedNewChain[i]); + } QWidget *expectedOldChain[5] = {&window, child1, child3, child4, &window}; w = &window; @@ -1561,6 +1569,10 @@ void tst_QWidget::focusChainOnReparent() QCOMPARE(w, expectedOldChain[i]); w = w->nextInFocusChain(); } + for (int i = 4; i >= 0; --i) { + w = w->previousInFocusChain(); + QCOMPARE(w, expectedOldChain[i]); + } } -- cgit v0.12 From d2aaca5abc5c2853081b50407fc8ee7756d9ddfa Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 30 Mar 2009 11:23:09 +0200 Subject: Fixed a compile issue on Windows --- src/gui/styles/qwindowsxpstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 55f99a3..50cd13f 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -3168,7 +3168,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo #ifndef QT_NO_DIAL case CC_Dial: if (const QStyleOptionSlider *dial = qstyleoption_cast(option)) - QStyleHelper::drawDial(dial, painter); + QStyleHelper::drawDial(dial, p); break; #endif // QT_NO_DIAL default: -- cgit v0.12