diff -r 41300fa6a67c -r 2f34d5167611 demos/embedded/anomaly/src/BrowserWindow.cpp --- a/demos/embedded/anomaly/src/BrowserWindow.cpp Tue Feb 02 00:43:10 2010 +0200 +++ b/demos/embedded/anomaly/src/BrowserWindow.cpp Fri Apr 16 15:50:13 2010 +0300 @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -93,12 +93,12 @@ { // we use a ratio to handle resize corectly const int pos = -qRound(slideRatio * width()); - m_slidingSurface->scroll(pos - m_homeView->x(), 0); + m_slidingSurface->scroll(pos - m_browserView->x(), 0); - if (qFuzzyCompare(slideRatio, static_cast(1.0f))) { + if (qFuzzyCompare(slideRatio, static_cast(0.0f))) { m_browserView->show(); m_homeView->hide(); - } else if (qFuzzyCompare(slideRatio, static_cast(0.0f))) { + } else if (qFuzzyCompare(slideRatio, static_cast(1.0f))) { m_homeView->show(); m_browserView->hide(); } else { @@ -110,13 +110,13 @@ qreal BrowserWindow::slideValue() const { Q_ASSERT(m_slidingSurface->x() < width()); - return static_cast(qAbs(m_homeView->x())) / width(); + return static_cast(qAbs(m_browserView->x())) / width(); } void BrowserWindow::showHomeView() { m_animation->setStartValue(slideValue()); - m_animation->setEndValue(0.0f); + m_animation->setEndValue(1.0f); m_animation->start(); m_homeView->setFocus(); } @@ -124,7 +124,7 @@ void BrowserWindow::showBrowserView() { m_animation->setStartValue(slideValue()); - m_animation->setEndValue(1.0f); + m_animation->setEndValue(0.0f); m_animation->start(); m_browserView->setFocus(); @@ -140,7 +140,7 @@ ? QAbstractAnimation::Forward : QAbstractAnimation::Backward; m_animation->setDirection(direction); - } else if (qFuzzyCompare(slideValue(), static_cast(1.0f))) + } else if (qFuzzyCompare(slideValue(), static_cast(0.0f))) showHomeView(); else showBrowserView(); @@ -151,16 +151,16 @@ void BrowserWindow::resizeEvent(QResizeEvent *event) { const QSize oldSize = event->oldSize(); - const qreal oldSlidingRatio = static_cast(qAbs(m_homeView->x())) / oldSize.width(); + const qreal oldSlidingRatio = static_cast(qAbs(m_browserView->x())) / oldSize.width(); const QSize newSize = event->size(); m_slidingSurface->resize(newSize.width() * 2, newSize.height()); m_homeView->resize(newSize); - m_homeView->move(0, 0); + m_homeView->move(newSize.width(), 0); m_browserView->resize(newSize); - m_browserView->move(newSize.width(), 0); + m_browserView->move(0, 0); setSlideValue(oldSlidingRatio); }