QWT API (中文) 7.0.1
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
27class QWT_EXPORT QwtFigureLayout : public QLayout
28{
29 Q_OBJECT
30 QWT_DECLARE_PRIVATE(QwtFigureLayout)
31public:
33 explicit QwtFigureLayout(QWidget* parent);
34 virtual ~QwtFigureLayout();
35
36 virtual void addItem(QLayoutItem* item) override;
37 virtual QLayoutItem* itemAt(int index) const override;
38 virtual QLayoutItem* takeAt(int index) override;
39 virtual int count() const override;
40 virtual QSize sizeHint() const override;
41 virtual QSize minimumSize() const override;
42 virtual void setGeometry(const QRect& rect) override;
43
44 // Add a widget with normalized coordinates
45 void addAxes(QWidget* widget, const QRectF& rect);
46
47 // Add a widget with normalized coordinates using separate parameters
48 void addAxes(QWidget* widget, qreal left, qreal top, qreal width, qreal height);
49
50 // Add a widget by grid layout
51 void addGridAxes(QWidget* widget,
52 int rowCnt,
53 int colCnt,
54 int row,
55 int col,
56 int rowSpan = 1,
57 int colSpan = 1,
58 qreal wspace = 0.0,
59 qreal hspace = 0.0);
60
61 // Change the normalized position of an already added widget
62 void setAxesNormPos(QWidget* widget, const QRectF& rect);
63
64 // Get the normalized rectangle for a widget
65 QRectF widgetNormRect(QWidget* widget) const;
66
67 // Calculate normalized coordinates of rect relative to parentRect
68 static QRectF calcNormRect(const QRect& parentRect, const QRect& rect);
69 // Calculate actual rectangle from normalized coordinates
70 QRect calcActualRect(const QRect& parentRect, const QRectF& normRect);
71
72protected:
73 // Calculate the normalized rectangle for a grid cell
74 QRectF calcGridRect(int rowCnt,
75 int colCnt,
76 int row,
77 int col,
78 int rowSpan = 1,
79 int colSpan = 1,
80 qreal wspace = 0.0,
81 qreal hspace = 0.0) const;
82};
83
84#endif // QWT_FIGURE_LAYOUT_H
自定义布局管理器,用于QwtFigureWidget,支持归一化坐标和网格布局
Definition qwt_figure_layout.h:28