Classes | Public Member Functions | Public Attributes

QwtPlotLayout::LayoutData Class Reference

Collaboration diagram for QwtPlotLayout::LayoutData:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

Definition at line 20 of file qwt_plot_layout.cpp.


Member Function Documentation

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();
}

Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines