Qwt User's Guide 6.3.0
Loading...
Searching...
No Matches
qwt_dyngrid_layout.h
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10#ifndef QWT_DYNGRID_LAYOUT_H
11#define QWT_DYNGRID_LAYOUT_H
12
13#include "qwt_global.h"
14#include <qlayout.h>
15
16template< typename T > class QList;
17
27class QWT_EXPORT QwtDynGridLayout : public QLayout
28{
29 Q_OBJECT
30 public:
31 explicit QwtDynGridLayout( QWidget*, int margin = 0, int spacing = -1 );
32 explicit QwtDynGridLayout( int spacing = -1 );
33
34 virtual ~QwtDynGridLayout();
35
36 virtual void invalidate() QWT_OVERRIDE;
37
38 void setMaxColumns( uint maxColumns );
39 uint maxColumns() const;
40
41 uint numRows () const;
42 uint numColumns () const;
43
44 virtual void addItem( QLayoutItem* ) QWT_OVERRIDE;
45
46 virtual QLayoutItem* itemAt( int index ) const QWT_OVERRIDE;
47 virtual QLayoutItem* takeAt( int index ) QWT_OVERRIDE;
48 virtual int count() const QWT_OVERRIDE;
49
50 void setExpandingDirections( Qt::Orientations );
51 virtual Qt::Orientations expandingDirections() const QWT_OVERRIDE;
52 QList< QRect > layoutItems( const QRect&, uint numColumns ) const;
53
54 virtual int maxItemWidth() const;
55
56 virtual void setGeometry( const QRect& ) QWT_OVERRIDE;
57
58 virtual bool hasHeightForWidth() const QWT_OVERRIDE;
59 virtual int heightForWidth( int ) const QWT_OVERRIDE;
60
61 virtual QSize sizeHint() const QWT_OVERRIDE;
62
63 virtual bool isEmpty() const QWT_OVERRIDE;
64 uint itemCount() const;
65
66 virtual uint columnsForWidth( int width ) const;
67
68 protected:
69
70 void layoutGrid( uint numColumns,
71 QVector< int >& rowHeight, QVector< int >& colWidth ) const;
72
73 void stretchGrid( const QRect& rect, uint numColumns,
74 QVector< int >& rowHeight, QVector< int >& colWidth ) const;
75
76 private:
77 void init();
78 int maxRowWidth( int numColumns ) const;
79
80 class PrivateData;
81 PrivateData* m_data;
82};
83
84#endif
The QwtDynGridLayout class lays out widgets in a grid, adjusting the number of columns and rows to th...