QWT API (中文) 7.3.0
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 >
34class QList;
35
45class QWT_EXPORT QwtDynGridLayout : public QLayout
46{
47 Q_OBJECT
48public:
49 // Constructor with parent widget, margin and spacing
50 explicit QwtDynGridLayout(QWidget*, int margin = 0, int spacing = -1);
51 // Constructor with spacing only
52 explicit QwtDynGridLayout(int spacing = -1);
53
54 // Destructor
55 ~QwtDynGridLayout() override;
56
57 // Invalidate all internal caches
58 virtual void invalidate() override;
59
60 // Set the maximum number of columns
61 void setMaxColumns(uint maxColumns);
62 // Get the maximum number of columns
63 uint maxColumns() const;
64
65 // Get the number of rows in the current layout
66 uint numRows() const;
67 // Get the number of columns in the current layout
68 uint numColumns() const;
69
70 // Add a layout item to the next free position
71 virtual void addItem(QLayoutItem*) override;
72
73 // Get the item at a specific index
74 virtual QLayoutItem* itemAt(int index) const override;
75 // Remove and return the item at a specific index
76 virtual QLayoutItem* takeAt(int index) override;
77 // Get the number of items in the layout
78 virtual int count() const override;
79
80 // Set the expanding directions for the layout
81 void setExpandingDirections(Qt::Orientations);
82 // Get the expanding directions for the layout
83 virtual Qt::Orientations expandingDirections() const override;
84 // Calculate geometries for items with given number of columns
85 QList< QRect > layoutItems(const QRect&, uint numColumns) const;
86
87 // Get the maximum width of all layout items
88 virtual int maxItemWidth() const;
89
90 // Set the geometry for the layout
91 virtual void setGeometry(const QRect&) override;
92
93 // Check if the layout has height for width
94 virtual bool hasHeightForWidth() const override;
95 // Get the preferred height for a given width
96 virtual int heightForWidth(int) const override;
97
98 // Get the size hint for the layout
99 virtual QSize sizeHint() const override;
100
101 // Check if the layout is empty
102 virtual bool isEmpty() const override;
103 // Get the number of layout items
104 uint itemCount() const;
105
106 // Calculate the number of columns for a given width
107 virtual uint columnsForWidth(int width) const;
108
109protected:
110 void layoutGrid(uint numColumns, QVector< int >& rowHeight, QVector< int >& colWidth) const;
111
112 void stretchGrid(const QRect& rect, uint numColumns, QVector< int >& rowHeight, QVector< int >& colWidth) const;
113
114private:
115 void init();
116 int maxRowWidth(int numColumns) const;
117
118 QWT_DECLARE_PRIVATE(QwtDynGridLayout)
119};
120
121#endif
Definition qwt_raster_data.h:38
Definition qwt_clipper.h:41
Dynamic grid layout that adjusts columns and rows to the current size
Definition qwt_dyngrid_layout.h:46