1// qstackedlayout.sip generated by MetaSIP 2// 3// This file is part of the QtWidgets Python extension module. 4// 5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com> 6// 7// This file is part of PyQt5. 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 22 23class QStackedLayout : QLayout 24{ 25%TypeHeaderCode 26#include <qstackedlayout.h> 27%End 28 29public: 30 enum StackingMode 31 { 32 StackOne, 33 StackAll, 34 }; 35 36 QStackedLayout(); 37 explicit QStackedLayout(QWidget *parent /TransferThis/); 38 explicit QStackedLayout(QLayout *parentLayout /TransferThis/); 39 virtual ~QStackedLayout(); 40 int addWidget(QWidget *w /GetWrapper/); 41%MethodCode 42 Py_BEGIN_ALLOW_THREADS 43 sipRes = sipCpp->addWidget(a0); 44 Py_END_ALLOW_THREADS 45 46 // The layout's parent widget (if there is one) will now have ownership. 47 QWidget *parent = sipCpp->parentWidget(); 48 49 if (parent) 50 { 51 PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget); 52 53 if (py_parent) 54 sipTransferTo(a0Wrapper, py_parent); 55 } 56 else 57 { 58 // For now give the Python ownership to the layout. This maintains 59 // compatibility with previous versions and allows addWidget(QWidget()). 60 sipTransferTo(a0Wrapper, sipSelf); 61 } 62%End 63 64 int insertWidget(int index, QWidget *w /GetWrapper/); 65%MethodCode 66 Py_BEGIN_ALLOW_THREADS 67 sipRes = sipCpp->insertWidget(a0, a1); 68 Py_END_ALLOW_THREADS 69 70 // The layout's parent widget (if there is one) will now have ownership. 71 QWidget *parent = sipCpp->parentWidget(); 72 73 if (parent) 74 { 75 PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget); 76 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 88 QWidget *currentWidget() const; 89 int currentIndex() const; 90 QWidget *widget(int) const; 91 virtual QWidget *widget(); 92 virtual int count() const; 93 virtual void addItem(QLayoutItem *item /Transfer/); 94 virtual QSize sizeHint() const; 95 virtual QSize minimumSize() const; 96 virtual QLayoutItem *itemAt(int) const; 97 virtual QLayoutItem *takeAt(int) /TransferBack/; 98 virtual void setGeometry(const QRect &rect); 99 100signals: 101 void widgetRemoved(int index); 102 void currentChanged(int index); 103 104public slots: 105 void setCurrentIndex(int index); 106 void setCurrentWidget(QWidget *w); 107 108public: 109 QStackedLayout::StackingMode stackingMode() const; 110 void setStackingMode(QStackedLayout::StackingMode stackingMode); 111 virtual bool hasHeightForWidth() const; 112 virtual int heightForWidth(int width) const; 113}; 114