File indexing completed on 2024-04-28 04:18:50
0001 /**************************************************************************** 0002 ** 0003 ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). 0004 ** Contact: Qt Software Information (qt-info@nokia.com) 0005 ** 0006 ** This file is part of the example classes of the Qt Toolkit. 0007 ** 0008 ** Commercial Usage 0009 ** Licensees holding valid Qt Commercial licenses may use this file in 0010 ** accordance with the Qt Commercial License Agreement provided with the 0011 ** Software or, alternatively, in accordance with the terms contained in 0012 ** a written agreement between you and Nokia. 0013 ** 0014 ** 0015 ** GNU General Public License Usage 0016 ** Alternatively, this file may be used under the terms of the GNU 0017 ** General Public License versions 2.0 or 3.0 as published by the Free 0018 ** Software Foundation and appearing in the file LICENSE.GPL included in 0019 ** the packaging of this file. Please review the following information 0020 ** to ensure GNU General Public Licensing requirements will be met: 0021 ** https://www.fsf.org/licensing/licenses/info/GPLv2.html and 0022 ** https://www.gnu.org/copyleft/gpl.html. In addition, as a special 0023 ** exception, Nokia gives you certain additional rights. These rights 0024 ** are described in the Nokia Qt GPL Exception version 1.3, included in 0025 ** the file GPL_EXCEPTION.txt in this package. 0026 ** 0027 ** Qt for Windows(R) Licensees 0028 ** As a special exception, Nokia, as the sole copyright holder for Qt 0029 ** Designer, grants users of the Qt/Eclipse Integration plug-in the 0030 ** right for the Qt/Eclipse Integration to link to functionality 0031 ** provided by Qt Designer and its related libraries. 0032 ** 0033 ** If you are unsure which license is appropriate for your use, please 0034 ** contact the sales department at qt-sales@nokia.com. 0035 ** 0036 ****************************************************************************/ 0037 0038 #ifndef FLOWLAYOUT_H 0039 #define FLOWLAYOUT_H 0040 0041 #include <lib/gwenviewlib_export.h> 0042 0043 #include <QLayout> 0044 #include <QRect> 0045 0046 class GWENVIEWLIB_EXPORT FlowLayout : public QLayout 0047 { 0048 Q_OBJECT 0049 public: 0050 explicit FlowLayout(QWidget *parent, int margin = 0, int spacing = -1); 0051 FlowLayout(int spacing = -1); 0052 ~FlowLayout() override; 0053 0054 int horizontalSpacing() const; 0055 void setHorizontalSpacing(const int spacing); 0056 int verticalSpacing() const; 0057 void setVerticalSpacing(const int spacing); 0058 0059 void addItem(QLayoutItem *item) override; 0060 Qt::Orientations expandingDirections() const override; 0061 bool hasHeightForWidth() const override; 0062 int heightForWidth(int) const override; 0063 int count() const override; 0064 QLayoutItem *itemAt(int index) const override; 0065 QSize minimumSize() const override; 0066 void setGeometry(const QRect &rect) override; 0067 QSize sizeHint() const override; 0068 QLayoutItem *takeAt(int index) override; 0069 void addSpacing(const int size); 0070 0071 private: 0072 int getMargin() const; 0073 int doLayout(const QRect &rect, bool testOnly) const; 0074 0075 QList<QLayoutItem *> itemList; 0076 int mHorizontalSpacing; 0077 int mVerticalSpacing; 0078 }; 0079 0080 #endif