Implemented window size and position tracking for the forms that are currently implemented and working

This commit is contained in:
Collin Kidder
2015-06-28 18:55:46 -04:00
parent 821e681dcd
commit 6c967d2071
16 changed files with 253 additions and 0 deletions
+28
View File
@@ -10,6 +10,8 @@ GraphingWindow::GraphingWindow(const QVector<CANFrame> *frames, QWidget *parent)
{
ui->setupUi(this);
readSettings();
modelFrames = frames;
ui->graphingView->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes |
@@ -73,6 +75,32 @@ void GraphingWindow::showEvent(QShowEvent* event)
ui->graphingView->replot();
}
void GraphingWindow::closeEvent(QCloseEvent *event)
{
writeSettings();
}
void GraphingWindow::readSettings()
{
QSettings settings;
if (settings.value("Main/SaveRestorePositions", false).toBool())
{
resize(settings.value("Graphing/WindowSize", QSize(800, 600)).toSize());
move(settings.value("Graphing/WindowPos", QPoint(50, 50)).toPoint());
}
}
void GraphingWindow::writeSettings()
{
QSettings settings;
if (settings.value("Main/SaveRestorePositions", false).toBool())
{
settings.setValue("Graphing/WindowSize", size());
settings.setValue("Graphing/WindowPos", pos());
}
}
void GraphingWindow::updatedFrames(int numFrames)
{
if (numFrames == -1) //all frames deleted. Kill the display