diff --git a/src/plugins/coreplugin/coreconstants.h b/src/plugins/coreplugin/coreconstants.h index 06d4d70085d16c3d026aad14358e20805ef4797e..2b42aca64a3dcf82a63e90342746eb0b233461fa 100644 --- a/src/plugins/coreplugin/coreconstants.h +++ b/src/plugins/coreplugin/coreconstants.h @@ -120,6 +120,7 @@ const char * const EXIT = "QtCreator.Exit"; const char * const OPTIONS = "QtCreator.Options"; const char * const TOGGLE_SIDEBAR = "QtCreator.ToggleSidebar"; +const char * const TOGGLE_FULLSCREEN = "QtCreator.ToggleFullScreen"; const char * const MINIMIZE_WINDOW = "QtCreator.MinimizeWindow"; const char * const ZOOM_WINDOW = "QtCreator.ZoomWindow"; @@ -187,6 +188,7 @@ const char * const G_WINDOW_NAVIGATE = "QtCreator.Group.Window.Navigate"; const char * const G_WINDOW_NAVIGATE_GROUPS = "QtCreator.Group.Window.Navigate.Groups"; const char * const G_WINDOW_OTHER = "QtCreator.Group.Window.Other"; const char * const G_WINDOW_LIST = "QtCreator.Group.Window.List"; +const char * const G_WINDOW_FULLSCREEN = "QtCreator.Group.Window.Fullscreen"; // help groups (global) const char * const G_HELP_HELP = "QtCreator.Group.Help.Help"; diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 5a535b532d3cbc827e35c65b6a55f4d79e86d31a..047bc747413e9c77cb21a30e5bd9d7277a98d9b2 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -143,6 +143,7 @@ MainWindow::MainWindow() : m_exitAction(0), m_optionsAction(0), m_toggleSideBarAction(0), + m_toggleFullScreenAction(0), #ifdef Q_OS_MAC m_minimizeAction(0), m_zoomAction(0), @@ -448,7 +449,6 @@ void MainWindow::registerDefaultActions() ActionContainer *medit = am->actionContainer(Constants::M_EDIT); ActionContainer *mtools = am->actionContainer(Constants::M_TOOLS); ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW); - Q_UNUSED(mwindow) ActionContainer *mhelp = am->actionContainer(Constants::M_HELP); // File menu separators @@ -641,6 +641,17 @@ void MainWindow::registerDefaultActions() mwindow->addAction(cmd, Constants::G_WINDOW_PANES); m_toggleSideBarAction->setEnabled(false); + // Toggle Full Screen + m_toggleFullScreenAction = new QAction(tr("Toggle Fullscreen"), this); + m_toggleFullScreenAction->setCheckable(true); + m_toggleFullScreenAction->setChecked(true); + cmd = am->registerAction(m_toggleFullScreenAction, + Constants::TOGGLE_FULLSCREEN, m_globalContext); + cmd->setDefaultKeySequence(QKeySequence("Ctrl+Shift+F11")); + mwindow->addAction(cmd, Constants::G_WINDOW_FULLSCREEN); + connect(m_toggleFullScreenAction, SIGNAL(toggled(bool)), + this, SLOT(setFullScreen(bool))); + //About IDE Action #ifdef Q_OS_MAC tmpaction = new QAction(tr("About &Qt Creator"), this); // it's convention not to add dots to the about menu @@ -1113,3 +1124,16 @@ QPrinter *MainWindow::printer() const m_printer = new QPrinter(QPrinter::HighResolution); return m_printer; } + +void MainWindow::setFullScreen(bool on) +{ + if (on) { + setWindowState(windowState() | Qt::WindowFullScreen); + //statusBar()->hide(); + //menuBar()->hide(); + } else { + setWindowState(windowState() & ~Qt::WindowFullScreen); + //menuBar()->show(); + //statusBar()->show(); + } +} diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index 4a1c08f16efb5ffa31a85df67bd335e070fd49ac..c7fccdefabb55954366a57f5608a1017d344e27a 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -137,6 +137,7 @@ public slots: void newFile(); void openFileWith(); void exit(); + void setFullScreen(bool on); QStringList showNewItemDialog(const QString &title, const QList<IWizard *> &wizards, @@ -213,6 +214,7 @@ private: QAction *m_exitAction; QAction *m_optionsAction; QAction *m_toggleSideBarAction; + QAction *m_toggleFullScreenAction; #ifdef Q_OS_MAC QAction *m_minimizeAction; QAction *m_zoomAction;