File indexing completed on 2024-11-24 04:53:01
0001 /* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 0002 All rights reserved. 0003 Contact: Nokia Corporation (qt-info@nokia.com) 0004 0005 This file is part of the Trojita Qt IMAP e-mail client, 0006 http://trojita.flaska.net/ 0007 0008 It was taken from the examples of the Qt Toolkit. 0009 0010 $QT_BEGIN_LICENSE:LGPL$ 0011 Commercial Usage 0012 Licensees holding valid Qt Commercial licenses may use this file in 0013 accordance with the Qt Commercial License Agreement provided with the 0014 Software or, alternatively, in accordance with the terms contained in 0015 a written agreement between you and Nokia. 0016 0017 GNU Lesser General Public License Usage 0018 Alternatively, this file may be used under the terms of the GNU Lesser 0019 General Public License version 2.1 as published by the Free Software 0020 Foundation and appearing in the file LICENSE.LGPL included in the 0021 packaging of this file. Please review the following information to 0022 ensure the GNU Lesser General Public License version 2.1 requirements 0023 will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 0024 0025 In addition, as a special exception, Nokia gives you certain additional 0026 rights. These rights are described in the Nokia Qt LGPL Exception 0027 version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 0028 0029 GNU General Public License Usage 0030 Alternatively, this file may be used under the terms of the GNU 0031 General Public License version 3.0 as published by the Free Software 0032 Foundation and appearing in the file LICENSE.GPL included in the 0033 packaging of this file. Please review the following information to 0034 ensure the GNU General Public License version 3.0 requirements will be 0035 met: http://www.gnu.org/copyleft/gpl.html. 0036 0037 If you have questions regarding the use of this file, please contact 0038 Nokia at qt-info@nokia.com. 0039 $QT_END_LICENSE$ 0040 */ 0041 0042 #ifndef GUI_FLOWLAYOUT_H 0043 #define GUI_FLOWLAYOUT_H 0044 0045 #include <QLayout> 0046 #include <QRect> 0047 #include <QStyle> 0048 #include <QWidgetItem> 0049 0050 namespace Gui 0051 { 0052 0053 class FlowLayout : public QLayout 0054 { 0055 public: 0056 explicit FlowLayout(QWidget *parent, int margin = -1, int hSpacing = -1, int vSpacing = -1); 0057 explicit FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1); 0058 ~FlowLayout(); 0059 0060 void addItem(QLayoutItem *item); 0061 int horizontalSpacing() const; 0062 int verticalSpacing() const; 0063 Qt::Orientations expandingDirections() const; 0064 bool hasHeightForWidth() const; 0065 int heightForWidth(int) const; 0066 int count() const; 0067 QLayoutItem *itemAt(int index) const; 0068 QSize minimumSize() const; 0069 void setGeometry(const QRect &rect); 0070 QSize sizeHint() const; 0071 QLayoutItem *takeAt(int index); 0072 0073 private: 0074 int doLayout(const QRect &rect, bool testOnly) const; 0075 int smartSpacing(QStyle::PixelMetric pm) const; 0076 0077 QList<QLayoutItem *> itemList; 0078 int m_hSpace; 0079 int m_vSpace; 0080 }; 0081 0082 } // namespace Gui 0083 0084 #endif // GUI_FLOWLAYOUT_H