Skip to content

Commit

Permalink
[layout] use nicer default state and geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Feb 18, 2018
1 parent 9d56c38 commit 24cbbcf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/app/layout/qgslayoutdesignerdialog.cpp
Expand Up @@ -63,6 +63,8 @@
#include "qgsreportorganizerwidget.h" #include "qgsreportorganizerwidget.h"
#include "qgsreadwritecontext.h" #include "qgsreadwritecontext.h"
#include "ui_qgssvgexportoptions.h" #include "ui_qgssvgexportoptions.h"
#include "ui_defaults.h"

#include <QShortcut> #include <QShortcut>
#include <QComboBox> #include <QComboBox>
#include <QLineEdit> #include <QLineEdit>
Expand Down Expand Up @@ -3387,15 +3389,18 @@ void QgsLayoutDesignerDialog::restoreWindowState()
// restore the toolbar and dock widgets positions using Qt settings API // restore the toolbar and dock widgets positions using Qt settings API
QgsSettings settings; QgsSettings settings;


//TODO - defaults if ( !restoreState( settings.value( QStringLiteral( "LayoutDesigner/state" ), QByteArray::fromRawData( reinterpret_cast< const char * >( defaultLayerDesignerUIstate ), sizeof defaultLayerDesignerUIstate ), QgsSettings::App ).toByteArray() ) )
if ( !restoreState( settings.value( QStringLiteral( "LayoutDesigner/state" ), QVariant(), QgsSettings::App /*, QByteArray::fromRawData( ( char * )defaultComposerUIstate, sizeof defaultComposerUIstate ) */ ).toByteArray() ) )
{ {
QgsDebugMsg( "restore of layout UI state failed" ); QgsDebugMsg( "restore of layout UI state failed" );
} }
// restore window geometry // restore window geometry
if ( !restoreGeometry( settings.value( QStringLiteral( "LayoutDesigner/geometry" ), QVariant(), QgsSettings::App /*, QByteArray::fromRawData( ( char * )defaultComposerUIgeometry, sizeof defaultComposerUIgeometry ) */ ).toByteArray() ) ) if ( !restoreGeometry( settings.value( QStringLiteral( "LayoutDesigner/geometry" ), QgsSettings::App ).toByteArray() ) )
{ {
QgsDebugMsg( "restore of layout UI geometry failed" ); QgsDebugMsg( "restore of layout UI geometry failed" );
// default to 80% of screen size, at 10% from top left corner
resize( QDesktopWidget().availableGeometry( this ).size() * 0.8 );
QSize pos = QDesktopWidget().availableGeometry( this ).size() * 0.1;
move( pos.width(), pos.height() );
} }
} }


Expand Down

0 comments on commit 24cbbcf

Please sign in to comment.