File indexing completed on 2025-03-09 03:57:04
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2009-10-22 0007 * Description : a dynamic layout manager 0008 * 0009 * SPDX-FileCopyrightText: 2009-2012 by Andi Clemens <andi dot clemens at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_DYNAMIC_LAYOUT_H 0016 #define DIGIKAM_DYNAMIC_LAYOUT_H 0017 0018 // Qt includes 0019 0020 #include <QLayout> 0021 0022 class QLayoutItem; 0023 class QRect; 0024 class QWidget; 0025 0026 namespace Digikam 0027 { 0028 0029 class DynamicLayout : public QLayout 0030 { 0031 Q_OBJECT 0032 0033 public: 0034 0035 explicit DynamicLayout(QWidget* const parent, int margin = -1, 0036 int hSpacing = 0, int vSpacing = 0); 0037 explicit DynamicLayout(int margin = -1, int hSpacing = 0, 0038 int vSpacing = 0); 0039 ~DynamicLayout() override; 0040 0041 void addItem(QLayoutItem* layItem) override; 0042 0043 int horizontalSpacing() const; 0044 int verticalSpacing() const; 0045 0046 Qt::Orientations expandingDirections() const override; 0047 0048 bool hasHeightForWidth() const override; 0049 int heightForWidth(int) const override; 0050 0051 int count() const override; 0052 0053 QLayoutItem* itemAt(int index) const override; 0054 QLayoutItem* takeAt(int index) override; 0055 0056 QSize minimumSize() const override; 0057 0058 void setGeometry(const QRect& rect) override; 0059 QSize sizeHint() const override; 0060 0061 0062 private: 0063 0064 int reLayout(const QRect& rect, 0065 bool testOnly) const; 0066 0067 private: 0068 0069 // Disable 0070 DynamicLayout(const DynamicLayout&) = delete; 0071 DynamicLayout& operator=(const DynamicLayout&) = delete; 0072 0073 private: 0074 0075 class Private; 0076 Private* const d; 0077 }; 0078 0079 } // namespace Digikam 0080 0081 #endif // DIGIKAM_DYNAMIC_LAYOUT_H