1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/settings/qgssettingsentry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsSettingsEntryBase
{
%Docstring(signature="appended")
Represent settings entry and provides methods for reading and writing
settings values. Different subclasses are provided for different
settings types with metainformations to validate set values and provide
more accurate settings description for the gui.
.. versionadded:: 3.20
%End
%TypeHeaderCode
#include "qgssettingsentry.h"
%End
%ConvertToSubClassCode
if ( dynamic_cast< QgsSettingsEntryVariant * >( sipCpp ) )
sipType = sipType_QgsSettingsEntryVariant;
else if ( dynamic_cast< QgsSettingsEntryString * >( sipCpp ) )
sipType = sipType_QgsSettingsEntryString;
else if ( dynamic_cast< QgsSettingsEntryStringList * >( sipCpp ) )
sipType = sipType_QgsSettingsEntryStringList;
else if ( dynamic_cast< QgsSettingsEntryVariantMap * >( sipCpp ) )
sipType = sipType_QgsSettingsEntryVariantMap;
else if ( dynamic_cast< QgsSettingsEntryBool * >( sipCpp ) )
sipType = sipType_QgsSettingsEntryBool;
else if ( dynamic_cast< QgsSettingsEntryInteger * >( sipCpp ) )
sipType = sipType_QgsSettingsEntryInteger;
else if ( dynamic_cast< QgsSettingsEntryDouble * >( sipCpp ) )
sipType = sipType_QgsSettingsEntryDouble;
else if ( dynamic_cast< QgsSettingsEntryColor * >( sipCpp ) )
sipType = sipType_QgsSettingsEntryColor;
else if ( dynamic_cast< QgsSettingsEntryBase * >( sipCpp ) )
sipType = sipType_QgsSettingsEntryBase;
else
sipType = NULL;
%End
public:
static QStringList dynamicKeyPartToList( const QString &dynamicKeyPart );
%Docstring
Transforms a dynamic key part string to list
.. versionadded:: 3.26
%End
QgsSettingsEntryBase( const QString &key,
const QString §ion,
const QVariant &defaultValue = QVariant(),
const QString &description = QString(),
Qgis::SettingsOptions options = Qgis::SettingsOptions() );
%Docstring
Constructor for QgsSettingsEntryBase.
:param key: specifies the key of the settings.
:param section: specifies the section.
:param defaultValue: specifies the default value for the settings entry.
:param description: specifies a description for the settings entry.
:param options: specifies the options for the settings entry.
%End
QgsSettingsEntryBase( const QString &name,
QgsSettingsTreeNode *parent,
const QVariant &defaultValue = QVariant(),
const QString &description = QString(),
Qgis::SettingsOptions options = Qgis::SettingsOptions() ) throw( QgsSettingsException );
%Docstring
Constructor for QgsSettingsEntryBase.
:param name: specifies the name of the setting.
:param parent: specifies the parent in the tree of settings.
:param defaultValue: specifies the default value for the settings entry.
:param description: specifies a description for the settings entry.
:param options: specifies the options for the settings entry.
:raises QgsSettingsException: if the number of given parent named items
doesn't match the complete key definition
.. versionadded:: 3.30
%End
virtual ~QgsSettingsEntryBase();
virtual QString typeId() const;
%Docstring
Returns the id of the type of settings This can be re-implemented in a
custom implementation of a setting
.. versionadded:: 3.32
%End
QString name() const;
%Docstring
Returns the name of the settings
.. versionadded:: 3.30
%End
QString key( const QString &dynamicKeyPart = QString() ) const;
%Docstring
Returns settings entry key.
:param dynamicKeyPart: specifies the dynamic part of the settings key.
%End
QString key( const QStringList &dynamicKeyPartList ) const;
%Docstring
Returns settings entry key.
:param dynamicKeyPartList: specifies the list of dynamic parts of the
settings key.
%End
bool keyIsValid( const QString &key ) const;
%Docstring
Returns ``True`` if the provided key match the settings entry.
This is useful for settings with dynamic keys. For example this permits
one to check that the settings key
"NewsFeed/httpsfeedqgisorg/27/content" is valid for the settings entry
defined with the key "NewsFeed/%1/%2/content"
:param key: to check
%End
QString definitionKey() const;
%Docstring
Returns settings entry defining key. For dynamic settings it return the
key with the placeholder for dynamic part included. For non-dynamic
settings returns the same as :py:func:`~QgsSettingsEntryBase.key`.
%End
bool hasDynamicKey() const;
%Docstring
Returns ``True`` if a part of the settings key is built dynamically.
%End
Qgis::SettingsOptions options() const;
%Docstring
Returns the settings options
.. versionadded:: 3.26
%End
bool exists( const QString &dynamicKeyPart = QString() ) const;
%Docstring
Returns ``True`` if the settings is contained in the underlying
QSettings.
:param dynamicKeyPart: specifies the dynamic part of the settings key.
%End
bool exists( const QStringList &dynamicKeyPartList ) const;
%Docstring
Returns ``True`` if the settings is contained in the underlying
QSettings.
:param dynamicKeyPartList: specifies the list of dynamic parts of the
settings key.
%End
Qgis::SettingsOrigin origin( const QStringList &dynamicKeyPartList ) const;
%Docstring
Returns the origin of the setting if it exists
.. note::
it will return :py:class:`Qgis`.SettingsOrigin.Any if the key doesn't exist
.. versionadded:: 3.30
%End
void remove( const QString &dynamicKeyPart = QString() ) const;
%Docstring
Removes the settings from the underlying QSettings.
:param dynamicKeyPart: specifies the dynamic part of the settings key.
%End
void remove( const QStringList &dynamicKeyPartList ) const;
%Docstring
Removes the settings from the underlying QSettings.
:param dynamicKeyPartList: specifies the list of dynamic parts of the
settings key.
%End
int section() const;
%Docstring
Returns settings section. The settings section of the parent group is
returned if available.
.. deprecated:: 3.26
The key is entirely self-defined.
%End
bool setVariantValue( const QVariant &value, const QString &dynamicKeyPart = QString() ) const;
%Docstring
Set settings value.
:param value: specifies the value to set.
:param dynamicKeyPart: specifies the dynamic part of the settings key.
%End
bool setVariantValue( const QVariant &value, const QStringList &dynamicKeyPartList ) const;
%Docstring
Set settings value. This should be called from any implementation as it
takes care of actually calling QSettings
:param value: specifies the value to set.
:param dynamicKeyPartList: specifies the list of dynamic parts of the
settings key.
%End
QVariant valueAsVariant( const QString &dynamicKeyPart = QString() ) const;
%Docstring
Returns settings value with:param dynamicKeyPart: specifying the dynamic
part of the settings key.
%End
QVariant valueAsVariant( const QStringList &dynamicKeyPartList ) const;
%Docstring
Returns settings value with:param dynamicKeyPartList: specifying the
dynamic part of the settings key.
%End
QVariant valueAsVariantWithDefaultOverride( const QVariant &defaultValueOverride, const QString &dynamicKeyPart = QString() ) const;
%Docstring
Returns settings value with a ``defaultValueOverride``
.. versionadded:: 3.26
%End
QVariant valueAsVariantWithDefaultOverride( const QVariant &defaultValueOverride, const QStringList &dynamicKeyPartList ) const;
%Docstring
Returns settings value.
:param dynamicKeyPartList: specifies the list of dynamic parts of the
settings key.
:param defaultValueOverride: if valid is used instead of the normal
default value.
.. versionadded:: 3.26
%End
QVariant valueAsVariant( const QString &dynamicKeyPart, bool useDefaultValueOverride, const QVariant &defaultValueOverride ) const /Deprecated/;
%Docstring
Returns settings value with an optional default value override
.. deprecated:: 3.26
Use valueAsVariantWithDefaultOverride instead.
%End
QVariant valueAsVariant( const QStringList &dynamicKeyPartList, bool useDefaultValueOverride, const QVariant &defaultValueOverride ) const /Deprecated/;
%Docstring
Returns settings value with an optional default value override
.. deprecated:: 3.26
Use valueAsVariantWithDefaultOverride instead.
%End
QVariant defaultValueAsVariant() const;
%Docstring
Returns settings default value.
%End
virtual Qgis::SettingsType settingsType() const;
%Docstring
Returns the settings entry type.
%End
QString description() const;
%Docstring
Returns the settings entry description.
%End
QVariant formerValueAsVariant( const QString &dynamicKeyPart ) const;
%Docstring
Returns the former value of the settings if it has been enabled in the
options. Returns the current value (or default) if there is no former
value.
.. versionadded:: 3.26
%End
QVariant formerValueAsVariant( const QStringList &dynamicKeyPartList ) const;
%Docstring
Returns the former value of the settings if it has been enabled in the
options Returns the current value (or default) if there is no former
value.
.. versionadded:: 3.26
%End
bool copyValueFromKey( const QString &key, bool removeSettingAtKey = false ) const;
%Docstring
Copies the value from a given key if it exists.
:param key: the key to copy the setting value from.
:param removeSettingAtKey: if ``True``, the setting at the old key will
be removed.
:return: ``True`` if the key exists and the setting value could be
copied.
.. versionadded:: 3.30
%End
bool copyValueFromKey( const QString &key, const QStringList &dynamicKeyPartList, bool removeSettingAtKey = false ) const;
%Docstring
Copies the value from a given key if it exists.
:param key: the key to copy the setting value from.
:param dynamicKeyPartList: is the optional dynamic key part to determine
the key. It must be the same for origin and
destination keys.
:param removeSettingAtKey: if ``True``, the setting at the old key will
be removed.
:return: ``True`` if the key exists and the setting value could be
copied.
.. versionadded:: 3.30
%End
void copyValueToKey( const QString &key, const QStringList &dynamicKeyPartList = QStringList() ) const;
%Docstring
Copies the settings to the given key.
:param key: the key to copy the setting value to.
:param dynamicKeyPartList: is the optional dynamic key part to determine
the key. It must be the same for origin and
destination keys.
.. versionadded:: 3.30
%End
void copyValueToKeyIfChanged( const QString &key, const QStringList &dynamicKeyPartList = QStringList() ) const;
%Docstring
Copies the settings to the given key, if it has changed during the
current QGIS session (see :py:func:`~QgsSettingsEntryBase.hasChanged`).
:param key: the key to copy the setting value to.
:param dynamicKeyPartList: is the optional dynamic key part to determine
the key. It must be the same for origin and
destination keys.
.. versionadded:: 3.36
%End
QgsSettingsTreeNode *parent() const;
%Docstring
Returns the parent tree element
.. versionadded:: 3.30
%End
virtual bool checkValueVariant( const QVariant &value ) const;
%Docstring
Returns ``True`` if the given ``value`` is valid towards the setting
definition
%End
bool hasChanged() const;
%Docstring
Returns ``True`` if the setting was changed during the current QGIS
session.
.. versionadded:: 3.36
%End
};
template<T>
class QgsSettingsEntryBaseTemplate : QgsSettingsEntryBase
{
%Docstring(signature="appended")
Base abstract class for settings entries with typed get and set methods
.. seealso:: :py:class:`QgsSettingsEntryBase`
.. versionadded:: 3.32
%End
%TypeHeaderCode
#include "qgssettingsentry.h"
%End
public:
QgsSettingsEntryBaseTemplate( const QString &name,
QgsSettingsTreeNode *parent,
const QVariant &defaultValue,
const QString &description = QString(),
Qgis::SettingsOptions options = Qgis::SettingsOptions() );
%Docstring
Constructor for :py:class:`QgsSettingsEntryByReference`.
:param name: specifies the key of the settings.
:param parent: specifies the parent in the tree of settings.
:param defaultValue: specifies the default value for the settings entry.
:param description: specifies a description for the settings entry.
:param options: specifies the options for the settings entry.
:raises QgsSettingsException: if the number of given parent named items
doesn't match the complete key definition
.. versionadded:: 3.30
%End
QgsSettingsEntryBaseTemplate( const QString &key,
const QString §ion,
const QVariant &defaultValue,
const QString &description = QString(),
Qgis::SettingsOptions options = Qgis::SettingsOptions() );
%Docstring
Constructor for :py:class:`QgsSettingsEntryByReference`.
:param key: specifies the key of the settings.
:param section: specifies the section.
:param defaultValue: specifies the default value for the settings entry.
:param description: specifies a description for the settings entry.
:param options: specifies the options for the settings entry.
%End
virtual Qgis::SettingsType settingsType() const = 0;
T value( const QString &dynamicKeyPart = QString() ) const;
%Docstring
Returns settings value.
:param dynamicKeyPart: specifies the dynamic part of the settings key.
%End
T value( const QStringList &dynamicKeyPartList ) const;
%Docstring
Returns settings value.
:param dynamicKeyPartList: specifies the list of dynamic parts of the
settings key.
%End
T valueWithDefaultOverride( const T &defaultValueOverride, const QString &dynamicKeyPart = QString() ) const;
%Docstring
Returns the settings value with a ``defaultValueOverride`` and with an
optional ``dynamicKeyPart``
%End
T valueWithDefaultOverride( const T &defaultValueOverride, const QStringList &dynamicKeyPartList ) const;
%Docstring
Returns the settings value with a ``defaultValueOverride`` for the
``dynamicKeyPartList``
%End
bool setValue( const T &value, const QString &dynamicKeyPart = QString() ) const;
%Docstring
Set settings value.
:param value: specifies the value to set.
:param dynamicKeyPart: specifies the dynamic part of the settings key.
%End
bool setValue( const T &value, const QStringList &dynamicKeyPartList ) const;
%Docstring
Set settings value.
:param value: specifies the value to set.
:param dynamicKeyPartList: specifies the list of dynamic parts of the
settings key.
%End
T defaultValue() const;
%Docstring
Returns settings default value.
%End
T formerValue( const QString &dynamicKeyPart = QString() ) const;
%Docstring
Returns the former value. Returns the current value (or default) if
there is no former value.
%End
T formerValue( const QStringList &dynamicKeyPartList ) const;
%Docstring
Returns the former value Returns the current value (or default) if there
is no former value.
%End
virtual bool checkValueVariant( const QVariant &value ) const;
virtual T convertFromVariant( const QVariant &value ) const = 0;
%Docstring
Converts the variant value to the value type of the setting
%End
protected:
virtual bool setValuePrivate( const T &value, const QStringList &dynamicKeyPartList ) const;
%Docstring
Sets the settings value with an optional list of dynamic parts
%End
virtual QVariant convertToVariant( const T &value ) const;
%Docstring
Converts the value to a variant
%End
virtual bool checkValuePrivate( const T &value ) const;
%Docstring
Check if the value is valid
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/settings/qgssettingsentry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|