File: qgssettings.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 154
file content (332 lines) | stat: -rw-r--r-- 11,478 bytes parent folder | download | duplicates (6)
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
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/settings/qgssettings.h                                      *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/






class QgsSettings : QObject
{
%Docstring(signature="appended")
This class is a composition of two QSettings instances:

- the main QSettings instance is the standard User Settings and
- the second one (Global Settings) is meant to provide read-only
  pre-configuration and defaults to the first one.

For a given settings key, the function call to value(key, default) will
return the first existing setting in the order specified below:

- User Settings
- Global Settings
- Default Value

The path to the Global Settings storage can be set before constructing
the :py:class:`QgsSettings` objects, with a static call to: static bool
setGlobalSettingsPath( QString path );

:py:class:`QgsSettings` provides some shortcuts to get/set namespaced
settings from/to a specific section:

- Core
- Gui
- Server
- Plugins
- Auth
- App
- Providers
- Misc
%End

%TypeHeaderCode
#include "qgssettings.h"
%End
  public:

    enum Section /BaseType=IntEnum/
    {
      NoSection,
      Core,
      Gui,
      Server,
      Plugins,
      Auth,
      App,
      Providers,
      Expressions,
      Misc,
      Gps,
    };

    explicit QgsSettings( const QString &organization,
                          const QString &application = QString(), QObject *parent = 0 );
%Docstring
Constructs a QgsSettings object for accessing settings of the
application called application from the organization called
organization, and with parent parent.
%End

    QgsSettings( QSettings::Scope scope, const QString &organization,
                 const QString &application = QString(), QObject *parent = 0 );
%Docstring
Constructs a QgsSettings object for accessing settings of the
application called application from the organization called
organization, and with parent parent.

If scope is QSettings.UserScope, the QSettings object searches
user-specific settings first, before it searches system-wide settings as
a fallback. If scope is QSettings.SystemScope, the QSettings object
ignores user-specific settings and provides access to system-wide
settings.

The storage format is set to QSettings.NativeFormat (i.e. calling
:py:func:`~QgsSettings.setDefaultFormat` before calling this constructor
has no effect).

If no application name is given, the QSettings object will only access
the organization-wide locations.
%End

    QgsSettings( QSettings::Format format, QSettings::Scope scope, const QString &organization,
                 const QString &application = QString(), QObject *parent = 0 );
%Docstring
Constructs a QgsSettings object for accessing settings of the
application called application from the organization called
organization, and with parent parent.

If scope is QSettings.UserScope, the QSettings object searches
user-specific settings first, before it searches system-wide settings as
a fallback. If scope is QSettings.SystemScope, the QSettings object
ignores user-specific settings and provides access to system-wide
settings.

If format is QSettings.NativeFormat, the native API is used for storing
settings. If format is QSettings.IniFormat, the INI format is used.

If no application name is given, the QSettings object will only access
the organization-wide locations.
%End

    QgsSettings( const QString &fileName, QSettings::Format format, QObject *parent = 0 );
%Docstring
Constructs a QgsSettings object for accessing the settings stored in the
file called fileName, with parent parent. If the file doesn't already
exist, it is created.

If format is QSettings.NativeFormat, the meaning of fileName depends on
the platform. On Unix, fileName is the name of an INI file. On macOS and
iOS, fileName is the name of a .plist file. On Windows, fileName is a
path in the system registry.

If format is QSettings.IniFormat, fileName is the name of an INI file.

.. warning::

   This function is provided for convenience. It works well for accessing INI or .plist
   files generated by Qt, but might fail on some syntaxes found in such files originated by
   other programs. In particular, be aware of the following limitations:

- QgsSettings provides no way of reading INI "path" entries, i.e.,
  entries with unescaped slash characters. (This is because these
  entries are ambiguous and cannot be resolved automatically.)
- In INI files, QSettings uses the @ character as a metacharacter in
  some contexts, to encode Qt-specific data types (e.g., \@Rect), and
  might therefore misinterpret it when it occurs in pure INI files.
%End

    explicit QgsSettings( QObject *parent = 0 );
%Docstring
Constructs a QgsSettings object for accessing settings of the
application and organization set previously with a call to
QCoreApplication.setOrganizationName(),
QCoreApplication.setOrganizationDomain(), and
QCoreApplication.setApplicationName().

The scope is QSettings.UserScope and the format is
:py:func:`~QgsSettings.defaultFormat` (QSettings.NativeFormat by
default). Use :py:func:`~QgsSettings.setDefaultFormat` before calling
this constructor to change the default format used by this constructor.
%End
    ~QgsSettings();

    void beginGroup( const QString &prefix, QgsSettings::Section section = QgsSettings::NoSection );
%Docstring
Appends prefix to the current group. The current group is automatically
prepended to all keys specified to QSettings. In addition, query
functions such as :py:func:`~QgsSettings.childGroups`,
:py:func:`~QgsSettings.childKeys`, and :py:func:`~QgsSettings.allKeys`
are based on the group. By default, no group is set.
%End
    void endGroup();
%Docstring
Resets the group to what it was before the corresponding
:py:func:`~QgsSettings.beginGroup` call.
%End

    QString group() const;
%Docstring
Returns the current group.

.. seealso:: :py:func:`beginGroup`

.. seealso:: :py:func:`endGroup`

.. versionadded:: 3.6
%End

    QStringList allKeys() const;
%Docstring
Returns a list of all keys, including subkeys, that can be read using
the QSettings object.
%End
    QStringList childKeys() const;
%Docstring
Returns a list of all top-level keys that can be read using the
QSettings object.
%End
    QStringList childGroups( Qgis::SettingsOrigin origin = Qgis::SettingsOrigin::Any ) const;
%Docstring
Returns a list of all key top-level groups that contain keys that can be
read using the QSettings object.
%End
    QStringList globalChildGroups() const;
%Docstring
Returns a list of all key top-level groups (same as childGroups) but
only for groups defined in global settings.
%End
    static QString globalSettingsPath();
%Docstring
Returns the path to the Global Settings QSettings storage file
%End
    static bool setGlobalSettingsPath( const QString &path );
%Docstring
Sets the Global Settings QSettings storage file
%End
    int beginReadArray( const QString &prefix );
%Docstring
Adds prefix to the current group and starts reading from an array.
Returns the size of the array.
%End

    void beginWriteArray( const QString &prefix, int size = -1 );
%Docstring
Adds prefix to the current group and starts writing an array of size
size. If size is -1 (the default), it is automatically determined based
on the indexes of the entries written.

.. note::

   This will completely shadow any existing array with the same name in the global settings
%End
    void endArray();
%Docstring
Closes the array that was started using
:py:func:`~QgsSettings.beginReadArray` or
:py:func:`~QgsSettings.beginWriteArray`.
%End

    void setArrayIndex( int i );
%Docstring
Sets the current array index to i. Calls to functions such as
:py:func:`~QgsSettings.setValue`, :py:func:`~QgsSettings.value`,
:py:func:`~QgsSettings.remove`, and :py:func:`~QgsSettings.contains`
will operate on the array entry at that index.
%End

    Qgis::SettingsOrigin origin( const QString &key ) const;
%Docstring
Returns the origin of the setting if it exists at the given ``key``

.. note::

   it will return :py:class:`Qgis`.SettingsOrigin.Any if the key doesn't exist

.. versionadded:: 3.30
%End

    void setValue( const QString &key, const QVariant &value, QgsSettings::Section section = QgsSettings::NoSection );
%Docstring
Sets the value of setting key to value. If the key already exists, the
previous value is overwritten. An optional Section argument can be used
to set a value to a specific Section.
%End

    SIP_PYOBJECT value( const QString &key, const QVariant &defaultValue = QVariant(),
                        SIP_PYOBJECT type = 0,
                        QgsSettings::Section section = QgsSettings::NoSection ) const / ReleaseGIL /;
%Docstring
Returns the value for setting key. If the setting doesn't exist, it will
be searched in the Global Settings and if not found, returns
defaultValue. If no default value is specified, a default QVariant is
returned. An optional Section argument can be used to get a value from a
specific Section.
%End
%MethodCode
    typedef PyObject *( *pyqt_from_qvariant_by_type )( QVariant &value, PyObject *type );
    QVariant value;

    // QSettings has an internal mutex so release the GIL to avoid the possibility of deadlocks.
    Py_BEGIN_ALLOW_THREADS
    value = sipCpp->value( *a0, *a1, a3 );
    Py_END_ALLOW_THREADS

    pyqt_from_qvariant_by_type f = ( pyqt_from_qvariant_by_type ) sipImportSymbol( SIP_PYQT_FROM_QVARIANT_BY_TYPE );
    sipRes = f( value, a2 );

    sipIsErr = !sipRes;
%End



    bool contains( const QString &key, QgsSettings::Section section = QgsSettings::NoSection ) const;
%Docstring
Returns ``True`` if there exists a setting called key; returns ``False``
otherwise. If a group is set using :py:func:`~QgsSettings.beginGroup`,
key is taken to be relative to that group.
%End
    QString fileName() const;
%Docstring
Returns the path where settings written using this QSettings object are
stored.
%End

    void sync();
%Docstring
Writes any unsaved changes to permanent storage, and reloads any
settings that have been changed in the meantime by another application.
This function is called automatically from QSettings's destructor and by
the event loop at regular intervals, so you normally don't need to call
it yourself.
%End
    void remove( const QString &key, QgsSettings::Section section = QgsSettings::NoSection );
%Docstring
Removes the setting key and any sub-settings of key in a section.
%End
    QString prefixedKey( const QString &key, QgsSettings::Section section ) const;
%Docstring
Returns the sanitized and prefixed key
%End
    void clear();
%Docstring
Removes all entries in the user settings
%End




};


/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/settings/qgssettings.h                                      *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/