qstackedlayout.sip 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // qstackedlayout.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 QStackedLayout : public QLayout
  22. {
  23. %TypeHeaderCode
  24. #include <qstackedlayout.h>
  25. %End
  26. public:
  27. enum StackingMode
  28. {
  29. StackOne,
  30. StackAll,
  31. };
  32. QStackedLayout();
  33. explicit QStackedLayout(QWidget *parent /TransferThis/);
  34. explicit QStackedLayout(QLayout *parentLayout /TransferThis/);
  35. virtual ~QStackedLayout();
  36. int addWidget(QWidget *w /GetWrapper/);
  37. %MethodCode
  38. Py_BEGIN_ALLOW_THREADS
  39. sipRes = sipCpp->addWidget(a0);
  40. Py_END_ALLOW_THREADS
  41. // The layout's parent widget (if there is one) will now have ownership.
  42. QWidget *parent = sipCpp->parentWidget();
  43. if (parent)
  44. {
  45. PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget);
  46. if (py_parent)
  47. sipTransferTo(a0Wrapper, py_parent);
  48. }
  49. else
  50. {
  51. // For now give the Python ownership to the layout. This maintains
  52. // compatibility with previous versions and allows addWidget(QWidget()).
  53. sipTransferTo(a0Wrapper, sipSelf);
  54. }
  55. %End
  56. int insertWidget(int index, QWidget *w /GetWrapper/);
  57. %MethodCode
  58. Py_BEGIN_ALLOW_THREADS
  59. sipRes = sipCpp->insertWidget(a0, a1);
  60. Py_END_ALLOW_THREADS
  61. // The layout's parent widget (if there is one) will now have ownership.
  62. QWidget *parent = sipCpp->parentWidget();
  63. if (parent)
  64. {
  65. PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget);
  66. if (py_parent)
  67. sipTransferTo(a1Wrapper, py_parent);
  68. }
  69. else
  70. {
  71. // For now give the Python ownership to the layout. This maintains
  72. // compatibility with previous versions and allows insertWidget(QWidget()).
  73. sipTransferTo(a1Wrapper, sipSelf);
  74. }
  75. %End
  76. QWidget *currentWidget() const;
  77. int currentIndex() const;
  78. QWidget *widget(int) const;
  79. virtual int count() const;
  80. virtual void addItem(QLayoutItem *item /Transfer/);
  81. virtual QSize sizeHint() const;
  82. virtual QSize minimumSize() const;
  83. virtual QLayoutItem *itemAt(int) const;
  84. virtual QLayoutItem *takeAt(int) /TransferBack/;
  85. virtual void setGeometry(const QRect &rect);
  86. signals:
  87. void widgetRemoved(int index);
  88. void currentChanged(int index);
  89. %If (Qt_6_9_0 -)
  90. void widgetAdded(int index);
  91. %End
  92. public slots:
  93. void setCurrentIndex(int index);
  94. void setCurrentWidget(QWidget *w);
  95. public:
  96. QStackedLayout::StackingMode stackingMode() const;
  97. void setStackingMode(QStackedLayout::StackingMode stackingMode);
  98. virtual bool hasHeightForWidth() const;
  99. virtual int heightForWidth(int width) const;
  100. };