Skip to content

Commit

Permalink
Also use splitter in QgsProjectionSelectionDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 23, 2020
1 parent 9c40f6b commit 05c2519
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 33 deletions.
2 changes: 2 additions & 0 deletions python/gui/auto_generated/qgsprojectionselectiondialog.sip.in
Expand Up @@ -44,6 +44,8 @@ the you probably want to look at QgsProjectionSelectionWidget instead.
Constructor for QgsProjectionSelectionDialog.
%End

~QgsProjectionSelectionDialog();

QgsCoordinateReferenceSystem crs() const;
%Docstring
Returns the CRS currently selected in the widget.
Expand Down
9 changes: 9 additions & 0 deletions src/gui/qgsprojectionselectiondialog.cpp
Expand Up @@ -36,6 +36,15 @@ QgsProjectionSelectionDialog::QgsProjectionSelectionDialog( QWidget *parent,

//apply selected projection upon double-click on item
connect( projectionSelector, &QgsProjectionSelectionTreeWidget::projectionDoubleClicked, this, &QgsProjectionSelectionDialog::accept );

QgsSettings settings;
mSplitter->restoreState( settings.value( QStringLiteral( "Windows/ProjectionSelectorDialog/splitterState" ) ).toByteArray() );
}

QgsProjectionSelectionDialog::~QgsProjectionSelectionDialog()
{
QgsSettings settings;
settings.setValue( QStringLiteral( "Windows/ProjectionSelectorDialog/splitterState" ), mSplitter->saveState() );
}

void QgsProjectionSelectionDialog::setMessage( const QString &message )
Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgsprojectionselectiondialog.h
Expand Up @@ -59,6 +59,8 @@ class GUI_EXPORT QgsProjectionSelectionDialog : public QDialog, private Ui::QgsG
QgsProjectionSelectionDialog( QWidget *parent SIP_TRANSFERTHIS = nullptr,
Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags );

~QgsProjectionSelectionDialog() override;

/**
* Returns the CRS currently selected in the widget.
* \see setCrs()
Expand Down
68 changes: 35 additions & 33 deletions src/ui/qgsgenericprojectionselectorbase.ui
Expand Up @@ -15,48 +15,50 @@
</property>
<property name="windowIcon">
<iconset>
<normaloff/>
</iconset>
<normaloff>.</normaloff>.</iconset>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>3</number>
</property>
<item row="0" column="0">
<widget class="QTextEdit" name="textEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QSplitter" name="mSplitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>160</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="acceptDrops">
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<widget class="QTextEdit" name="textEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>160</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QgsProjectionSelectionTreeWidget" name="projectionSelector" native="true"/>
</widget>
</item>
<item row="1" column="0">
<widget class="QgsProjectionSelectionTreeWidget" name="projectionSelector" native="true"/>
</item>
<item row="2" column="0">
<item>
<widget class="QDialogButtonBox" name="mButtonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
Expand Down

0 comments on commit 05c2519

Please sign in to comment.