1// qgraphicslinearlayout.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 QGraphicsLinearLayout : QGraphicsLayout
24{
25%TypeHeaderCode
26#include <qgraphicslinearlayout.h>
27%End
28
29public:
30    QGraphicsLinearLayout(QGraphicsLayoutItem *parent /TransferThis/ = 0);
31    QGraphicsLinearLayout(Qt::Orientation orientation, QGraphicsLayoutItem *parent /TransferThis/ = 0);
32    virtual ~QGraphicsLinearLayout();
33    void setOrientation(Qt::Orientation orientation);
34    Qt::Orientation orientation() const;
35    void addItem(QGraphicsLayoutItem *item /Transfer/);
36    void addStretch(int stretch = 1);
37    void insertItem(int index, QGraphicsLayoutItem *item /Transfer/);
38    void insertStretch(int index, int stretch = 1);
39    void removeItem(QGraphicsLayoutItem *item /TransferBack/);
40    virtual void removeAt(int index);
41%MethodCode
42        // The ownership of any existing item must be passed back to Python.
43        QGraphicsLayoutItem *itm;
44
45        if (a0 < sipCpp->count())
46            itm = sipCpp->itemAt(a0);
47        else
48            itm = 0;
49
50        Py_BEGIN_ALLOW_THREADS
51        sipSelfWasArg ? sipCpp->QGraphicsLinearLayout::removeAt(a0)
52                      : sipCpp->removeAt(a0);
53        Py_END_ALLOW_THREADS
54
55        // The Qt documentation isn't quite correct as ownership isn't always passed
56        // back to the caller.
57        if (itm && !itm->parentLayoutItem())
58        {
59            PyObject *itmo = sipGetPyObject(itm, sipType_QGraphicsLayoutItem);
60
61            if (itmo)
62                sipTransferBack(itmo);
63        }
64%End
65
66    void setSpacing(qreal spacing);
67    qreal spacing() const;
68    void setItemSpacing(int index, qreal spacing);
69    qreal itemSpacing(int index) const;
70    void setStretchFactor(QGraphicsLayoutItem *item, int stretch);
71    int stretchFactor(QGraphicsLayoutItem *item) const;
72    void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment);
73    Qt::Alignment alignment(QGraphicsLayoutItem *item) const;
74    virtual void setGeometry(const QRectF &rect);
75    virtual int count() const;
76    virtual QGraphicsLayoutItem *itemAt(int index) const;
77    virtual void invalidate();
78    virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
79};
80