Skip to content
Permalink
Browse files

[layouts] Save table editor panel state to avoid having to constantly

resize formatting panel on reopen
  • Loading branch information
nyalldawson committed Jul 27, 2020
1 parent 51d8ad7 commit 7cfa476a2d3c3ce8be472adc670cad913d402d1a
@@ -138,6 +138,11 @@ Emitted whenever the table contents are changed.
Emitted whenever the "include table header" setting is changed.
%End

protected:

virtual void closeEvent( QCloseEvent * );


};

/************************************************************************
@@ -20,6 +20,7 @@
#include "qgsdockwidget.h"
#include "qgspanelwidgetstack.h"
#include "qgstableeditorformattingwidget.h"
#include "qgssettings.h"

#include <QClipboard>
#include <QMessageBox>
@@ -135,6 +136,22 @@ QgsTableEditorDialog::QgsTableEditorDialog( QWidget *parent )
mTableWidget->setIncludeTableHeader( checked );
emit includeHeaderChanged( checked );
} );

// restore the toolbar and dock widgets positions using Qt settings API
QgsSettings settings;

const QByteArray state = settings.value( QStringLiteral( "LayoutDesigner/tableEditorState" ), QByteArray(), QgsSettings::App ).toByteArray();
if ( !state.isEmpty() && !restoreState( state ) )
{
QgsDebugMsg( QStringLiteral( "restore of table editor dialog UI state failed" ) );
}
}

void QgsTableEditorDialog::closeEvent( QCloseEvent * )
{
QgsSettings settings;
// store the toolbar/dock widget settings using Qt settings API
settings.setValue( QStringLiteral( "LayoutDesigner/tableEditorState" ), saveState(), QgsSettings::App );
}

bool QgsTableEditorDialog::setTableContentsFromClipboard()
@@ -154,6 +154,10 @@ class GUI_EXPORT QgsTableEditorDialog : public QMainWindow, private Ui::QgsTable
*/
void includeHeaderChanged( bool included );

protected:

void closeEvent( QCloseEvent * ) override;

private:
QgsTableEditorWidget *mTableWidget = nullptr;
QgsMessageBar *mMessageBar = nullptr;

0 comments on commit 7cfa476

Please sign in to comment.
You can’t perform that action at this time.