QWT API (English) 7.0.1
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
QwtPlotLayoutEngine Class Reference

Layout engine for QwtPlot components. More...

#include <qwt_plot_layout_engine.h>

Classes

struct  Dimensions
 Structure holding dimension values for layout calculation. More...
 
class  LayoutData
 Data structure for layout calculation. More...
 

Public Member Functions

 QwtPlotLayoutEngine ()
 Default constructor for QwtPlotLayoutEngine.
 
QRectF layoutLegend (int plotLayoutOptions, const LayoutData::LegendData &legendData, const QRectF &rect, const QSize &legendHint) const
 Calculate legend rectangle within available space.
 
QRectF alignLegend (const QSize &legendHint, const QRectF &canvasRect, const QRectF &legendRect) const
 Align legend rectangle relative to canvas.
 
void alignScales (int plotLayoutOptions, const LayoutData &layoutData, QRectF &canvasRect, QRectF scaleRect[QwtAxis::AxisPositions]) const
 Align scale rectangles with canvas.
 
void alignScalesToCanvas (int plotLayoutOptions, const LayoutData &layoutData, const QRectF &canvasRect, QRectF scaleRect[QwtAxis::AxisPositions]) const
 Align scale rectangles to canvas boundaries.
 
Dimensions layoutDimensions (int plotLayoutOptions, const LayoutData &layoutData, const QRectF &rect) const
 Iteratively calculate the layout dimensions for a QwtPlot.
 
void setSpacing (unsigned int spacing)
 Set spacing value.
 
unsigned int spacing () const
 Get spacing value.
 
void setAlignCanvas (int axisPos, bool on)
 Set canvas alignment to scale for a specific axis position.
 
bool alignCanvas (int axisPos) const
 Check if canvas is aligned to scale for a specific axis position.
 
void setCanvasMargin (int axisPos, int margin)
 Set canvas margin for a specific axis position.
 
int canvasMargin (int axisPos) const
 Get canvas margin for a specific axis position.
 
void setLegendPos (QwtPlot::LegendPosition pos)
 Set the legend position.
 
QwtPlot::LegendPosition legendPos () const
 Get the legend position.
 
void setLegendRatio (double ratio)
 Set the legend ratio.
 
double legendRatio () const
 Get the legend ratio.
 

Detailed Description

Layout engine for QwtPlot components.

Constructor & Destructor Documentation

◆ QwtPlotLayoutEngine()

QwtPlotLayoutEngine::QwtPlotLayoutEngine ( )

Default constructor for QwtPlotLayoutEngine.

Member Function Documentation

◆ alignCanvas()

bool QwtPlotLayoutEngine::alignCanvas ( int  axisPos) const

Check if canvas is aligned to scale for a specific axis position.

◆ alignLegend()

QRectF QwtPlotLayoutEngine::alignLegend ( const QSize &  legendHint,
const QRectF &  canvasRect,
const QRectF &  legendRect 
) const

Align legend rectangle relative to canvas.

◆ alignScales()

void QwtPlotLayoutEngine::alignScales ( int  plotLayoutOptions,
const LayoutData layoutData,
QRectF &  canvasRect,
QRectF  scaleRect[QwtAxis::AxisPositions] 
) const

Align scale rectangles with canvas.

  1. 初始化骨干偏移量 (Backbone Offset) 首先计算每个轴的骨干偏移量,这个偏移量由以下几部分组成:
    • 如果不对齐画布到刻度,则加上画布边距
    • 如果不忽略框架,则加上画布内容边距
  1. 处理X轴和Y轴的相互影响 函数遍历所有轴位置,处理X轴和Y轴之间的相互空间影响:

对于X轴(水平轴): 检查左侧Y轴和右侧Y轴的影响 计算左右偏移量,考虑轴起始/结束距离和骨干偏移 调整X轴矩形位置,必要时调整画布矩形

对于Y轴(垂直轴): 检查底部X轴和顶部X轴的影响 计算上下偏移量,考虑轴起始/结束距离和骨干偏移 调整Y轴矩形位置,必要时调整画布矩形

当轴需要比可用空间更多的空间时,函数会调整画布矩形

在所有轴相互调整后,函数进行最终的对齐调整,确保轴与画布边缘正确对齐

◆ alignScalesToCanvas()

void QwtPlotLayoutEngine::alignScalesToCanvas ( int  plotLayoutOptions,
const LayoutData layoutData,
const QRectF &  canvasRect,
QRectF  scaleRect[QwtAxis::AxisPositions] 
) const

Align scale rectangles to canvas boundaries.

  1. 初始化骨干偏移量 (Backbone Offset) 首先计算每个轴的骨干偏移量,这个偏移量由以下几部分组成:
    • 如果不对齐画布到刻度,则加上画布边距
    • 如果不忽略框架,则加上画布内容边距
  1. 处理X轴和Y轴的相互影响 函数遍历所有轴位置,处理X轴和Y轴之间的相互空间影响:

对于X轴(水平轴): 检查左侧Y轴和右侧Y轴的影响 计算左右偏移量,考虑轴起始/结束距离和骨干偏移 调整X轴矩形位置,必要时调整画布矩形

对于Y轴(垂直轴): 检查底部X轴和顶部X轴的影响 计算上下偏移量,考虑轴起始/结束距离和骨干偏移 调整Y轴矩形位置,必要时调整画布矩形

在所有轴相互调整后,函数进行最终的对齐调整,确保轴与画布边缘正确对齐

◆ canvasMargin()

int QwtPlotLayoutEngine::canvasMargin ( int  axisPos) const

Get canvas margin for a specific axis position.

◆ layoutDimensions()

QwtPlotLayoutEngine::Dimensions QwtPlotLayoutEngine::layoutDimensions ( int  plotLayoutOptions,
const LayoutData layoutData,
const QRectF &  rect 
) const

Iteratively calculate the layout dimensions for a QwtPlot.

◆ layoutLegend()

QRectF QwtPlotLayoutEngine::layoutLegend ( int  plotLayoutOptions,
const LayoutData::LegendData legendData,
const QRectF &  rect,
const QSize &  legendHint 
) const

Calculate legend rectangle within available space.

◆ legendPos()

QwtPlot::LegendPosition QwtPlotLayoutEngine::legendPos ( ) const

Get the legend position.

◆ legendRatio()

double QwtPlotLayoutEngine::legendRatio ( ) const

Get the legend ratio.

◆ setAlignCanvas()

void QwtPlotLayoutEngine::setAlignCanvas ( int  axisPos,
bool  on 
)

Set canvas alignment to scale for a specific axis position.

◆ setCanvasMargin()

void QwtPlotLayoutEngine::setCanvasMargin ( int  axisPos,
int  margin 
)

Set canvas margin for a specific axis position.

◆ setLegendPos()

void QwtPlotLayoutEngine::setLegendPos ( QwtPlot::LegendPosition  pos)

Set the legend position.

◆ setLegendRatio()

void QwtPlotLayoutEngine::setLegendRatio ( double  ratio)

Set the legend ratio.

◆ setSpacing()

void QwtPlotLayoutEngine::setSpacing ( unsigned int  spacing)

Set spacing value.

◆ spacing()

unsigned int QwtPlotLayoutEngine::spacing ( ) const

Get spacing value.


The documentation for this class was generated from the following files: