Qwt User's Guide  6.1.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Pages
qwt_dyngrid_layout.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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 #include <qsize.h>
16 #include <qlist.h>
17 
27 class QWT_EXPORT QwtDynGridLayout : public QLayout
28 {
29  Q_OBJECT
30 public:
31  explicit QwtDynGridLayout( QWidget *, int margin = 0, int space = -1 );
32  explicit QwtDynGridLayout( int space = -1 );
33 
34  virtual ~QwtDynGridLayout();
35 
36  virtual void invalidate();
37 
38  void setMaxColumns( uint maxCols );
39  uint maxColumns() const;
40 
41  uint numRows () const;
42  uint numColumns () const;
43 
44  virtual void addItem( QLayoutItem * );
45 
46  virtual QLayoutItem *itemAt( int index ) const;
47  virtual QLayoutItem *takeAt( int index );
48  virtual int count() const;
49 
50  void setExpandingDirections( Qt::Orientations );
51  virtual Qt::Orientations expandingDirections() const;
52  QList<QRect> layoutItems( const QRect &, uint numCols ) const;
53 
54  virtual int maxItemWidth() const;
55 
56  virtual void setGeometry( const QRect &rect );
57 
58  virtual bool hasHeightForWidth() const;
59  virtual int heightForWidth( int ) const;
60 
61  virtual QSize sizeHint() const;
62 
63  virtual bool isEmpty() const;
64  uint itemCount() const;
65 
66  virtual uint columnsForWidth( int width ) const;
67 
68 protected:
69 
70  void layoutGrid( uint numCols,
71  QVector<int>& rowHeight, QVector<int>& colWidth ) const;
72  void stretchGrid( const QRect &rect, uint numCols,
73  QVector<int>& rowHeight, QVector<int>& colWidth ) const;
74 
75 private:
76  void init();
77  int maxRowWidth( int numCols ) const;
78 
79  class PrivateData;
80  PrivateData *d_data;
81 };
82 
83 #endif
The QwtDynGridLayout class lays out widgets in a grid, adjusting the number of columns and rows to th...
Definition: qwt_dyngrid_layout.h:27