10#include "qwt_column_symbol.h" 
   11#include "qwt_painter.h" 
   17static void qwtDrawBox( QPainter* p, 
const QRectF& rect,
 
   18    const QPalette& pal, 
double lw )
 
   22        if ( rect.width() == 0.0 )
 
   24            p->setPen( pal.dark().color() );
 
   25            p->drawLine( rect.topLeft(), rect.bottomLeft() );
 
   29        if ( rect.height() == 0.0 )
 
   31            p->setPen( pal.dark().color() );
 
   32            p->drawLine( rect.topLeft(), rect.topRight() );
 
   36        lw = qwtMinF( lw, rect.height() / 2.0 - 1.0 );
 
   37        lw = qwtMinF( lw, rect.width() / 2.0 - 1.0 );
 
   39        const QRectF outerRect = rect.adjusted( 0, 0, 1, 1 );
 
   40        QPolygonF polygon( outerRect );
 
   42        if ( outerRect.width() > 2 * lw && outerRect.height() > 2 * lw )
 
   44            const QRectF innerRect = outerRect.adjusted( lw, lw, -lw, -lw );
 
   45            polygon = polygon.subtracted( innerRect );
 
   48        p->setPen( Qt::NoPen );
 
   50        p->setBrush( pal.dark() );
 
   51        p->drawPolygon( polygon );
 
   54    const QRectF windowRect = rect.adjusted( lw, lw, -lw + 1, -lw + 1 );
 
   55    if ( windowRect.isValid() )
 
   56        p->fillRect( windowRect, pal.window() );
 
   59static void qwtDrawPanel( QPainter* painter, 
const QRectF& rect,
 
   60    const QPalette& pal, 
double lw )
 
   64        if ( rect.width() == 0.0 )
 
   66            painter->setPen( pal.window().color() );
 
   67            painter->drawLine( rect.topLeft(), rect.bottomLeft() );
 
   71        if ( rect.height() == 0.0 )
 
   73            painter->setPen( pal.window().color() );
 
   74            painter->drawLine( rect.topLeft(), rect.topRight() );
 
   78        lw = qwtMinF( lw, rect.height() / 2.0 - 1.0 );
 
   79        lw = qwtMinF( lw, rect.width() / 2.0 - 1.0 );
 
   81        const QRectF outerRect = rect.adjusted( 0, 0, 1, 1 );
 
   82        const QRectF innerRect = outerRect.adjusted( lw, lw, -lw, -lw );
 
   86        lines[0] += outerRect.bottomLeft();
 
   87        lines[0] += outerRect.topLeft();
 
   88        lines[0] += outerRect.topRight();
 
   89        lines[0] += innerRect.topRight();
 
   90        lines[0] += innerRect.topLeft();
 
   91        lines[0] += innerRect.bottomLeft();
 
   93        lines[1] += outerRect.topRight();
 
   94        lines[1] += outerRect.bottomRight();
 
   95        lines[1] += outerRect.bottomLeft();
 
   96        lines[1] += innerRect.bottomLeft();
 
   97        lines[1] += innerRect.bottomRight();
 
   98        lines[1] += innerRect.topRight();
 
  100        painter->setPen( Qt::NoPen );
 
  102        painter->setBrush( pal.light() );
 
  103        painter->drawPolygon( lines[0] );
 
  104        painter->setBrush( pal.dark() );
 
  105        painter->drawPolygon( lines[1] );
 
  108    painter->fillRect( rect.adjusted( lw, lw, -lw + 1, -lw + 1 ), pal.window() );
 
  111class QwtColumnSymbol::PrivateData
 
  117        , palette( Qt::gray )
 
  137    m_data = 
new PrivateData();
 
  138    m_data->style = 
style;
 
 
  155    m_data->style = 
style;
 
 
  164    return m_data->style;
 
 
  184    return m_data->palette;
 
 
  204    return m_data->frameStyle;
 
 
  218    m_data->lineWidth = width;
 
 
  227    return m_data->lineWidth;
 
 
  243    switch ( m_data->style )
 
 
  270        r.setLeft( qRound( r.left() ) );
 
  271        r.setRight( qRound( r.right() ) );
 
  272        r.setTop( qRound( r.top() ) );
 
  273        r.setBottom( qRound( r.bottom() ) );
 
  276    switch ( m_data->frameStyle )
 
  280            qwtDrawPanel( painter, r, m_data->palette, m_data->lineWidth );
 
  285            qwtDrawBox( painter, r, m_data->palette, m_data->lineWidth );
 
  290            painter->fillRect( r.adjusted( 0, 0, 1, 1 ), m_data->palette.window() );
 
 
  305        r.adjust( 1, 0, 0, 0 );
 
  308        r.adjust( 0, 0, -1, 0 );
 
  311        r.adjust( 0, 1, 0, 0 );
 
  314        r.adjust( 0, 0, 0, -1 );
 
 
Directed rectangle representing bounding rectangle and orientation of a column.
QwtInterval vInterval
Interval for the vertical coordinates.
QwtInterval hInterval
Interval for the horizontal coordinates.
A drawing primitive for columns.
void drawBox(QPainter *, const QwtColumnRect &) const
@ Raised
A raised frame style.
@ Plain
A plain frame style.
virtual ~QwtColumnSymbol()
Destructor.
QwtColumnSymbol(Style=NoStyle)
void setPalette(const QPalette &)
virtual void draw(QPainter *, const QwtColumnRect &) const
void setFrameStyle(FrameStyle)
const QPalette & palette() const
FrameStyle frameStyle() const
void setLineWidth(int width)
@ ExcludeMaximum
Max value is not included in the interval.
@ ExcludeMinimum
Min value is not included in the interval.
BorderFlags borderFlags() const
static bool roundingAlignment()