Skip to content

Commit

Permalink
ADD: Remember window position of main_widget
Browse files Browse the repository at this point in the history
  • Loading branch information
spillerrec committed Oct 9, 2014
1 parent 3b34801 commit 3dc7e01
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ main_widget::main_widget()
viewer.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );

save_dir = settings.value( "save_directory", "." ).toString();
if( settings.value( "remember_position", true ).toBool() )
restoreGeometry( settings.value( "window_position" ).toByteArray() );
}
void main_widget::resize_preprocess(){ resize_groupbox( ui->preprocess_group ); }
void main_widget::resize_merge(){ resize_groupbox( ui->merge_group ); }
Expand Down Expand Up @@ -164,7 +166,10 @@ void main_widget::dropEvent( QDropEvent *event ){
event->accept();
}
}

void main_widget::closeEvent( QCloseEvent *event ){
settings.setValue( "window_position", saveGeometry() );
QWidget::closeEvent( event );
}

void main_widget::resize_groupbox( QGroupBox* box ){
if( box->isChecked() )
Expand Down
1 change: 1 addition & 0 deletions src/mainwindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class main_widget: public QMainWindow{
protected:
void dragEnterEvent( QDragEnterEvent *event );
void dropEvent( QDropEvent *event );
void closeEvent( QCloseEvent *event );

void resize_groupbox( QGroupBox* box );
void make_slide();
Expand Down

0 comments on commit 3dc7e01

Please sign in to comment.