23 #include <QApplication>
25 #include <QPushButton>
29 : QDialog( parent, fl )
33 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsProjectionSelectionDialog::showHelp );
42 mSplitter->restoreState( settings.
value( QStringLiteral(
"Windows/ProjectionSelectorDialog/splitterState" ) ).toByteArray() );
48 settings.
setValue( QStringLiteral(
"Windows/ProjectionSelectorDialog/splitterState" ), mSplitter->saveState() );
60 setMessage( tr(
"This layer appears to have no projection specification." )
62 + tr(
"By default, this layer will now have its projection set to that of the project, "
63 "but you may override this by selecting a different projection below." ) );
68 projectionSelector->setShowNoProjection( show );
73 return projectionSelector->showNoProjection();
78 projectionSelector->setNotSetText( text );
83 mButtonBox->button( QDialogButtonBox::Ok )->setEnabled( projectionSelector->hasValidSelection() );
87 mButtonBox->button( QDialogButtonBox::Ok )->setEnabled( isValid );
93 return projectionSelector->crs();
98 projectionSelector->setCrs(
crs );
103 projectionSelector->setOgcWmsCrsFilter( crsFilter );
106 void QgsProjectionSelectionDialog::showHelp()
108 QgsHelp::openHelp( QStringLiteral(
"working_with_projections/working_with_projections.html" ) );
static QString reportStyleSheet(QgsApplication::StyleSheetType styleSheetType=QgsApplication::StyleSheetType::Qt)
Returns a css style sheet for reports, the styleSheetType argument determines what type of stylesheet...
This class represents a coordinate reference system (CRS).
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
void setNotSetText(const QString &text)
Sets the text to show for the not set option.
void showNoCrsForLayerMessage()
When called, the dialog will show a default "layer has no CRS set" message above the projection selec...
void setShowNoProjection(bool show)
Sets whether a "no/invalid" projection option should be shown.
bool showNoProjection() const
Returns whether the "no/invalid" projection option is shown.
void setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the initial crs to show within the dialog.
void setMessage(const QString &message)
Sets a message to show in the dialog.
QgsCoordinateReferenceSystem crs() const
Returns the CRS currently selected in the widget.
QgsProjectionSelectionDialog(QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)
Constructor for QgsProjectionSelectionDialog.
void setRequireValidSelection()
Sets the dialog to require a valid selection only, preventing users from accepting the dialog if no s...
void setOgcWmsCrsFilter(const QSet< QString > &crsFilter)
filters this dialog by the given CRSs
~QgsProjectionSelectionDialog() override
This class is a composition of two QSettings instances:
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
const QgsCoordinateReferenceSystem & crs