void MainWindow::keyReleaseEvent(QKeyEvent *event) { QWidget::keyReleaseEvent(event); if (event->key() == Qt::Key_F3) { if (m_homeView->isVisible()) showMapView(); else showHomeView(); } }
void BrowserWindow::keyReleaseEvent(QKeyEvent *event) { QWidget::keyReleaseEvent(event); if (event->key() == Qt::Key_F3) { if (m_animation->state() == QAbstractAnimation::Running) { const QAbstractAnimation::Direction direction = m_animation->direction() == QAbstractAnimation::Forward ? QAbstractAnimation::Forward : QAbstractAnimation::Backward; m_animation->setDirection(direction); } else if (qFuzzyCompare(slideValue(), static_cast<qreal>(1.0f))) showHomeView(); else showBrowserView(); event->accept(); } }
BrowserWindow::BrowserWindow() : m_slidingSurface(new QWidget(this)) , m_homeView(new HomeView(m_slidingSurface)) , m_browserView(new BrowserView(m_slidingSurface)) , m_animation(new QPropertyAnimation(this, "slideValue")) { m_slidingSurface->setAutoFillBackground(true); m_homeView->resize(size()); m_browserView->resize(size()); connect(m_homeView, SIGNAL(addressEntered(QString)), SLOT(gotoAddress(QString))); connect(m_homeView, SIGNAL(urlActivated(QUrl)), SLOT(navigate(QUrl))); connect(m_browserView, SIGNAL(menuButtonClicked()), SLOT(showHomeView())); m_animation->setDuration(200); connect(m_animation, SIGNAL(finished()), SLOT(animationFinished())); setSlideValue(0.0f); }
void BrowserWindow::initialize() { m_homeView = new HomeView(this); m_browserView = new BrowserView(this); m_homeView->hide(); m_homeView->resize(size()); m_homeView->move(0, 0); m_browserView->hide(); m_browserView->resize(size()); m_browserView->move(0, 0); connect(m_homeView, SIGNAL(addressEntered(QString)), SLOT(gotoAddress(QString))); connect(m_homeView, SIGNAL(urlActivated(QUrl)), SLOT(navigate(QUrl))); connect(m_browserView, SIGNAL(menuButtonClicked()), SLOT(showHomeView())); m_homeView->setVisible(false); m_browserView->setVisible(false); slide(0); connect(m_timeLine, SIGNAL(frameChanged(int)), SLOT(slide(int))); }