changeset 492:ab3bcd06b5c2 fullscreen

Make the full-screen mode come up correctly (though not on demand!) and slot back in to the window when Esc is pressed
author Chris Cannam
date Fri, 20 Jan 2012 17:08:47 +0000
parents 9137b619b652
children 3a85461ab9a7
files main/MainWindow.cpp main/MainWindow.h
diffstat 2 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Thu Jan 19 15:40:03 2012 +0000
+++ b/main/MainWindow.cpp	Fri Jan 20 17:08:47 2012 +0000
@@ -376,10 +376,22 @@
 void
 MainWindow::goFullScreen()
 {
-    m_paneStack->setParent(0);
-    m_paneStack->showFullScreen();
-    QApplication::processEvents();
-    m_paneStack->adjustSize();
+    QWidget *ps = m_mainScroll->takeWidget();
+//    m_mainScroll->setWidget(0);
+    ps->setParent(0);
+    ps->showFullScreen();
+//    ps->showMaximized();
+    //!!! we don't really want to create this every time!
+    QShortcut *sc = new QShortcut(QKeySequence("Esc"), ps);
+    connect(sc, SIGNAL(activated()), this, SLOT(endFullScreen()));
+//    QApplication::processEvents();
+//    m_paneStack->adjustSize();
+}
+
+void
+MainWindow::endFullScreen()
+{
+    m_mainScroll->setWidget(m_paneStack);
 }
 
 void
--- a/main/MainWindow.h	Thu Jan 19 15:40:03 2012 +0000
+++ b/main/MainWindow.h	Fri Jan 20 17:08:47 2012 +0000
@@ -79,6 +79,7 @@
     virtual bool commitData(bool mayAskUser);
 
     void goFullScreen();
+    void endFullScreen();
 
 protected slots:
     virtual void openSession();