Implemented window size and position tracking for the forms that are currently implemented and working
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
DBCMainEditor::DBCMainEditor(DBCHandler *handler, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
@@ -10,6 +11,8 @@ DBCMainEditor::DBCMainEditor(DBCHandler *handler, QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
readSettings();
|
||||
|
||||
dbcHandler = handler;
|
||||
|
||||
QStringList headers;
|
||||
@@ -63,6 +66,32 @@ DBCMainEditor::~DBCMainEditor()
|
||||
delete sigEditor;
|
||||
}
|
||||
|
||||
void DBCMainEditor::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
void DBCMainEditor::readSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
resize(settings.value("DBCMainEditor/WindowSize", QSize(1103, 571)).toSize());
|
||||
move(settings.value("DBCMainEditor/WindowPos", QPoint(50, 50)).toPoint());
|
||||
}
|
||||
}
|
||||
|
||||
void DBCMainEditor::writeSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
settings.setValue("DBCMainEditor/WindowSize", size());
|
||||
settings.setValue("DBCMainEditor/WindowPos", pos());
|
||||
}
|
||||
}
|
||||
|
||||
void DBCMainEditor::onCustomMenuNode(QPoint point)
|
||||
{
|
||||
QMenu *menu = new QMenu(this);
|
||||
|
||||
Reference in New Issue
Block a user