qwt_scale_widget.cpp
/******************************************************************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#include "qwt_scale_widget.h"
#include "qwt_painter.h"
#include "qwt_color_map.h"
#include "qwt_scale_map.h"
#include "qwt_math.h"
#include "qwt_scale_div.h"
#include "qwt_text.h"
#include "qwt_interval.h"
#include "qwt_scale_engine.h"
#include <qpainter.h>
#include <qevent.h>
#include <qstyle.h>
#include <qstyleoption.h>
#include <qapplication.h>
#include <qmargins.h>
class QwtScaleWidget::PrivateData
{
public:
PrivateData()
: scaleDraw( NULL )
{
colorBar.colorMap = NULL;
}
~PrivateData()
{
delete scaleDraw;
delete colorBar.colorMap;
}
QwtScaleDraw* scaleDraw;
int borderDist[2];
int minBorderDist[2];
int scaleLength;
int margin;
int titleOffset;
int spacing;
QwtText title;
QwtScaleWidget::LayoutFlags layoutFlags;
struct t_colorBar
{
bool isEnabled;
int width;
QwtInterval interval;
QwtColorMap* colorMap;
} colorBar;
};
QwtScaleWidget::QwtScaleWidget( QWidget* parent )
: QWidget( parent )
{
initScale( QwtScaleDraw::LeftScale );
}
QwtScaleWidget::QwtScaleWidget( QwtScaleDraw::Alignment align, QWidget* parent )
: QWidget( parent )
{
initScale( align );
}
QwtScaleWidget::~QwtScaleWidget()
{
delete m_data;
}
void QwtScaleWidget::initScale( QwtScaleDraw::Alignment align )
{
m_data = new PrivateData;
if ( align == QwtScaleDraw::RightScale )
m_data->layoutFlags |= TitleInverted;
m_data->borderDist[0] = 0;
m_data->borderDist[1] = 0;
m_data->minBorderDist[0] = 0;
m_data->minBorderDist[1] = 0;
m_data->margin = 4;
m_data->titleOffset = 0;
m_data->spacing = 2;
m_data->scaleDraw = new QwtScaleDraw;
m_data->scaleDraw->setAlignment( align );
m_data->scaleDraw->setLength( 10 );
m_data->scaleDraw->setScaleDiv(
QwtLinearScaleEngine().divideScale( 0.0, 100.0, 10, 5 ) );
m_data->colorBar.colorMap = new QwtLinearColorMap();
m_data->colorBar.isEnabled = false;
m_data->colorBar.width = 10;
const int flags = Qt::AlignHCenter
| Qt::TextExpandTabs | Qt::TextWordWrap;
m_data->title.setRenderFlags( flags );
m_data->title.setFont( font() );
QSizePolicy policy( QSizePolicy::MinimumExpanding,
QSizePolicy::Fixed );
if ( m_data->scaleDraw->orientation() == Qt::Vertical )
policy.transpose();
setSizePolicy( policy );
setAttribute( Qt::WA_WState_OwnSizePolicy, false );
}
void QwtScaleWidget::setLayoutFlag( LayoutFlag flag, bool on )
{
if ( ( ( m_data->layoutFlags & flag ) != 0 ) != on )
{
if ( on )
m_data->layoutFlags |= flag;
else
m_data->layoutFlags &= ~flag;
update();
}
}
bool QwtScaleWidget::testLayoutFlag( LayoutFlag flag ) const
{
return ( m_data->layoutFlags & flag );
}
void QwtScaleWidget::setTitle( const QString& title )
{
if ( m_data->title.text() != title )
{
m_data->title.setText( title );
layoutScale();
}
}
void QwtScaleWidget::setTitle( const QwtText& title )
{
QwtText t = title;
const int flags = title.renderFlags() & ~( Qt::AlignTop | Qt::AlignBottom );
t.setRenderFlags( flags );
if ( t != m_data->title )
{
m_data->title = t;
layoutScale();
}
}
void QwtScaleWidget::setAlignment( QwtScaleDraw::Alignment alignment )
{
if ( m_data->scaleDraw )
m_data->scaleDraw->setAlignment( alignment );
if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
{
QSizePolicy policy( QSizePolicy::MinimumExpanding,
QSizePolicy::Fixed );
if ( m_data->scaleDraw->orientation() == Qt::Vertical )
policy.transpose();
setSizePolicy( policy );
setAttribute( Qt::WA_WState_OwnSizePolicy, false );
}
layoutScale();
}
QwtScaleDraw::Alignment QwtScaleWidget::alignment() const
{
if ( !scaleDraw() )
return QwtScaleDraw::LeftScale;
return scaleDraw()->alignment();
}
void QwtScaleWidget::setBorderDist( int dist1, int dist2 )
{
if ( dist1 != m_data->borderDist[0] || dist2 != m_data->borderDist[1] )
{
m_data->borderDist[0] = dist1;
m_data->borderDist[1] = dist2;
layoutScale();
}
}
void QwtScaleWidget::setMargin( int margin )
{
margin = qMax( 0, margin );
if ( margin != m_data->margin )
{
m_data->margin = margin;
layoutScale();
}
}
void QwtScaleWidget::setSpacing( int spacing )
{
spacing = qMax( 0, spacing );
if ( spacing != m_data->spacing )
{
m_data->spacing = spacing;
layoutScale();
}
}
void QwtScaleWidget::setLabelAlignment( Qt::Alignment alignment )
{
m_data->scaleDraw->setLabelAlignment( alignment );
layoutScale();
}
void QwtScaleWidget::setLabelRotation( double rotation )
{
m_data->scaleDraw->setLabelRotation( rotation );
layoutScale();
}
void QwtScaleWidget::setScaleDraw( QwtScaleDraw* scaleDraw )
{
if ( ( scaleDraw == NULL ) || ( scaleDraw == m_data->scaleDraw ) )
return;
const QwtScaleDraw* sd = m_data->scaleDraw;
if ( sd )
{
scaleDraw->setAlignment( sd->alignment() );
scaleDraw->setScaleDiv( sd->scaleDiv() );
QwtTransform* transform = NULL;
if ( sd->scaleMap().transformation() )
transform = sd->scaleMap().transformation()->copy();
scaleDraw->setTransformation( transform );
}
delete m_data->scaleDraw;
m_data->scaleDraw = scaleDraw;
layoutScale();
}
const QwtScaleDraw* QwtScaleWidget::scaleDraw() const
{
return m_data->scaleDraw;
}
QwtScaleDraw* QwtScaleWidget::scaleDraw()
{
return m_data->scaleDraw;
}
QwtText QwtScaleWidget::title() const
{
return m_data->title;
}
int QwtScaleWidget::startBorderDist() const
{
return m_data->borderDist[0];
}
int QwtScaleWidget::endBorderDist() const
{
return m_data->borderDist[1];
}
int QwtScaleWidget::margin() const
{
return m_data->margin;
}
int QwtScaleWidget::spacing() const
{
return m_data->spacing;
}
void QwtScaleWidget::paintEvent( QPaintEvent* event )
{
QPainter painter( this );
painter.setClipRegion( event->region() );
QStyleOption opt;
opt.initFrom(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
draw( &painter );
}
void QwtScaleWidget::draw( QPainter* painter ) const
{
m_data->scaleDraw->draw( painter, palette() );
if ( m_data->colorBar.isEnabled && m_data->colorBar.width > 0 &&
m_data->colorBar.interval.isValid() )
{
drawColorBar( painter, colorBarRect( contentsRect() ) );
}
QRect r = contentsRect();
if ( m_data->scaleDraw->orientation() == Qt::Horizontal )
{
r.setLeft( r.left() + m_data->borderDist[0] );
r.setWidth( r.width() - m_data->borderDist[1] );
}
else
{
r.setTop( r.top() + m_data->borderDist[0] );
r.setHeight( r.height() - m_data->borderDist[1] );
}
if ( !m_data->title.isEmpty() )
drawTitle( painter, m_data->scaleDraw->alignment(), r );
}
QRectF QwtScaleWidget::colorBarRect( const QRectF& rect ) const
{
QRectF cr = rect;
if ( m_data->scaleDraw->orientation() == Qt::Horizontal )
{
cr.setLeft( cr.left() + m_data->borderDist[0] );
cr.setWidth( cr.width() - m_data->borderDist[1] + 1 );
}
else
{
cr.setTop( cr.top() + m_data->borderDist[0] );
cr.setHeight( cr.height() - m_data->borderDist[1] + 1 );
}
switch ( m_data->scaleDraw->alignment() )
{
case QwtScaleDraw::LeftScale:
{
cr.setLeft( cr.right() - m_data->margin
- m_data->colorBar.width );
cr.setWidth( m_data->colorBar.width );
break;
}
case QwtScaleDraw::RightScale:
{
cr.setLeft( cr.left() + m_data->margin );
cr.setWidth( m_data->colorBar.width );
break;
}
case QwtScaleDraw::BottomScale:
{
cr.setTop( cr.top() + m_data->margin );
cr.setHeight( m_data->colorBar.width );
break;
}
case QwtScaleDraw::TopScale:
{
cr.setTop( cr.bottom() - m_data->margin
- m_data->colorBar.width );
cr.setHeight( m_data->colorBar.width );
break;
}
}
return cr;
}
void QwtScaleWidget::changeEvent( QEvent* event )
{
if ( event->type() == QEvent::LocaleChange )
{
m_data->scaleDraw->invalidateCache();
}
QWidget::changeEvent( event );
}
void QwtScaleWidget::resizeEvent( QResizeEvent* event )
{
Q_UNUSED( event );
layoutScale( false );
}
void QwtScaleWidget::layoutScale( bool update_geometry )
{
int bd0, bd1;
getBorderDistHint( bd0, bd1 );
if ( m_data->borderDist[0] > bd0 )
bd0 = m_data->borderDist[0];
if ( m_data->borderDist[1] > bd1 )
bd1 = m_data->borderDist[1];
int colorBarWidth = 0;
if ( m_data->colorBar.isEnabled && m_data->colorBar.interval.isValid() )
colorBarWidth = m_data->colorBar.width + m_data->spacing;
const QRectF r = contentsRect();
double x, y, length;
if ( m_data->scaleDraw->orientation() == Qt::Vertical )
{
y = r.top() + bd0;
length = r.height() - ( bd0 + bd1 );
if ( m_data->scaleDraw->alignment() == QwtScaleDraw::LeftScale )
x = r.right() - 1.0 - m_data->margin - colorBarWidth;
else
x = r.left() + m_data->margin + colorBarWidth;
}
else
{
x = r.left() + bd0;
length = r.width() - ( bd0 + bd1 );
if ( m_data->scaleDraw->alignment() == QwtScaleDraw::BottomScale )
y = r.top() + m_data->margin + colorBarWidth;
else
y = r.bottom() - 1.0 - m_data->margin - colorBarWidth;
}
m_data->scaleDraw->move( x, y );
m_data->scaleDraw->setLength( length );
const int extent = qwtCeil( m_data->scaleDraw->extent( font() ) );
m_data->titleOffset =
m_data->margin + m_data->spacing + colorBarWidth + extent;
if ( update_geometry )
{
updateGeometry();
#if 1
/*
for some reason updateGeometry does not send a LayoutRequest event
when the parent is not visible and has no layout
*/
if ( QWidget* w = parentWidget() )
{
if ( !w->isVisible() && w->layout() == NULL )
{
if ( w->testAttribute( Qt::WA_WState_Polished ) )
QApplication::postEvent( w, new QEvent( QEvent::LayoutRequest ) );
}
}
#endif
update();
}
}
void QwtScaleWidget::drawColorBar( QPainter* painter, const QRectF& rect ) const
{
if ( !m_data->colorBar.interval.isValid() )
return;
const QwtScaleDraw* sd = m_data->scaleDraw;
QwtPainter::drawColorBar( painter, *m_data->colorBar.colorMap,
m_data->colorBar.interval.normalized(), sd->scaleMap(),
sd->orientation(), rect );
}
void QwtScaleWidget::drawTitle( QPainter* painter,
QwtScaleDraw::Alignment align, const QRectF& rect ) const
{
QRectF r = rect;
double angle;
int flags = m_data->title.renderFlags() &
~( Qt::AlignTop | Qt::AlignBottom | Qt::AlignVCenter );
switch ( align )
{
case QwtScaleDraw::LeftScale:
angle = -90.0;
flags |= Qt::AlignTop;
r.setRect( r.left(), r.bottom(),
r.height(), r.width() - m_data->titleOffset );
break;
case QwtScaleDraw::RightScale:
angle = -90.0;
flags |= Qt::AlignTop;
r.setRect( r.left() + m_data->titleOffset, r.bottom(),
r.height(), r.width() - m_data->titleOffset );
break;
case QwtScaleDraw::BottomScale:
angle = 0.0;
flags |= Qt::AlignBottom;
r.setTop( r.top() + m_data->titleOffset );
break;
case QwtScaleDraw::TopScale:
default:
angle = 0.0;
flags |= Qt::AlignTop;
r.setBottom( r.bottom() - m_data->titleOffset );
break;
}
if ( m_data->layoutFlags & TitleInverted )
{
if ( align == QwtScaleDraw::LeftScale
|| align == QwtScaleDraw::RightScale )
{
angle = -angle;
r.setRect( r.x() + r.height(), r.y() - r.width(),
r.width(), r.height() );
}
}
painter->save();
painter->setFont( font() );
painter->setPen( palette().color( QPalette::Text ) );
painter->translate( r.x(), r.y() );
if ( angle != 0.0 )
painter->rotate( angle );
QwtText title = m_data->title;
title.setRenderFlags( flags );
title.draw( painter, QRectF( 0.0, 0.0, r.width(), r.height() ) );
painter->restore();
}
void QwtScaleWidget::scaleChange()
{
layoutScale();
}
QSize QwtScaleWidget::sizeHint() const
{
return minimumSizeHint();
}
QSize QwtScaleWidget::minimumSizeHint() const
{
const Qt::Orientation o = m_data->scaleDraw->orientation();
// Border Distance cannot be less than the scale borderDistHint
// Note, the borderDistHint is already included in minHeight/minWidth
int length = 0;
int mbd1, mbd2;
getBorderDistHint( mbd1, mbd2 );
length += qMax( 0, m_data->borderDist[0] - mbd1 );
length += qMax( 0, m_data->borderDist[1] - mbd2 );
length += m_data->scaleDraw->minLength( font() );
int dim = dimForLength( length, font() );
if ( length < dim )
{
// compensate for long titles
length = dim;
dim = dimForLength( length, font() );
}
QSize size( length + 2, dim );
if ( o == Qt::Vertical )
size.transpose();
const QMargins m = contentsMargins();
return size + QSize( m.left() + m.right(), m.top() + m.bottom() );
}
int QwtScaleWidget::titleHeightForWidth( int width ) const
{
return qwtCeil( m_data->title.heightForWidth( width, font() ) );
}
int QwtScaleWidget::dimForLength( int length, const QFont& scaleFont ) const
{
const int extent = qwtCeil( m_data->scaleDraw->extent( scaleFont ) );
int dim = m_data->margin + extent + 1;
if ( !m_data->title.isEmpty() )
dim += titleHeightForWidth( length ) + m_data->spacing;
if ( m_data->colorBar.isEnabled && m_data->colorBar.interval.isValid() )
dim += m_data->colorBar.width + m_data->spacing;
return dim;
}
void QwtScaleWidget::getBorderDistHint( int& start, int& end ) const
{
m_data->scaleDraw->getBorderDistHint( font(), start, end );
if ( start < m_data->minBorderDist[0] )
start = m_data->minBorderDist[0];
if ( end < m_data->minBorderDist[1] )
end = m_data->minBorderDist[1];
}
void QwtScaleWidget::setMinBorderDist( int start, int end )
{
m_data->minBorderDist[0] = start;
m_data->minBorderDist[1] = end;
}
void QwtScaleWidget::getMinBorderDist( int& start, int& end ) const
{
start = m_data->minBorderDist[0];
end = m_data->minBorderDist[1];
}
void QwtScaleWidget::setScaleDiv( const QwtScaleDiv& scaleDiv )
{
QwtScaleDraw* sd = m_data->scaleDraw;
if ( sd->scaleDiv() != scaleDiv )
{
sd->setScaleDiv( scaleDiv );
layoutScale();
Q_EMIT scaleDivChanged();
}
}
void QwtScaleWidget::setTransformation( QwtTransform* transformation )
{
m_data->scaleDraw->setTransformation( transformation );
layoutScale();
}
void QwtScaleWidget::setColorBarEnabled( bool on )
{
if ( on != m_data->colorBar.isEnabled )
{
m_data->colorBar.isEnabled = on;
layoutScale();
}
}
bool QwtScaleWidget::isColorBarEnabled() const
{
return m_data->colorBar.isEnabled;
}
void QwtScaleWidget::setColorBarWidth( int width )
{
if ( width != m_data->colorBar.width )
{
m_data->colorBar.width = width;
if ( isColorBarEnabled() )
layoutScale();
}
}
int QwtScaleWidget::colorBarWidth() const
{
return m_data->colorBar.width;
}
QwtInterval QwtScaleWidget::colorBarInterval() const
{
return m_data->colorBar.interval;
}
void QwtScaleWidget::setColorMap(
const QwtInterval& interval, QwtColorMap* colorMap )
{
m_data->colorBar.interval = interval;
if ( colorMap != m_data->colorBar.colorMap )
{
delete m_data->colorBar.colorMap;
m_data->colorBar.colorMap = colorMap;
}
if ( isColorBarEnabled() )
layoutScale();
}
const QwtColorMap* QwtScaleWidget::colorMap() const
{
return m_data->colorBar.colorMap;
}
#if QWT_MOC_INCLUDE
#include "moc_qwt_scale_widget.cpp"
#endif
QwtAbstractScaleDraw::setScaleDiv
void setScaleDiv(const QwtScaleDiv &)
Definition: qwt_abstract_scale_draw.cpp:104
QwtAbstractScaleDraw::scaleMap
const QwtScaleMap & scaleMap() const
Definition: qwt_abstract_scale_draw.cpp:121
QwtAbstractScaleDraw::setTransformation
void setTransformation(QwtTransform *)
Definition: qwt_abstract_scale_draw.cpp:115
QwtAbstractScaleDraw::scaleDiv
const QwtScaleDiv & scaleDiv() const
Definition: qwt_abstract_scale_draw.cpp:133
QwtColorMap
QwtColorMap is used to map values into colors.
Definition: qwt_color_map.h:38
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:23
QwtLinearColorMap
QwtLinearColorMap builds a color map from color stops.
Definition: qwt_color_map.h:99
QwtLinearScaleEngine
A scale engine for linear scales.
Definition: qwt_scale_engine.h:152
QwtPainter::drawColorBar
static void drawColorBar(QPainter *, const QwtColorMap &, const QwtInterval &, const QwtScaleMap &, Qt::Orientation, const QRectF &)
Definition: qwt_painter.cpp:1205
QwtScaleDiv
A class representing a scale division.
Definition: qwt_scale_div.h:34
QwtScaleDraw
A class for drawing scales.
Definition: qwt_scale_draw.h:36
QwtScaleDraw::setAlignment
void setAlignment(Alignment)
Definition: qwt_scale_draw.cpp:322
QwtScaleDraw::alignment
Alignment alignment() const
Definition: qwt_scale_draw.cpp:309
QwtScaleDraw::orientation
Qt::Orientation orientation() const
Definition: qwt_scale_draw.cpp:337
QwtScaleDraw::Alignment
Alignment
Definition: qwt_scale_draw.h:43
QwtScaleDraw::BottomScale
@ BottomScale
The scale is below.
Definition: qwt_scale_draw.h:45
QwtScaleDraw::TopScale
@ TopScale
The scale is above.
Definition: qwt_scale_draw.h:48
QwtScaleDraw::RightScale
@ RightScale
The scale is right.
Definition: qwt_scale_draw.h:54
QwtScaleDraw::LeftScale
@ LeftScale
The scale is left.
Definition: qwt_scale_draw.h:51
QwtScaleMap::transformation
const QwtTransform * transformation() const
Get the transformation.
Definition: qwt_scale_map.cpp:88
QwtScaleWidget::startBorderDist
int startBorderDist() const
Definition: qwt_scale_widget.cpp:380
QwtScaleWidget::drawColorBar
void drawColorBar(QPainter *, const QRectF &) const
Definition: qwt_scale_widget.cpp:624
QwtScaleWidget::alignment
QwtScaleDraw::Alignment alignment() const
Definition: qwt_scale_widget.cpp:234
QwtScaleWidget::LayoutFlags
QFlags< LayoutFlag > LayoutFlags
Definition: qwt_scale_widget.h:49
QwtScaleWidget::title
QwtText title() const
Definition: qwt_scale_widget.cpp:371
QwtScaleWidget::colorMap
const QwtColorMap * colorMap() const
Definition: qwt_scale_widget.cpp:974
QwtScaleWidget::setTitle
void setTitle(const QString &title)
Definition: qwt_scale_widget.cpp:172
QwtScaleWidget::scaleDraw
const QwtScaleDraw * scaleDraw() const
Definition: qwt_scale_widget.cpp:353
QwtScaleWidget::setMargin
void setMargin(int)
Specify the margin to the colorBar/base line.
Definition: qwt_scale_widget.cpp:265
QwtScaleWidget::setColorMap
void setColorMap(const QwtInterval &, QwtColorMap *)
Definition: qwt_scale_widget.cpp:955
QwtScaleWidget::draw
void draw(QPainter *) const
draw the scale
Definition: qwt_scale_widget.cpp:430
QwtScaleWidget::setMinBorderDist
void setMinBorderDist(int start, int end)
Definition: qwt_scale_widget.cpp:835
QwtScaleWidget::sizeHint
virtual QSize sizeHint() const override
Definition: qwt_scale_widget.cpp:724
QwtScaleWidget::changeEvent
virtual void changeEvent(QEvent *) override
Definition: qwt_scale_widget.cpp:519
QwtScaleWidget::scaleDivChanged
void scaleDivChanged()
Signal emitted, whenever the scale division changes.
QwtScaleWidget::isColorBarEnabled
bool isColorBarEnabled() const
Definition: qwt_scale_widget.cpp:907
QwtScaleWidget::testLayoutFlag
bool testLayoutFlag(LayoutFlag) const
Definition: qwt_scale_widget.cpp:161
QwtScaleWidget::drawTitle
void drawTitle(QPainter *, QwtScaleDraw::Alignment, const QRectF &rect) const
Definition: qwt_scale_widget.cpp:644
QwtScaleWidget::setLayoutFlag
void setLayoutFlag(LayoutFlag, bool on)
Definition: qwt_scale_widget.cpp:141
QwtScaleWidget::setTransformation
void setTransformation(QwtTransform *)
Definition: qwt_scale_widget.cpp:884
QwtScaleWidget::endBorderDist
int endBorderDist() const
Definition: qwt_scale_widget.cpp:389
QwtScaleWidget::setColorBarWidth
void setColorBarWidth(int)
Definition: qwt_scale_widget.cpp:918
QwtScaleWidget::~QwtScaleWidget
virtual ~QwtScaleWidget()
Destructor.
Definition: qwt_scale_widget.cpp:86
QwtScaleWidget::setLabelAlignment
void setLabelAlignment(Qt::Alignment)
Change the alignment for the labels.
Definition: qwt_scale_widget.cpp:295
QwtScaleWidget::layoutScale
void layoutScale(bool update_geometry=true)
Definition: qwt_scale_widget.cpp:547
QwtScaleWidget::LayoutFlag
LayoutFlag
Layout flags of the title.
Definition: qwt_scale_widget.h:41
QwtScaleWidget::TitleInverted
@ TitleInverted
Definition: qwt_scale_widget.h:46
QwtScaleWidget::spacing
int spacing() const
Definition: qwt_scale_widget.cpp:407
QwtScaleWidget::paintEvent
virtual void paintEvent(QPaintEvent *) override
paintEvent
Definition: qwt_scale_widget.cpp:415
QwtScaleWidget::getBorderDistHint
void getBorderDistHint(int &start, int &end) const
Calculate a hint for the border distances.
Definition: qwt_scale_widget.cpp:814
QwtScaleWidget::colorBarRect
QRectF colorBarRect(const QRectF &) const
Definition: qwt_scale_widget.cpp:462
QwtScaleWidget::setAlignment
void setAlignment(QwtScaleDraw::Alignment)
Definition: qwt_scale_widget.cpp:209
QwtScaleWidget::dimForLength
int dimForLength(int length, const QFont &scaleFont) const
Find the minimum dimension for a given length. dim is the height, length the width seen in direction ...
Definition: qwt_scale_widget.cpp:781
QwtScaleWidget::setBorderDist
void setBorderDist(int dist1, int dist2)
Definition: qwt_scale_widget.cpp:250
QwtScaleWidget::margin
int margin() const
Definition: qwt_scale_widget.cpp:398
QwtScaleWidget::colorBarWidth
int colorBarWidth() const
Definition: qwt_scale_widget.cpp:932
QwtScaleWidget::getMinBorderDist
void getMinBorderDist(int &start, int &end) const
Definition: qwt_scale_widget.cpp:852
QwtScaleWidget::minimumSizeHint
virtual QSize minimumSizeHint() const override
Definition: qwt_scale_widget.cpp:732
QwtScaleWidget::QwtScaleWidget
QwtScaleWidget(QWidget *parent=NULL)
Create a scale with the position QwtScaleWidget::Left.
Definition: qwt_scale_widget.cpp:68
QwtScaleWidget::colorBarInterval
QwtInterval colorBarInterval() const
Definition: qwt_scale_widget.cpp:941
QwtScaleWidget::setSpacing
void setSpacing(int)
Specify the distance between color bar, scale and title.
Definition: qwt_scale_widget.cpp:280
QwtScaleWidget::setLabelRotation
void setLabelRotation(double rotation)
Change the rotation for the labels. See QwtScaleDraw::setLabelRotation().
Definition: qwt_scale_widget.cpp:308
QwtScaleWidget::setScaleDiv
void setScaleDiv(const QwtScaleDiv &)
Assign a scale division.
Definition: qwt_scale_widget.cpp:866
QwtScaleWidget::setColorBarEnabled
void setColorBarEnabled(bool)
Definition: qwt_scale_widget.cpp:894
QwtScaleWidget::scaleChange
void scaleChange()
Notify a change of the scale.
Definition: qwt_scale_widget.cpp:716
QwtScaleWidget::resizeEvent
virtual void resizeEvent(QResizeEvent *) override
Definition: qwt_scale_widget.cpp:533
QwtScaleWidget::setScaleDraw
void setScaleDraw(QwtScaleDraw *)
Definition: qwt_scale_widget.cpp:325
QwtScaleWidget::titleHeightForWidth
int titleHeightForWidth(int width) const
Find the height of the title for a given width.
Definition: qwt_scale_widget.cpp:767
QwtText
A class representing a text.
Definition: qwt_text.h:52
QwtText::renderFlags
int renderFlags() const
Definition: qwt_text.cpp:317
QwtText::draw
void draw(QPainter *painter, const QRectF &rect) const
Definition: qwt_text.cpp:615
QwtText::setRenderFlags
void setRenderFlags(int)
Change the render flags.
Definition: qwt_text.cpp:304
QwtTransform
A transformation between coordinate systems.
Definition: qwt_transform.h:36
QwtTransform::copy
virtual QwtTransform * copy() const =0
Virtualized copy operation.