qsettings.sip 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. // qsettings.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtCore Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. class QSettings : public QObject
  22. {
  23. %TypeHeaderCode
  24. #include <qsettings.h>
  25. %End
  26. public:
  27. enum Status
  28. {
  29. NoError,
  30. AccessError,
  31. FormatError,
  32. };
  33. enum Format
  34. {
  35. NativeFormat,
  36. IniFormat,
  37. InvalidFormat,
  38. };
  39. enum Scope
  40. {
  41. UserScope,
  42. SystemScope,
  43. };
  44. QSettings(const QString &organization, const QString &application = QString(), QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
  45. QSettings(QSettings::Scope scope, const QString &organization, const QString &application = QString(), QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
  46. QSettings(QSettings::Format format, QSettings::Scope scope, const QString &organization, const QString &application = QString(), QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
  47. QSettings(const QString &fileName, QSettings::Format format, QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
  48. QSettings(QSettings::Scope scope, QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
  49. explicit QSettings(QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
  50. virtual ~QSettings() /ReleaseGIL/;
  51. void clear() /ReleaseGIL/;
  52. void sync() /ReleaseGIL/;
  53. QSettings::Status status() const;
  54. %If (Qt_6_4_0 -)
  55. void beginGroup(QAnyStringView prefix);
  56. %End
  57. %If (- Qt_6_4_0)
  58. void beginGroup(const QString &prefix);
  59. %End
  60. void endGroup();
  61. QString group() const;
  62. %If (Qt_6_4_0 -)
  63. int beginReadArray(QAnyStringView prefix);
  64. %End
  65. %If (- Qt_6_4_0)
  66. int beginReadArray(const QString &prefix);
  67. %End
  68. %If (Qt_6_4_0 -)
  69. void beginWriteArray(QAnyStringView prefix, int size = -1);
  70. %End
  71. %If (- Qt_6_4_0)
  72. void beginWriteArray(const QString &prefix, int size = -1);
  73. %End
  74. void endArray();
  75. void setArrayIndex(int i);
  76. QStringList allKeys() const /ReleaseGIL/;
  77. QStringList childKeys() const /ReleaseGIL/;
  78. QStringList childGroups() const /ReleaseGIL/;
  79. bool isWritable() const;
  80. %If (Qt_6_4_0 -)
  81. void setValue(QAnyStringView key, const QVariant &value) /ReleaseGIL/;
  82. %End
  83. %If (- Qt_6_4_0)
  84. void setValue(const QString &key, const QVariant &value) /ReleaseGIL/;
  85. %End
  86. %If (Qt_6_4_0 -)
  87. SIP_PYOBJECT value(const QAnyStringView &key, const QVariant &defaultValue = QVariant(), SIP_PYOBJECT type /TypeHint="type", TypeHintValue="None"/ = 0) const /ReleaseGIL/;
  88. %MethodCode
  89. QVariant value;
  90. // QSettings has an internal mutex so release the GIL to avoid the possibility
  91. // of deadlocks.
  92. Py_BEGIN_ALLOW_THREADS
  93. value = sipCpp->value(*a0, *a1);
  94. Py_END_ALLOW_THREADS
  95. sipRes = pyqt6_from_qvariant_by_type(value, a2);
  96. sipIsErr = !sipRes;
  97. %End
  98. %End
  99. %If (- Qt_6_4_0)
  100. SIP_PYOBJECT value(const QString &key, const QVariant &defaultValue = QVariant(), SIP_PYOBJECT type /TypeHint="type", TypeHintValue="None"/ = 0) const /ReleaseGIL/;
  101. %MethodCode
  102. QVariant value;
  103. // QSettings has an internal mutex so release the GIL to avoid the possibility
  104. // of deadlocks.
  105. Py_BEGIN_ALLOW_THREADS
  106. value = sipCpp->value(*a0, *a1);
  107. Py_END_ALLOW_THREADS
  108. sipRes = pyqt6_from_qvariant_by_type(value, a2);
  109. sipIsErr = !sipRes;
  110. %End
  111. %End
  112. %If (Qt_6_4_0 -)
  113. void remove(QAnyStringView key) /ReleaseGIL/;
  114. %End
  115. %If (- Qt_6_4_0)
  116. void remove(const QString &key) /ReleaseGIL/;
  117. %End
  118. %If (Qt_6_4_0 -)
  119. bool contains(QAnyStringView key) const /ReleaseGIL/;
  120. %End
  121. %If (- Qt_6_4_0)
  122. bool contains(const QString &key) const /ReleaseGIL/;
  123. %End
  124. void setFallbacksEnabled(bool b);
  125. bool fallbacksEnabled() const;
  126. QString fileName() const;
  127. static void setPath(QSettings::Format format, QSettings::Scope scope, const QString &path) /ReleaseGIL/;
  128. QSettings::Format format() const;
  129. QSettings::Scope scope() const;
  130. QString organizationName() const;
  131. QString applicationName() const;
  132. static void setDefaultFormat(QSettings::Format format);
  133. static QSettings::Format defaultFormat();
  134. bool isAtomicSyncRequired() const;
  135. void setAtomicSyncRequired(bool enable);
  136. protected:
  137. virtual bool event(QEvent *event);
  138. };