Browse Source

Added proper support for fullscreen mode, fixed issue with window state update on perspective change

QGC4.4
lm 14 years ago
parent
commit
64b543c4c1
  1. 23
      src/ui/MainWindow.cc
  2. 1
      src/ui/MainWindow.h
  3. 2
      src/ui/MainWindow.ui

23
src/ui/MainWindow.cc

@ -172,6 +172,9 @@ MainWindow::MainWindow(QWidget *parent): @@ -172,6 +172,9 @@ MainWindow::MainWindow(QWidget *parent):
LinkManager::instance()->addProtocol(link, mavlink);
link->connect();
}
// Initialize window state
windowStateVal = windowState();
}
MainWindow::~MainWindow()
@ -1781,6 +1784,11 @@ void MainWindow::UASCreated(UASInterface* uas) @@ -1781,6 +1784,11 @@ void MainWindow::UASCreated(UASInterface* uas)
// Custom widgets, added last to all menus and layouts
buildCustomWidget();
// Restore the mainwindow size
if (settings.contains(getWindowGeometryKey()))
{
restoreGeometry(settings.value(getWindowGeometryKey()).toByteArray());
}
}
/**
@ -1790,6 +1798,10 @@ void MainWindow::clearView() @@ -1790,6 +1798,10 @@ void MainWindow::clearView()
{
// Save current state
if (UASManager::instance()->getUASList().count() > 0) settings.setValue(getWindowStateKey(), saveState(QGC::applicationVersion()));
// Although we want save the state of the window, we do not want to change the top-leve state (minimized, maximized, etc)
// therefore this state is stored here and restored after applying the rest of the settings in the new
// perspective.
windowStateVal = this->windowState();
settings.setValue(getWindowGeometryKey(), saveGeometry());
QAction* temp;
@ -1997,11 +2009,11 @@ void MainWindow::presentView() @@ -1997,11 +2009,11 @@ void MainWindow::presentView()
// Restore window state
if (UASManager::instance()->getUASList().count() > 0)
{
// Restore the mainwindow size
if (settings.contains(getWindowGeometryKey()))
{
restoreGeometry(settings.value(getWindowGeometryKey()).toByteArray());
}
// // Restore the mainwindow size
// if (settings.contains(getWindowGeometryKey()))
// {
// restoreGeometry(settings.value(getWindowGeometryKey()).toByteArray());
// }
// Restore the widget positions and size
if (settings.contains(getWindowStateKey()))
@ -2020,6 +2032,7 @@ void MainWindow::presentView() @@ -2020,6 +2032,7 @@ void MainWindow::presentView()
}
}
this->setWindowState(windowStateVal);
this->show();
}

1
src/ui/MainWindow.h

@ -426,6 +426,7 @@ protected: @@ -426,6 +426,7 @@ protected:
QString styleFileName;
bool autoReconnect;
QGC_MAINWINDOW_STYLE currentStyle;
Qt::WindowStates windowStateVal;
private:
Ui::MainWindow ui;

2
src/ui/MainWindow.ui

@ -445,7 +445,7 @@ @@ -445,7 +445,7 @@
<string>Fullscreen</string>
</property>
<property name="shortcut">
<string>Alt+Return</string>
<string>Meta+Return</string>
</property>
</action>
<action name="actionNormal">

Loading…
Cancel
Save