QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
qgsoverlaywidgetlayout.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsoverlaywidgetlayout.h
3 ---------------------
4 begin : March 2024
5 copyright : (C) 2024 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSOVERLAYWIDGETLAYOUT_H
17#define QGSOVERLAYWIDGETLAYOUT_H
18
19#include "qgis_gui.h"
20#include "qgis_sip.h"
21
22#include <QLayout>
23
30class GUI_EXPORT QgsOverlayWidgetLayout : public QLayout
31{
32 Q_OBJECT
33
34 public:
35
39 QgsOverlayWidgetLayout( QWidget *parent SIP_TRANSFERTHIS = nullptr );
40 ~QgsOverlayWidgetLayout() override;
41
42 int count() const final;
43 void addItem( QLayoutItem *item ) final;
44 QLayoutItem *itemAt( int index ) const final;
45 QLayoutItem *takeAt( int index ) final;
46 QSize sizeHint() const final;
47 QSize minimumSize() const final;
48 void setGeometry( const QRect &rect ) final;
49
56 void addWidget( QWidget *widget SIP_TRANSFER, Qt::Edge edge );
57
63 void setHorizontalSpacing( int spacing );
64
70 int horizontalSpacing() const { return mHorizontalSpacing; }
71
77 void setVerticalSpacing( int spacing );
78
84 int verticalSpacing() const { return mVerticalSpacing; }
85
86 private:
87
88 QList< QLayoutItem *> mLeftItems;
89 QList< QLayoutItem *> mRightItems;
90 QList< QLayoutItem *> mTopItems;
91 QList< QLayoutItem *> mBottomItems;
92 int mHorizontalSpacing = 0;
93 int mVerticalSpacing = 0;
94
95
96};
97
98#endif // QGSOVERLAYWIDGETLAYOUT_H
A custom layout which can be used to overlay child widgets over a parent widget.
int horizontalSpacing() const
Returns the spacing between widgets that are laid out side by side.
int verticalSpacing() const
Returns the spacing between widgets that are laid out on top of each other.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
#define SIP_TRANSFER
Definition: qgis_sip.h:36