Implemented window size and position tracking for the forms that are currently implemented and working
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user