9#include "qwt_polar_layout.h" 
   10#include "qwt_polar_plot.h" 
   11#include "qwt_polar_canvas.h" 
   13#include "qwt_text_label.h" 
   14#include "qwt_legend.h" 
   16class QwtPolarLayout::LayoutData
 
   41void QwtPolarLayout::LayoutData::init(
 
   49        legend.frameWidth = plot->
legend()->frameWidth();
 
   50        legend.hScrollExtent =
 
   52        legend.vScrollExtent =
 
   55        const QSizeF hint = plot->
legend()->sizeHint();
 
   57        double w = qMin( hint.width(), rect.width() );
 
   58        double h = plot->
legend()->heightForWidth( w );
 
   62        if ( h > rect.height() )
 
   63            w += legend.hScrollExtent;
 
   65        legend.hint = QSizeF( w, h );
 
   76        title.text = label->
text();
 
   78            title.text.
setFont( label->font() );
 
   80        title.frameWidth = plot->
titleLabel()->frameWidth();
 
   85    canvas.frameWidth = plot->
canvas()->frameWidth();
 
   88class QwtPolarLayout::PrivateData
 
  101    QwtPolarLayout::LayoutData layoutData;
 
  107    unsigned int spacing;
 
  116    m_data = 
new PrivateData;
 
 
  154            m_data->legendRatio = ratio;
 
  155            m_data->legendPos = pos;
 
  163            m_data->legendRatio = ratio;
 
  164            m_data->legendPos = pos;
 
  169            m_data->legendRatio = ratio; 
 
  170            m_data->legendPos = pos;
 
 
  198    return m_data->legendPos;
 
 
  221    return m_data->legendRatio;
 
 
  231    return m_data->titleRect;
 
 
  241    return m_data->legendRect;
 
 
  250    return m_data->canvasRect;
 
 
  259    m_data->titleRect = m_data->legendRect = m_data->canvasRect = QRect();
 
 
  271    const QSizeF hint( m_data->layoutData.legend.hint );
 
  280        dim = qMin( 
double( hint.width() ), rect.width() * m_data->legendRatio );
 
  284            if ( hint.height() > rect.height() )
 
  289                dim += m_data->layoutData.legend.hScrollExtent;
 
  295        dim = qMin( 
double( hint.height() ), rect.height() * m_data->legendRatio );
 
  296        dim = qMax( dim, m_data->layoutData.legend.vScrollExtent );
 
  300    switch( m_data->legendPos )
 
 
  345    const QRectF& boundingRect, 
Options options )
 
  349    QRectF rect( boundingRect ); 
 
  350    rect.adjust( m_data->margin, m_data->margin,
 
  351        -m_data->margin, -m_data->margin );
 
  356    m_data->layoutData.init( plot, rect );
 
  362        if ( m_data->layoutData.legend.frameWidth &&
 
  369            switch( m_data->legendPos )
 
  372                    rect.setLeft( rect.left() + m_data->spacing );
 
  376                    rect.setRight( rect.right() - m_data->spacing );
 
  380                    rect.setTop( rect.top() + m_data->spacing );
 
  384                    rect.setBottom( rect.bottom() - m_data->spacing );
 
  394        !m_data->layoutData.title.text.
isEmpty() )
 
  396        int h = m_data->layoutData.title.text.
heightForWidth( rect.width() );
 
  398            h += 2 * m_data->layoutData.title.frameWidth;
 
  400        m_data->titleRect = QRectF( rect.x(), rect.y(), rect.width(), h );
 
  403        rect.setTop( rect.top() + h + m_data->spacing );
 
  413        m_data->canvasRect = rect;
 
  420        const int dim = qMin( rect.width(), rect.height() );
 
  422        m_data->canvasRect.setX( rect.center().x() - dim / 2 );
 
  423        m_data->canvasRect.setY( rect.y() );
 
  424        m_data->canvasRect.setSize( QSize( dim, dim ) );
 
  427    if ( !m_data->legendRect.isEmpty() )
 
  435            if ( m_data->layoutData.legend.hint.height()
 
  436                < m_data->canvasRect.height() )
 
  438                m_data->legendRect.setY( m_data->canvasRect.y() );
 
  439                m_data->legendRect.setHeight( m_data->canvasRect.height() );
 
 
virtual int scrollExtent(Qt::Orientation) const
virtual bool isEmpty() const =0
double radius() const
Returns the radius.
const QRectF & legendRect() const
virtual ~QwtPolarLayout()
Destructor.
QRectF layoutLegend(Options options, QRectF &) const
void setLegendRatio(double ratio)
double legendRatio() const
void setLegendPosition(QwtPolarPlot::LegendPosition pos, double ratio)
Specify the position of the legend.
virtual void invalidate()
QwtPolarPlot::LegendPosition legendPosition() const
virtual void activate(const QwtPolarPlot *, const QRectF &rect, Options options=Options())
Recalculate the geometry of all components.
QwtPolarLayout()
Constructor.
const QRectF & titleRect() const
@ IgnoreLegend
Ignore the legend.
@ IgnoreScrollbars
Ignore the dimension of the scrollbars.
@ IgnoreTitle
Ignore the title.
@ IgnoreFrames
Ignore all frames.
const QRectF & canvasRect() const
A plotting widget, displaying a polar coordinate system.
QwtPolarLayout * plotLayout()
QwtPointPolar zoomPos() const
double zoomFactor() const
QwtAbstractLegend * legend()
QwtPolarCanvas * canvas()
@ BottomLegend
The legend will be below the canvas.
@ LeftLegend
The legend will be left from the canvas.
@ TopLegend
The legend will be between canvas and title.
@ RightLegend
The legend will be right from the canvas.
QwtTextLabel * titleLabel()
A class representing a text.
bool testPaintAttribute(PaintAttribute) const
@ PaintUsingTextFont
The text has an individual font.
void setFont(const QFont &)
double heightForWidth(double width) const
A Widget which displays a QwtText.
const QwtText & text() const
Return the text.