qlayout.sip 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. // qlayout.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtWidgets 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 QLayout : public QObject, public QLayoutItem
  22. {
  23. %TypeHeaderCode
  24. #include <qlayout.h>
  25. %End
  26. public:
  27. enum SizeConstraint
  28. {
  29. SetDefaultConstraint,
  30. SetNoConstraint,
  31. SetMinimumSize,
  32. SetFixedSize,
  33. SetMaximumSize,
  34. SetMinAndMaxSize,
  35. };
  36. explicit QLayout(QWidget *parent /TransferThis/ = 0);
  37. virtual ~QLayout();
  38. virtual int spacing() const;
  39. virtual void setSpacing(int);
  40. bool setAlignment(QWidget *w, Qt::Alignment alignment);
  41. bool setAlignment(QLayout *l, Qt::Alignment alignment);
  42. void setAlignment(Qt::Alignment);
  43. void setSizeConstraint(QLayout::SizeConstraint);
  44. QLayout::SizeConstraint sizeConstraint() const;
  45. void setMenuBar(QWidget *w /GetWrapper/);
  46. %MethodCode
  47. Py_BEGIN_ALLOW_THREADS
  48. sipCpp->setMenuBar(a0);
  49. Py_END_ALLOW_THREADS
  50. // The layout's parent widget (if there is one) will now have ownership.
  51. QWidget *parent = sipCpp->parentWidget();
  52. if (a0 && parent)
  53. {
  54. PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget);
  55. if (py_parent)
  56. sipTransferTo(a0Wrapper, py_parent);
  57. }
  58. else
  59. {
  60. // For now give the Python ownership to the layout. This maintains
  61. // compatibility with previous versions and allows setMenuBar(QWidget()).
  62. sipTransferTo(a0Wrapper, sipSelf);
  63. }
  64. %End
  65. QWidget *menuBar() const;
  66. QWidget *parentWidget() const;
  67. virtual void invalidate();
  68. virtual QRect geometry() const;
  69. bool activate();
  70. void update();
  71. void addWidget(QWidget *w /GetWrapper/);
  72. %MethodCode
  73. Py_BEGIN_ALLOW_THREADS
  74. sipCpp->addWidget(a0);
  75. Py_END_ALLOW_THREADS
  76. // The layout's parent widget (if there is one) will now have ownership.
  77. QWidget *parent = sipCpp->parentWidget();
  78. if (parent)
  79. {
  80. PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget);
  81. if (py_parent)
  82. sipTransferTo(a0Wrapper, py_parent);
  83. }
  84. else
  85. {
  86. // For now give the Python ownership to the layout. This maintains
  87. // compatibility with previous versions and allows addWidget(QWidget()).
  88. sipTransferTo(a0Wrapper, sipSelf);
  89. }
  90. %End
  91. virtual void addItem(QLayoutItem * /Transfer/) = 0;
  92. void removeWidget(QWidget *w /TransferBack/);
  93. void removeItem(QLayoutItem * /TransferBack/);
  94. virtual Qt::Orientations expandingDirections() const;
  95. virtual QSize minimumSize() const;
  96. virtual QSize maximumSize() const;
  97. virtual void setGeometry(const QRect &);
  98. virtual QLayoutItem *itemAt(int index) const = 0;
  99. virtual QLayoutItem *takeAt(int index) = 0 /TransferBack/;
  100. virtual int indexOf(const QWidget *) const;
  101. virtual int indexOf(const QLayoutItem *) const;
  102. virtual int count() const = 0 /__len__/;
  103. virtual bool isEmpty() const;
  104. int totalHeightForWidth(int w) const;
  105. QSize totalMinimumSize() const;
  106. QSize totalMaximumSize() const;
  107. QSize totalSizeHint() const;
  108. virtual QLayout *layout();
  109. void setEnabled(bool);
  110. bool isEnabled() const;
  111. static QSize closestAcceptableSize(const QWidget *w, const QSize &s);
  112. protected:
  113. void widgetEvent(QEvent *);
  114. virtual void childEvent(QChildEvent *e);
  115. void addChildLayout(QLayout *l /Transfer/);
  116. void addChildWidget(QWidget *w /GetWrapper/);
  117. %MethodCode
  118. Py_BEGIN_ALLOW_THREADS
  119. #if defined(SIP_PROTECTED_IS_PUBLIC)
  120. sipCpp->addChildWidget(a0);
  121. #else
  122. sipCpp->sipProtect_addChildWidget(a0);
  123. #endif
  124. Py_END_ALLOW_THREADS
  125. // The layout's parent widget (if there is one) will now have ownership.
  126. QWidget *parent = sipCpp->parentWidget();
  127. if (parent)
  128. {
  129. PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget);
  130. if (py_parent)
  131. sipTransferTo(a0Wrapper, py_parent);
  132. }
  133. else
  134. {
  135. // For now give the Python ownership to the layout. This maintains
  136. // compatibility with previous versions and allows
  137. // addChildWidget(QWidget()).
  138. sipTransferTo(a0Wrapper, sipSelf);
  139. }
  140. %End
  141. QRect alignmentRect(const QRect &) const;
  142. public:
  143. void setContentsMargins(int left, int top, int right, int bottom);
  144. void getContentsMargins(int *left, int *top, int *right, int *bottom) const;
  145. QRect contentsRect() const;
  146. void setContentsMargins(const QMargins &margins);
  147. QMargins contentsMargins() const;
  148. virtual QSizePolicy::ControlTypes controlTypes() const;
  149. virtual QLayoutItem *replaceWidget(QWidget *from, QWidget *to /Transfer/, Qt::FindChildOptions options = Qt::FindChildrenRecursively);
  150. %If (Qt_6_1_0 -)
  151. void unsetContentsMargins();
  152. %End
  153. %If (Qt_6_10_0 -)
  154. void setSizeConstraints(QLayout::SizeConstraint horizontal, QLayout::SizeConstraint vertical);
  155. %End
  156. %If (Qt_6_10_0 -)
  157. void setHorizontalSizeConstraint(QLayout::SizeConstraint constraint);
  158. %End
  159. %If (Qt_6_10_0 -)
  160. QLayout::SizeConstraint horizontalSizeConstraint() const;
  161. %End
  162. %If (Qt_6_10_0 -)
  163. void setVerticalSizeConstraint(QLayout::SizeConstraint constraint);
  164. %End
  165. %If (Qt_6_10_0 -)
  166. QLayout::SizeConstraint verticalSizeConstraint() const;
  167. %End
  168. };