Skip to content

Commit

Permalink
saves the correct subwindow size when it is hidden (#3589)
Browse files Browse the repository at this point in the history
* saves the correct subwindow size when it is hidden

* remove invisible size from saveWidgetState()
  • Loading branch information
BaraMGB authored and tresf committed Jun 13, 2017
1 parent ca5d2b6 commit 220559f
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion include/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class MainWindow : public QMainWindow
return m_keyMods.m_alt;
}

static void saveWidgetState( QWidget * _w, QDomElement & _de, QSize const & sizeIfInvisible = QSize(0, 0) );
static void saveWidgetState( QWidget * _w, QDomElement & _de );
static void restoreWidgetState( QWidget * _w, const QDomElement & _de );

public slots:
Expand Down
8 changes: 4 additions & 4 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ void MainWindow::clearKeyModifiers()



void MainWindow::saveWidgetState( QWidget * _w, QDomElement & _de, QSize const & sizeIfInvisible )
void MainWindow::saveWidgetState( QWidget * _w, QDomElement & _de )
{
// If our widget is the main content of a window (e.g. piano roll, FxMixer, etc),
// we really care about the position of the *window* - not the position of the widget within its window
Expand All @@ -757,7 +757,7 @@ void MainWindow::saveWidgetState( QWidget * _w, QDomElement & _de, QSize const &
_de.setAttribute( "x", normalGeom.x() );
_de.setAttribute( "y", normalGeom.y() );

QSize sizeToStore = visible ? normalGeom.size() : sizeIfInvisible;
QSize sizeToStore = normalGeom.size();
_de.setAttribute( "width", sizeToStore.width() );
_de.setAttribute( "height", sizeToStore.height() );
}
Expand All @@ -769,8 +769,8 @@ void MainWindow::restoreWidgetState( QWidget * _w, const QDomElement & _de )
{
QRect r( qMax( 1, _de.attribute( "x" ).toInt() ),
qMax( 1, _de.attribute( "y" ).toInt() ),
qMax( 100, _de.attribute( "width" ).toInt() ),
qMax( 100, _de.attribute( "height" ).toInt() ) );
qMax( _w->sizeHint().width(), _de.attribute( "width" ).toInt() ),
qMax( _w->minimumHeight(), _de.attribute( "height" ).toInt() ) );
if( _de.hasAttribute( "visible" ) && !r.isNull() )
{
// If our widget is the main content of a window (e.g. piano roll, FxMixer, etc),
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editors/AutomationEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void AutomationEditor::setCurrentPattern(AutomationPattern * new_pattern )

void AutomationEditor::saveSettings(QDomDocument & doc, QDomElement & dom_parent)
{
MainWindow::saveWidgetState(parentWidget(), dom_parent, QSize( 640, 400 ));
MainWindow::saveWidgetState( parentWidget(), dom_parent );
}


Expand Down
2 changes: 1 addition & 1 deletion src/gui/editors/BBEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void BBTrackContainerView::removeBBView(int bb)

void BBTrackContainerView::saveSettings(QDomDocument& doc, QDomElement& element)
{
MainWindow::saveWidgetState(parentWidget(), element, QSize( 640, 400 ) );
MainWindow::saveWidgetState( parentWidget(), element );
}

void BBTrackContainerView::loadSettings(const QDomElement& element)
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4392,7 +4392,7 @@ void PianoRollWindow::reset()

void PianoRollWindow::saveSettings( QDomDocument & doc, QDomElement & de )
{
MainWindow::saveWidgetState( this, de, QSize( 640, 480 ) );
MainWindow::saveWidgetState( this, de );
}


Expand Down
2 changes: 1 addition & 1 deletion src/gui/editors/SongEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ SongEditor::~SongEditor()

void SongEditor::saveSettings( QDomDocument& doc, QDomElement& element )
{
MainWindow::saveWidgetState(parentWidget(), element, QSize( 640, 400 ));
MainWindow::saveWidgetState( parentWidget(), element );
}

void SongEditor::loadSettings( const QDomElement& element )
Expand Down
2 changes: 1 addition & 1 deletion src/gui/widgets/ControllerRackView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ ControllerRackView::~ControllerRackView()
void ControllerRackView::saveSettings( QDomDocument & _doc,
QDomElement & _this )
{
MainWindow::saveWidgetState( this, _this, QSize( 400, 300) );
MainWindow::saveWidgetState( this, _this );
}


Expand Down
2 changes: 1 addition & 1 deletion src/gui/widgets/ProjectNotes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ void ProjectNotes::alignmentChanged( int _a )

void ProjectNotes::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
MainWindow::saveWidgetState( this, _this, QSize( 640, 400 ) );
MainWindow::saveWidgetState( this, _this );

QDomCDATASection ds = _doc.createCDATASection( m_edit->toHtml() );
_this.appendChild( ds );
Expand Down

0 comments on commit 220559f

Please sign in to comment.