Skip to content

Commit

Permalink
Added python tests for settings entries classes
Browse files Browse the repository at this point in the history
  • Loading branch information
domi4484 committed Apr 4, 2021
1 parent 1e45ad6 commit 7679239
Show file tree
Hide file tree
Showing 5 changed files with 523 additions and 87 deletions.
98 changes: 56 additions & 42 deletions python/core/auto_generated/settings/qgssettingsentry.sip.in
Expand Up @@ -53,15 +53,17 @@ to validate set values and provide more accurate settings description for the gu
Flag
};

QgsSettingsEntryBase( QString key,
QgsSettings::Section section,
QVariant defaultValue = QVariant(),
QString description = QString() );

QgsSettingsEntryBase( const QString &key,
const QString &pluginName,
const QVariant &defaultValue = QVariant(),
const QString &description = QString() );
%Docstring
Constructor for :py:class:`QgsSettingsEntry`.
This constructor is intended to be used from plugins.

The ``key`` argument specifies the key of the settings.
The ``section`` argument specifies the section of the settings.
The ``pluginName`` argument is inserted in the key after the section.
The ``default`` value argument specifies the default value for the settings entry.
The ``description`` argument specifies a description for the settings entry.
%End
Expand Down Expand Up @@ -144,20 +146,22 @@ A variant settings entry.
%End
public:


QgsSettingsEntryVariant( const QString &key,
QgsSettings::Section section,
const QString &pluginName,
const QVariant &defaultValue = QVariant(),
const QString &description = QString() );
%Docstring
Constructor for QgsSettingsEntryVariant.
This constructor is intended to be used from plugins.

The ``key`` argument specifies the final part of the settings key.
The ``parentGroup`` argument specifies a parent group which is used to rebuild
the entiere settings key and to determine the settings section.
The ``key`` argument specifies the key of the settings.
The ``pluginName`` argument is inserted in the key after the section.
The ``default`` value argument specifies the default value for the settings entry.
The ``description`` argument specifies a description for the settings entry.
%End


virtual bool setValue( const QVariant &value, const QString &dynamicKeyPart = QString() ) const;

%Docstring
Expand Down Expand Up @@ -196,23 +200,19 @@ A string settings entry.
%End
public:


QgsSettingsEntryString( const QString &key,
QgsSettings::Section section,
const QString &defaultValue = QString(),
const QString &description = QString(),
int minLength = 0,
int maxLength = -1 );
const QString &pluginName,
const QVariant &defaultValue = QVariant(),
const QString &description = QString() );
%Docstring
Constructor for QgsSettingsEntryString.
This constructor is intended to be used from plugins.

The ``key`` argument specifies the final part of the settings key.
The ``parentGroup`` argument specifies a parent group which is used to rebuild
the entiere settings key and to determine the settings section.
The ``key`` argument specifies the key of the settings.
The ``pluginName`` argument is inserted in the key after the section.
The ``default`` value argument specifies the default value for the settings entry.
The ``description`` argument specifies a description for the settings entry.
The ``minLength`` argument specifies the minimal length of the string value.
The ``maxLength`` argument specifies the maximal length of the string value.
By -1 the there is no limit
%End

virtual bool setValue( const QVariant &value, const QString &dynamicKeyPart = QString() ) const;
Expand All @@ -236,11 +236,25 @@ Get settings default value.
virtual SettingsType settingsType() const;
%Docstring
\copydoc :py:class:`QgsSettingsEntry`.settingsType
%End

void setMinLength( int minLength );
%Docstring
Set the string minimum length.

minLength The string minimum length.
%End

int minLength();
%Docstring
Returns the string minimum length.
%End

void setMaxLength( int maxLength );
%Docstring
Set the string maximum length.

maxLength The string maximum length.
%End

int maxLength();
Expand All @@ -264,16 +278,17 @@ A string list settings entry.
%End
public:


QgsSettingsEntryStringList( const QString &key,
QgsSettings::Section section,
const QStringList &defaultValue = QStringList(),
const QString &pluginName,
const QVariant &defaultValue = QVariant(),
const QString &description = QString() );
%Docstring
Constructor for QgsSettingsEntryStringList.
This constructor is intended to be used from plugins.

The ``key`` argument specifies the final part of the settings key.
The ``parentGroup`` argument specifies a parent group which is used to rebuild
the entiere settings key and to determine the settings section.
The ``key`` argument specifies the key of the settings.
The ``pluginName`` argument is inserted in the key after the section.
The ``default`` value argument specifies the default value for the settings entry.
The ``description`` argument specifies a description for the settings entry.
%End
Expand Down Expand Up @@ -317,16 +332,17 @@ A boolean settings entry.
%End
public:


QgsSettingsEntryBool( const QString &key,
QgsSettings::Section section,
bool defaultValue = false,
const QString &pluginName,
const QVariant &defaultValue = QVariant(),
const QString &description = QString() );
%Docstring
Constructor for QgsSettingsEntryBool.
This constructor is intended to be used from plugins.

The ``key`` argument specifies the final part of the settings key.
The ``parentGroup`` argument specifies a parent group which is used to rebuild
the entiere settings key and to determine the settings section.
The ``key`` argument specifies the key of the settings.
The ``pluginName`` argument is inserted in the key after the section.
The ``default`` value argument specifies the default value for the settings entry.
The ``description`` argument specifies a description for the settings entry.
%End
Expand All @@ -353,7 +369,6 @@ Get settings default value.
%Docstring
\copydoc :py:class:`QgsSettingsEntry`.settingsType
%End

};


Expand All @@ -373,15 +388,15 @@ An integer settings entry.


QgsSettingsEntryInteger( const QString &key,
QgsSettings::Section section,
qlonglong defaultValue = 0,
const QString &pluginName,
const QVariant &defaultValue = QVariant(),
const QString &description = QString() );
%Docstring
Constructor for QgsSettingsEntryInteger.
This constructor is intended to be used from plugins.

The ``key`` argument specifies the final part of the settings key.
The ``parentGroup`` argument specifies a parent group which is used to rebuild
the entiere settings key and to determine the settings section.
The ``key`` argument specifies the key of the settings.
The ``pluginName`` argument is inserted in the key after the section.
The ``default`` value argument specifies the default value for the settings entry.
The ``description`` argument specifies a description for the settings entry.
%End
Expand Down Expand Up @@ -452,20 +467,19 @@ A double settings entry.


QgsSettingsEntryDouble( const QString &key,
QgsSettings::Section section,
double defaultValue = 0.0,
const QString &pluginName,
const QVariant &defaultValue = QVariant(),
const QString &description = QString() );
%Docstring
Constructor for QgsSettingsEntryDouble.
This constructor is intended to be used from plugins.

The ``key`` argument specifies the final part of the settings key.
The ``parentGroup`` argument specifies a parent group which is used to rebuild
the entiere settings key and to determine the settings section.
The ``key`` argument specifies the key of the settings.
The ``pluginName`` argument is inserted in the key after the section.
The ``default`` value argument specifies the default value for the settings entry.
The ``description`` argument specifies a description for the settings entry.
%End


virtual bool setValue( const QVariant &value, const QString &dynamicKeyPart = QString() ) const;

%Docstring
Expand Down

0 comments on commit 7679239

Please sign in to comment.