source: ntrip/trunk/BNC/qwt/qwt_dyngrid_layout.h@ 9045

Last change on this file since 9045 was 8127, checked in by stoecker, 8 years ago

update qwt and qwtpolar, many QT5 fixes (unfinished)

File size: 2.3 KB
Line 
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
18/*!
19 \brief The QwtDynGridLayout class lays out widgets in a grid,
20 adjusting the number of columns and rows to the current size.
21
22 QwtDynGridLayout takes the space it gets, divides it up into rows and
23 columns, and puts each of the widgets it manages into the correct cell(s).
24 It lays out as many number of columns as possible (limited by maxColumns()).
25*/
26
27class QWT_EXPORT QwtDynGridLayout : public QLayout
28{
29 Q_OBJECT
30public:
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
68protected:
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
75private:
76 void init();
77 int maxRowWidth( int numCols ) const;
78
79 class PrivateData;
80 PrivateData *d_data;
81};
82
83#endif
Note: See TracBrowser for help on using the repository browser.