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