implemented full screen toggle
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
#include "undo/undostack.h"
|
||||
#include "widget/menu/menushared.h"
|
||||
|
||||
MainMenu::MainMenu(QWidget *parent) :
|
||||
MainMenu::MainMenu(QMainWindow *parent) :
|
||||
QMenuBar(parent)
|
||||
{
|
||||
//
|
||||
@@ -84,7 +84,7 @@ MainMenu::MainMenu(QWidget *parent) :
|
||||
//
|
||||
// VIEW MENU
|
||||
//
|
||||
view_menu_ = new Menu(this);
|
||||
view_menu_ = new Menu(this, this, SLOT(ViewMenuAboutToShow()));
|
||||
view_zoom_in_item_ = view_menu_->AddItem("zoomin", this, SLOT(ZoomInTriggered()), "=");
|
||||
view_zoom_out_item_ = view_menu_->AddItem("zoomout", this, SLOT(ZoomOutTriggered()), "-");
|
||||
view_increase_track_height_item_ = view_menu_->AddItem("vzoomin", nullptr, nullptr, "Ctrl+=");
|
||||
@@ -151,7 +151,7 @@ MainMenu::MainMenu(QWidget *parent) :
|
||||
|
||||
view_menu_->addSeparator();
|
||||
|
||||
view_full_screen_item_ = view_menu_->AddItem("fullscreen", nullptr, nullptr, "F11");
|
||||
view_full_screen_item_ = view_menu_->AddItem("fullscreen", parent, SLOT(SetFullscreen(bool)), "F11");
|
||||
view_full_screen_item_->setCheckable(true);
|
||||
|
||||
view_full_screen_viewer_item_ = view_menu_->AddItem("fullscreenviewer", nullptr, nullptr);
|
||||
@@ -324,6 +324,12 @@ void MainMenu::ToolItemTriggered()
|
||||
olive::core.SetTool(tool);
|
||||
}
|
||||
|
||||
void MainMenu::ViewMenuAboutToShow()
|
||||
{
|
||||
// Parent is QMainWindow
|
||||
view_full_screen_item_->setChecked(parentWidget()->isFullScreen());
|
||||
}
|
||||
|
||||
void MainMenu::ToolsMenuAboutToShow()
|
||||
{
|
||||
// Ensure checked Tool is correct
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#ifndef MAINMENU_H
|
||||
#define MAINMENU_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QMenuBar>
|
||||
|
||||
#include "widget/menu/menu.h"
|
||||
@@ -34,7 +35,7 @@ class MainMenu : public QMenuBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainMenu(QWidget* parent);
|
||||
MainMenu(QMainWindow* parent);
|
||||
|
||||
protected:
|
||||
/**
|
||||
@@ -55,6 +56,11 @@ private slots:
|
||||
*/
|
||||
void ToolItemTriggered();
|
||||
|
||||
/**
|
||||
* @brief Slot triggered just before the View menu shows
|
||||
*/
|
||||
void ViewMenuAboutToShow();
|
||||
|
||||
/**
|
||||
* @brief Slot triggered just before the Tools menu shows
|
||||
*/
|
||||
|
||||
@@ -55,6 +55,15 @@ olive::MainWindow::MainWindow(QWidget *parent) :
|
||||
setMenuBar(main_menu);
|
||||
}
|
||||
|
||||
void olive::MainWindow::SetFullscreen(bool fullscreen)
|
||||
{
|
||||
if (fullscreen) {
|
||||
setWindowState(windowState() | Qt::WindowFullScreen);
|
||||
} else {
|
||||
setWindowState(windowState() & ~Qt::WindowFullScreen);
|
||||
}
|
||||
}
|
||||
|
||||
void olive::MainWindow::ProjectOpen(Project* p)
|
||||
{
|
||||
// FIXME Use settings data to create panels and restore state if they exist
|
||||
|
||||
@@ -37,12 +37,13 @@ public:
|
||||
|
||||
public slots:
|
||||
void ProjectOpen(Project *p);
|
||||
void SetFullscreen(bool fullscreen);
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent* e) override;
|
||||
|
||||
private:
|
||||
|
||||
Qt::WindowStates old_window_state_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user