QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskGridLayoutEngine.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_GRID_LAYOUT_ENGINE_H
7#define QSK_GRID_LAYOUT_ENGINE_H
8
9#include "QskGlobal.h"
10#include "QskLayoutEngine2D.h"
11
12#include <qnamespace.h>
13#include <memory>
14
15class QQuickItem;
16class QSizeF;
17class QRectF;
18
19class QSK_EXPORT QskGridLayoutEngine : public QskLayoutEngine2D
20{
21 public:
23 ~QskGridLayoutEngine() override;
24
25 int count() const override final;
26
27 bool setStretchFactor( int pos, int stretch, Qt::Orientation );
28 int stretchFactor( int pos, Qt::Orientation ) const;
29
30 bool setRowSizeHint( int row, Qt::SizeHint, qreal height );
31 qreal rowSizeHint( int row, Qt::SizeHint ) const;
32
33 bool setColumnSizeHint( int column, Qt::SizeHint, qreal width );
34 qreal columnSizeHint( int column, Qt::SizeHint ) const;
35
36 int insertItem( QQuickItem*, const QRect& grid );
37 int insertSpacer( const QSizeF&, const QRect& grid );
38
39 bool removeAt( int index );
40 bool clear();
41
42 QQuickItem* itemAt( int index ) const;
43 QSizeF spacerAt( int index ) const;
44
45 QQuickItem* itemAt( int row, int column ) const;
46 int indexAt( int row, int column ) const;
47
48 int indexOf( const QQuickItem* ) const;
49
50 bool setGridAt( int index, const QRect& );
51 QRect gridAt( int index ) const;
52
53 QRect effectiveGridAt( int index ) const;
54
55 void transpose();
56
57 private:
58 QskSizePolicy sizePolicyAt( int index ) const override final;
59 void layoutItems() override;
60 int effectiveCount( Qt::Orientation ) const override;
61
62 void invalidateElementCache() override;
63
64 void setupChain( Qt::Orientation, const QskLayoutChain::Segments&,
65 QskLayoutChain& ) const override final;
66
67 class PrivateData;
68 std::unique_ptr< PrivateData > m_data;
69};
70
71#endif