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
+24
View File
@@ -43,6 +43,8 @@ MainWindow::MainWindow(QWidget *parent) :
QCoreApplication::setOrganizationDomain("evtv.me");
QCoreApplication::setApplicationName("SavvyCAN");
readSettings();
selfRef = this;
this->setWindowTitle("Savvy CAN V" + QString::number(VERSION));
@@ -224,9 +226,31 @@ MainWindow::~MainWindow()
void MainWindow::closeEvent(QCloseEvent *event)
{
writeSettings();
exitApp();
}
void MainWindow::readSettings()
{
QSettings settings;
if (settings.value("Main/SaveRestorePositions", false).toBool())
{
resize(settings.value("Main/WindowSize", QSize(800, 572)).toSize());
move(settings.value("Main/WindowPos", QPoint(100, 100)).toPoint());
}
}
void MainWindow::writeSettings()
{
QSettings settings;
if (settings.value("Main/SaveRestorePositions", false).toBool())
{
settings.setValue("Main/WindowSize", size());
settings.setValue("Main/WindowPos", pos());
}
}
void MainWindow::gridClicked(QModelIndex idx)
{
if (ui->canFramesView->rowHeight(idx.row()) > normalRowHeight)