QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_DYNGRID_LAYOUT_H
28#define QWT_DYNGRID_LAYOUT_H
29
30#include "qwt_global.h"
31#include <qlayout.h>
32
33template< typename T > class QList;
34
54class QWT_EXPORT QwtDynGridLayout : public QLayout
55{
56 Q_OBJECT
57 public:
58 // Constructor with parent widget, margin and spacing
59 explicit QwtDynGridLayout( QWidget*, int margin = 0, int spacing = -1 );
60 // Constructor with spacing only
61 explicit QwtDynGridLayout( int spacing = -1 );
62
63 // Destructor
64 virtual ~QwtDynGridLayout();
65
66 // Invalidate all internal caches
67 virtual void invalidate() override;
68
69 // Set the maximum number of columns
70 void setMaxColumns( uint maxColumns );
71 // Get the maximum number of columns
72 uint maxColumns() const;
73
74 // Get the number of rows in the current layout
75 uint numRows () const;
76 // Get the number of columns in the current layout
77 uint numColumns () const;
78
79 // Add a layout item to the next free position
80 virtual void addItem( QLayoutItem* ) override;
81
82 // Get the item at a specific index
83 virtual QLayoutItem* itemAt( int index ) const override;
84 // Remove and return the item at a specific index
85 virtual QLayoutItem* takeAt( int index ) override;
86 // Get the number of items in the layout
87 virtual int count() const override;
88
89 // Set the expanding directions for the layout
90 void setExpandingDirections( Qt::Orientations );
91 // Get the expanding directions for the layout
92 virtual Qt::Orientations expandingDirections() const override;
93 // Calculate geometries for items with given number of columns
94 QList< QRect > layoutItems( const QRect&, uint numColumns ) const;
95
96 // Get the maximum width of all layout items
97 virtual int maxItemWidth() const;
98
99 // Set the geometry for the layout
100 virtual void setGeometry( const QRect& ) override;
101
102 // Check if the layout has height for width
103 virtual bool hasHeightForWidth() const override;
104 // Get the preferred height for a given width
105 virtual int heightForWidth( int ) const override;
106
107 // Get the size hint for the layout
108 virtual QSize sizeHint() const override;
109
110 // Check if the layout is empty
111 virtual bool isEmpty() const override;
112 // Get the number of layout items
113 uint itemCount() const;
114
115 // Calculate the number of columns for a given width
116 virtual uint columnsForWidth( int width ) const;
117
118 protected:
119
120 void layoutGrid( uint numColumns,
121 QVector< int >& rowHeight, QVector< int >& colWidth ) const;
122
123 void stretchGrid( const QRect& rect, uint numColumns,
124 QVector< int >& rowHeight, QVector< int >& colWidth ) const;
125
126 private:
127 void init();
128 int maxRowWidth( int numColumns ) const;
129
130 class PrivateData;
131 PrivateData* m_data;
132};
133
134#endif
Definition qwt_dyngrid_layout.h:33
Definition qwt_clipper.h:40
动态网格布局,根据当前大小调整列数和行数
Definition qwt_dyngrid_layout.h:55