┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/search/barsecondrowflowlayout.h
blob: 3f9891e0bf8f2036e3ad073f8e060601515ca7b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
    SPDX-FileCopyrightText: 2025 Felix Ernst <[email protected]>

    SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/

#ifndef BARSECONDROWFLOWLAYOUT_H
#define BARSECONDROWFLOWLAYOUT_H

#include <QLayout>

namespace Search
{

/**
 * @brief The layout for all Search::Bar contents which are not in the first row.
 *
 * For left-to-right languages the search location buttons are kept left-aligned while the chips are right-aligned. When there is not enough space for all the
 * widgts in the current row, a new row is started and the Search::Bar is notified that it needs to resize itself.
 */
class BarSecondRowFlowLayout : public QLayout
{
    Q_OBJECT

public:
    explicit BarSecondRowFlowLayout(QWidget *parent);
    ~BarSecondRowFlowLayout();

    void addItem(QLayoutItem *item) override;
    Qt::Orientations expandingDirections() const override;
    bool hasHeightForWidth() const override;
    int count() const override;
    QLayoutItem *itemAt(int index) const override;
    QSize minimumSize() const override;
    void setGeometry(const QRect &rect) override;
    QSize sizeHint() const override;
    QLayoutItem *takeAt(int index) override;

Q_SIGNALS:
    void heightHintChanged();

private:
    QList<QLayoutItem *> itemList;
};

}

#endif // BARSECONDROWFLOWLAYOUT_H