QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_figure_layout.h
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 2024 ChenZongYan <czy.t@163.com>
4 *****************************************************************************/
5#ifndef QWT_FIGURE_LAYOUT_H
6#define QWT_FIGURE_LAYOUT_H
7// stl
8#include <memory>
9
10// Qt
11#include <QLayout>
12
13// qwt
14#include "qwt_global.h"
15
21class QWT_EXPORT QwtFigureLayout : public QLayout
22{
23 Q_OBJECT
24 QWT_DECLARE_PRIVATE(QwtFigureLayout)
25public:
27 explicit QwtFigureLayout(QWidget* parent);
28 ~QwtFigureLayout() override;
29
30 virtual void addItem(QLayoutItem* item) override;
31 virtual QLayoutItem* itemAt(int index) const override;
32 virtual QLayoutItem* takeAt(int index) override;
33 virtual int count() const override;
34 virtual QSize sizeHint() const override;
35 virtual QSize minimumSize() const override;
36 virtual void setGeometry(const QRect& rect) override;
37
38 // Add a widget with normalized coordinates
39 void addAxes(QWidget* widget, const QRectF& rect);
40
41 // Add a widget with normalized coordinates using separate parameters
42 void addAxes(QWidget* widget, qreal left, qreal top, qreal width, qreal height);
43
44 // Add a widget by grid layout
45 void addGridAxes(QWidget* widget,
46 int rowCnt,
47 int colCnt,
48 int row,
49 int col,
50 int rowSpan = 1,
51 int colSpan = 1,
52 qreal wspace = 0.0,
53 qreal hspace = 0.0);
54
55 // Change the normalized position of an already added widget
56 void setAxesNormPos(QWidget* widget, const QRectF& rect);
57
58 // Get the normalized rectangle for a widget
59 QRectF widgetNormRect(QWidget* widget) const;
60
61 // Calculate normalized coordinates of rect relative to parentRect
62 static QRectF calcNormRect(const QRect& parentRect, const QRect& rect);
63 // Calculate actual rectangle from normalized coordinates
64 QRect calcActualRect(const QRect& parentRect, const QRectF& normRect);
65
66protected:
67 // Calculate the normalized rectangle for a grid cell
68 QRectF calcGridRect(int rowCnt,
69 int colCnt,
70 int row,
71 int col,
72 int rowSpan = 1,
73 int colSpan = 1,
74 qreal wspace = 0.0,
75 qreal hspace = 0.0) const;
76};
77
78#endif // QWT_FIGURE_LAYOUT_H
Custom layout manager for QwtFigureWidget that handles both normalized coordinates and grid layouts
Definition qwt_figure_layout.h:22