
Classes | |
| struct | t_canvasData |
| struct | t_legendData |
| struct | t_scaleData |
| struct | t_titleData |
Public Member Functions | |
| void | init (const QwtPlot *, const QRect &rect) |
Public Attributes | |
| struct QwtPlotLayout::LayoutData::t_legendData | legend |
| struct QwtPlotLayout::LayoutData::t_titleData | title |
| struct QwtPlotLayout::LayoutData::t_scaleData | scale [QwtPlot::axisCnt] |
| struct QwtPlotLayout::LayoutData::t_canvasData | canvas |
Definition at line 20 of file qwt_plot_layout.cpp.
| void QwtPlotLayout::LayoutData::init | ( | const QwtPlot * | plot, |
| const QRect & | rect | ||
| ) |
Definition at line 61 of file qwt_plot_layout.cpp.
References QwtPlot::axisCnt, QwtPlot::axisEnabled(), QwtPlot::axisWidget(), QwtPlotLayout::LayoutData::t_scaleData::baseLineOffset, QwtPlot::canvas(), canvas, QwtScaleWidget::dimForLength(), QwtPlotLayout::LayoutData::t_scaleData::dimWithoutTitle, QwtPlotLayout::LayoutData::t_scaleData::end, QwtScaleWidget::endBorderDist(), QwtPlot::ExternalLegend, QwtPlotLayout::LayoutData::t_canvasData::frameWidth, QwtPlotLayout::LayoutData::t_titleData::frameWidth, QwtPlotLayout::LayoutData::t_legendData::frameWidth, QwtAbstractScaleDraw::hasComponent(), QwtLegend::heightForWidth(), QwtPlotLayout::LayoutData::t_legendData::hint, QwtLegend::horizontalScrollBar(), QwtPlotLayout::LayoutData::t_legendData::hScrollBarHeight, int(), QwtText::isEmpty(), QwtPlotLayout::LayoutData::t_scaleData::isEnabled, legend, QwtPlot::legend(), QwtPlotLayout::legendPosition(), QwtAbstractScaleDraw::majTickLength(), QwtScaleWidget::margin(), QwtText::PaintUsingTextFont, QwtPlot::plotLayout(), qwtMin, scale, QwtScaleWidget::scaleDraw(), QwtPlotLayout::LayoutData::t_scaleData::scaleFont, QwtPlotLayout::LayoutData::t_scaleData::scaleWidget, QwtText::setFont(), QwtLegend::sizeHint(), QwtPlotLayout::LayoutData::t_scaleData::start, QwtScaleWidget::startBorderDist(), QwtText::testPaintAttribute(), QwtTextLabel::text(), QwtPlotLayout::LayoutData::t_titleData::text, QwtPlotLayout::LayoutData::t_scaleData::tickOffset, QwtAbstractScaleDraw::Ticks, QwtScaleWidget::title(), title, QwtScaleWidget::titleHeightForWidth(), QwtPlot::titleLabel(), QwtLegend::verticalScrollBar(), and QwtPlotLayout::LayoutData::t_legendData::vScrollBarWidth.
Referenced by QwtPlotLayout::activate().
{
// legend
if ( plot->plotLayout()->legendPosition() != QwtPlot::ExternalLegend
&& plot->legend() )
{
legend.frameWidth = plot->legend()->frameWidth();
legend.vScrollBarWidth =
plot->legend()->verticalScrollBar()->sizeHint().width();
legend.hScrollBarHeight =
plot->legend()->horizontalScrollBar()->sizeHint().height();
const QSize hint = plot->legend()->sizeHint();
int w = qwtMin(hint.width(), rect.width());
int h = plot->legend()->heightForWidth(w);
if ( h == 0 )
h = hint.height();
if ( h > rect.height() )
w += legend.vScrollBarWidth;
legend.hint = QSize(w, h);
}
// title
title.frameWidth = 0;
title.text = QwtText();
if (plot->titleLabel() )
{
const QwtTextLabel *label = plot->titleLabel();
title.text = label->text();
if ( !(title.text.testPaintAttribute(QwtText::PaintUsingTextFont)) )
title.text.setFont(label->font());
title.frameWidth = plot->titleLabel()->frameWidth();
}
// scales
for (int axis = 0; axis < QwtPlot::axisCnt; axis++ )
{
if ( plot->axisEnabled(axis) )
{
const QwtScaleWidget *scaleWidget = plot->axisWidget(axis);
scale[axis].isEnabled = true;
scale[axis].scaleWidget = scaleWidget;
scale[axis].scaleFont = scaleWidget->font();
scale[axis].start = scaleWidget->startBorderDist();
scale[axis].end = scaleWidget->endBorderDist();
scale[axis].baseLineOffset = scaleWidget->margin();
scale[axis].tickOffset = scaleWidget->margin();
if ( scaleWidget->scaleDraw()->hasComponent(
QwtAbstractScaleDraw::Ticks) )
{
scale[axis].tickOffset +=
(int)scaleWidget->scaleDraw()->majTickLength();
}
scale[axis].dimWithoutTitle = scaleWidget->dimForLength(
QWIDGETSIZE_MAX, scale[axis].scaleFont);
if ( !scaleWidget->title().isEmpty() )
{
scale[axis].dimWithoutTitle -=
scaleWidget->titleHeightForWidth(QWIDGETSIZE_MAX);
}
}
else
{
scale[axis].isEnabled = false;
scale[axis].start = 0;
scale[axis].end = 0;
scale[axis].baseLineOffset = 0;
scale[axis].tickOffset = 0;
scale[axis].dimWithoutTitle = 0;
}
}
// canvas
canvas.frameWidth = plot->canvas()->frameWidth();
}
Referenced by QwtPlotLayout::alignScales(), QwtPlotLayout::expandLineBreaks(), and init().
Referenced by QwtPlotLayout::activate(), QwtPlotLayout::alignLegend(), init(), and QwtPlotLayout::layoutLegend().
| struct QwtPlotLayout::LayoutData::t_scaleData QwtPlotLayout::LayoutData::scale[QwtPlot::axisCnt] |
Referenced by QwtPlotLayout::activate(), QwtPlotLayout::alignScales(), QwtPlotLayout::expandLineBreaks(), and init().
Referenced by QwtPlotLayout::expandLineBreaks(), and init().
1.7.2