Krita Source Code Documentation
Loading...
Searching...
No Matches
KisWrappableHBoxLayout.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * Author: Agata Cacko cacko.azh@gmail.com
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7#ifndef KIS_WRAPPABLE_HBOX_LAYOUT_H
8#define KIS_WRAPPABLE_HBOX_LAYOUT_H
9
10#include <QVector>
11#include <QLayout>
12#include "kritawidgetutils_export.h"
13
14// code taken partially from https://doc.qt.io/qt-5/qtwidgets-layouts-flowlayout-example.html
15// and https://doc.qt.io/qt-5/layout.html
16class KRITAWIDGETUTILS_EXPORT KisWrappableHBoxLayout : public QLayout
17{
18 Q_OBJECT
19
20public:
21 explicit KisWrappableHBoxLayout(QWidget* parent = nullptr);
22 ~KisWrappableHBoxLayout() override;
23
24 void addItem(QLayoutItem *item) override;
25 QSize sizeHint() const override;
26 QSize minimumSize() const override;
27 int count() const override;
28 QLayoutItem *itemAt(int) const override;
29 QLayoutItem *takeAt(int) override;
30 void setGeometry(const QRect &rect) override;
31 bool hasHeightForWidth() const override;
32 int heightForWidth(int width) const override;
33
34protected:
35 int doLayout(const QRect &rect, bool testOnly) const;
36
37private:
39 int m_lastWidth {-1};
40
41};
42
43
44#endif // KIS_WRAPPABLE_HBOX_LAYOUT_H
QVector< QLayoutItem * > m_items