Skip to content
Permalink
Browse files

[layouts] When selecting a CRS for a map item, don't show misleading

"no crs" option at the top of the dialog.

Instead, correctly label this option as "Use project CRS", which
is what it actually means.
  • Loading branch information
nyalldawson committed Sep 23, 2020
1 parent c68d05c commit c3a26db4babbef46ae1b7904bb9d1f0ee9e273ad
@@ -89,6 +89,14 @@ option is selected, calling :py:func:`~QgsProjectionSelectionDialog.crs` will re
.. seealso:: :py:func:`setShowNoProjection`

.. versionadded:: 3.0
%End

void setNotSetText( const QString &text );
%Docstring
Sets the text to show for the not set option. Note that this option is not shown
by default and must be set visible by calling :py:func:`~QgsProjectionSelectionDialog.setShowNoProjection`.

.. versionadded:: 3.16
%End

public slots:
@@ -75,6 +75,14 @@ option is selected, calling :py:func:`~QgsProjectionSelectionTreeWidget.crs` wil
.. seealso:: :py:func:`setShowNoProjection`

.. versionadded:: 3.0
%End

void setNotSetText( const QString &text );
%Docstring
Sets the text to show for the not set option. Note that this option is not shown
by default and must be set visible by calling :py:func:`~QgsProjectionSelectionTreeWidget.setShowNoProjection`.

.. versionadded:: 3.16
%End

bool showBoundsMap() const;
@@ -72,6 +72,11 @@ bool QgsProjectionSelectionDialog::showNoProjection() const
return projectionSelector->showNoProjection();
}

void QgsProjectionSelectionDialog::setNotSetText( const QString &text )
{
projectionSelector->setNotSetText( text );
}

QgsCoordinateReferenceSystem QgsProjectionSelectionDialog::crs() const
{
return projectionSelector->crs();
@@ -99,6 +99,13 @@ class GUI_EXPORT QgsProjectionSelectionDialog : public QDialog, private Ui::QgsG
*/
bool showNoProjection() const;

/**
* Sets the text to show for the not set option. Note that this option is not shown
* by default and must be set visible by calling setShowNoProjection().
* \since QGIS 3.16
*/
void setNotSetText( const QString &text );

public slots:

/**
@@ -433,6 +433,11 @@ bool QgsProjectionSelectionTreeWidget::showNoProjection() const
return !mCheckBoxNoProjection->isHidden();
}

void QgsProjectionSelectionTreeWidget::setNotSetText( const QString &text )
{
mCheckBoxNoProjection->setText( text );
}

bool QgsProjectionSelectionTreeWidget::showBoundsMap() const
{
return mShowMap;
@@ -79,6 +79,13 @@ class GUI_EXPORT QgsProjectionSelectionTreeWidget : public QWidget, private Ui::
*/
bool showNoProjection() const;

/**
* Sets the text to show for the not set option. Note that this option is not shown
* by default and must be set visible by calling setShowNoProjection().
* \since QGIS 3.16
*/
void setNotSetText( const QString &text );

/**
* Returns whether the bounds preview map is shown.
* \see setShowBoundsMap()
@@ -174,6 +174,9 @@ void QgsProjectionSelectionWidget::selectCrs()
dlg.setMessage( mMessage );
dlg.setCrs( mCrs );

if ( !mNotSetText.isEmpty() )
dlg.setNotSetText( mNotSetText );

if ( optionVisible( QgsProjectionSelectionWidget::CrsOption::CrsNotSet ) )
{
dlg.setShowNoProjection( true );

0 comments on commit c3a26db

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