saves the correct subwindow size when it is hidden (#3589)

* saves the correct subwindow size when it is hidden

* remove invisible size from saveWidgetState()
This commit is contained in:
Steffen Baranowsky
2017-06-13 12:31:21 +02:00
committed by Oskar Wallgren
parent b2919d60d5
commit fc6d844a92
8 changed files with 11 additions and 11 deletions

View File

@@ -142,7 +142,7 @@ public:
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:

View File

@@ -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
@@ -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() );
}
@@ -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),

View File

@@ -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 );
}

View File

@@ -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)

View File

@@ -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 );
}

View File

@@ -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 )

View File

@@ -102,7 +102,7 @@ ControllerRackView::~ControllerRackView()
void ControllerRackView::saveSettings( QDomDocument & _doc,
QDomElement & _this )
{
MainWindow::saveWidgetState( this, _this, QSize( 400, 300) );
MainWindow::saveWidgetState( this, _this );
}

View File

@@ -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 );