qboxlayout.sip 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. // qboxlayout.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 QBoxLayout : public QLayout
  22. {
  23. %TypeHeaderCode
  24. #include <qboxlayout.h>
  25. %End
  26. public:
  27. enum Direction
  28. {
  29. LeftToRight,
  30. RightToLeft,
  31. TopToBottom,
  32. BottomToTop,
  33. Down,
  34. Up,
  35. };
  36. QBoxLayout(QBoxLayout::Direction direction, QWidget *parent /TransferThis/ = 0);
  37. virtual ~QBoxLayout();
  38. QBoxLayout::Direction direction() const;
  39. void setDirection(QBoxLayout::Direction);
  40. void addSpacing(int size);
  41. void addStretch(int stretch = 0);
  42. void addWidget(QWidget * /GetWrapper/, int stretch = 0, Qt::Alignment alignment = Qt::Alignment());
  43. %MethodCode
  44. Py_BEGIN_ALLOW_THREADS
  45. sipCpp->addWidget(a0, a1, *a2);
  46. Py_END_ALLOW_THREADS
  47. // The layout's parent widget (if there is one) will now have ownership.
  48. QWidget *parent = sipCpp->parentWidget();
  49. if (parent)
  50. {
  51. PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget);
  52. if (py_parent)
  53. sipTransferTo(a0Wrapper, py_parent);
  54. }
  55. else
  56. {
  57. // For now give the Python ownership to the layout. This maintains
  58. // compatibility with previous versions and allows addWidget(QWidget()).
  59. sipTransferTo(a0Wrapper, sipSelf);
  60. }
  61. %End
  62. void addLayout(QLayout *layout /Transfer/, int stretch = 0);
  63. void addStrut(int);
  64. virtual void addItem(QLayoutItem * /Transfer/);
  65. void insertSpacing(int index, int size);
  66. void insertStretch(int index, int stretch = 0);
  67. void insertWidget(int index, QWidget *widget /GetWrapper/, int stretch = 0, Qt::Alignment alignment = Qt::Alignment());
  68. %MethodCode
  69. Py_BEGIN_ALLOW_THREADS
  70. sipCpp->insertWidget(a0, a1, a2, *a3);
  71. Py_END_ALLOW_THREADS
  72. // The layout's parent widget (if there is one) will now have ownership.
  73. QWidget *parent = sipCpp->parentWidget();
  74. if (parent)
  75. {
  76. PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget);
  77. if (py_parent)
  78. sipTransferTo(a1Wrapper, py_parent);
  79. }
  80. else
  81. {
  82. // For now give the Python ownership to the layout. This maintains
  83. // compatibility with previous versions and allows insertWidget(QWidget()).
  84. sipTransferTo(a1Wrapper, sipSelf);
  85. }
  86. %End
  87. void insertLayout(int index, QLayout *layout /Transfer/, int stretch = 0);
  88. bool setStretchFactor(QWidget *w, int stretch);
  89. bool setStretchFactor(QLayout *l, int stretch);
  90. virtual QSize sizeHint() const;
  91. virtual QSize minimumSize() const;
  92. virtual QSize maximumSize() const;
  93. virtual bool hasHeightForWidth() const;
  94. virtual int heightForWidth(int) const;
  95. virtual int minimumHeightForWidth(int) const;
  96. virtual Qt::Orientations expandingDirections() const;
  97. virtual void invalidate();
  98. virtual QLayoutItem *itemAt(int) const;
  99. virtual QLayoutItem *takeAt(int) /TransferBack/;
  100. virtual int count() const;
  101. virtual void setGeometry(const QRect &);
  102. virtual int spacing() const;
  103. virtual void setSpacing(int spacing);
  104. void addSpacerItem(QSpacerItem *spacerItem /Transfer/);
  105. void insertSpacerItem(int index, QSpacerItem *spacerItem /Transfer/);
  106. void setStretch(int index, int stretch);
  107. int stretch(int index) const;
  108. void insertItem(int index, QLayoutItem * /Transfer/);
  109. };
  110. class QHBoxLayout : public QBoxLayout
  111. {
  112. %TypeHeaderCode
  113. #include <qboxlayout.h>
  114. %End
  115. public:
  116. QHBoxLayout();
  117. explicit QHBoxLayout(QWidget *parent /TransferThis/);
  118. virtual ~QHBoxLayout();
  119. };
  120. class QVBoxLayout : public QBoxLayout
  121. {
  122. %TypeHeaderCode
  123. #include <qboxlayout.h>
  124. %End
  125. public:
  126. QVBoxLayout();
  127. explicit QVBoxLayout(QWidget *parent /TransferThis/);
  128. virtual ~QVBoxLayout();
  129. };