Skip to content
Permalink
Browse files
Remove QgsApplication::shortNameRegExp altogether, document API break
  • Loading branch information
nirvn committed Jul 14, 2021
1 parent 03d99a4 commit a580968983c3d5daaa5a35281039bd99c905872c
@@ -16,6 +16,16 @@ with too big impact should be deferred to a major version release.

This page tries to maintain a list with incompatible changes that happened in previous releases.

QGIS 3.22 {#qgis_api_break_3_22}
=========

QgsApplication {#qgis_api_break_3_22_qgsapplication}
--------------

- QgsApplication::shortNameRegExp function was removed as part of a general code migration away from deprecated
QRegExp class. It has been replaced with QgsApplication::shortNameRegularExpression which returns a
QRegularExpression object.

QGIS 3.20 {#qgis_api_break_3_20}
=========

@@ -380,14 +380,6 @@ colors are specified then the ``size`` argument also must be set.
Returns the path to user's style.
%End


static QRegExp shortNameRegExp() /Deprecated/;
%Docstring
Returns the short name regular expression for line edit validator

.. deprecated:: QGIS 3.22
%End

static QRegularExpression shortNameRegularExpression();
%Docstring
Returns the short name regular expression for line edit validator
@@ -81,6 +81,7 @@
#include <QDesktopServices>
#include <QAbstractListModel>
#include <QList>
#include <QRegularExpressionValidator>

const char *QgsProjectProperties::GEO_NONE_DESC = QT_TRANSLATE_NOOP( "QgsOptions", "None / Planimetric" );

@@ -467,7 +468,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
mWMSOnlineResourceExpressionButton->setToProperty( QgsProject::instance()->dataDefinedServerProperties().property( QgsProject::DataDefinedServerProperty::WMSOnlineResource ) );

// WMS Name validator
QValidator *shortNameValidator = new QRegExpValidator( QgsApplication::shortNameRegExp(), this );
QValidator *shortNameValidator = new QRegularExpressionValidator( QgsApplication::shortNameRegularExpression(), this );
mWMSName->setValidator( shortNameValidator );

// WMS Contact Position
@@ -1178,14 +1178,6 @@ QString QgsApplication::userStylePath()
return qgisSettingsDirPath() + QStringLiteral( "symbology-style.db" );
}

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QRegExp QgsApplication::shortNameRegExp()
{
const thread_local QRegExp regexp( QStringLiteral( "^[A-Za-z][A-Za-z0-9\\._-]*" ) );
return regexp;
}
#endif

QRegularExpression QgsApplication::shortNameRegularExpression()
{
const thread_local QRegularExpression regexp( QRegularExpression::anchoredPattern( QStringLiteral( "^[A-Za-z][A-Za-z0-9\\._-]*" ) ) );
@@ -404,15 +404,6 @@ class CORE_EXPORT QgsApplication : public QApplication
//! Returns the path to user's style.
static QString userStylePath();

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)

/**
* Returns the short name regular expression for line edit validator
* \deprecated since QGIS 3.22
*/
static QRegExp shortNameRegExp() SIP_DEPRECATED;
#endif

/**
* Returns the short name regular expression for line edit validator
* \since QGIS 3.22
@@ -16,14 +16,14 @@
#include "qgsapplication.h"
#include "qgsgroupwmsdatadialog.h"

#include <QRegExpValidator>
#include <QRegularExpressionValidator>

QgsGroupWmsDataDialog::QgsGroupWmsDataDialog( QWidget *parent, Qt::WindowFlags fl )
: QDialog( parent, fl )
{
setupUi( this );
// WMS Name validator
QValidator *shortNameValidator = new QRegExpValidator( QgsApplication::shortNameRegExp(), this );
QValidator *shortNameValidator = new QRegularExpressionValidator( QgsApplication::shortNameRegularExpression(), this );
mShortNameLineEdit->setValidator( shortNameValidator );
}

@@ -87,6 +87,7 @@
#include <QUrl>
#include <QMenu>
#include <QScreen>
#include <QRegularExpressionValidator>

QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanvas *canvas, QWidget *parent, Qt::WindowFlags fl )
: QgsOptionsDialogBase( QStringLiteral( "RasterLayerProperties" ), parent, fl )
@@ -869,7 +870,7 @@ void QgsRasterLayerProperties::sync()
// WMS Name as layer short name
mLayerShortNameLineEdit->setText( mRasterLayer->shortName() );
// WMS Name validator
QValidator *shortNameValidator = new QRegExpValidator( QgsApplication::shortNameRegExp(), this );
QValidator *shortNameValidator = new QRegularExpressionValidator( QgsApplication::shortNameRegularExpression(), this );
mLayerShortNameLineEdit->setValidator( shortNameValidator );

//layer title and abstract
@@ -87,6 +87,7 @@
#include <QColorDialog>
#include <QMenu>
#include <QUrl>
#include <QRegularExpressionValidator>

#include "qgsrendererpropertiesdialog.h"
#include "qgsstyle.h"
@@ -323,7 +324,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
// WMS Name as layer short name
mLayerShortNameLineEdit->setText( mLayer->shortName() );
// WMS Name validator
QValidator *shortNameValidator = new QRegExpValidator( QgsApplication::shortNameRegExp(), this );
QValidator *shortNameValidator = new QRegularExpressionValidator( QgsApplication::shortNameRegularExpression(), this );
mLayerShortNameLineEdit->setValidator( shortNameValidator );

//layer title and abstract

0 comments on commit a580968

Please sign in to comment.