qwt_scale_widget.h
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* 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
*****************************************************************************/
#ifndef QWT_SCALE_WIDGET_H
#define QWT_SCALE_WIDGET_H
#include "qwt_global.h"
#include "qwt_text.h"
#include "qwt_scale_draw.h"
#include <qwidget.h>
#include <qfont.h>
#include <qcolor.h>
#include <qstring.h>
class QPainter;
class QwtTransform;
class QwtScaleDiv;
class QwtColorMap;
class QWT_EXPORT QwtScaleWidget : public QWidget
{
Q_OBJECT
public:
enum LayoutFlag
{
TitleInverted = 1
};
typedef QFlags<LayoutFlag> LayoutFlags;
explicit QwtScaleWidget( QWidget *parent = NULL );
explicit QwtScaleWidget( QwtScaleDraw::Alignment, QWidget *parent = NULL );
virtual ~QwtScaleWidget();
Q_SIGNALS:
void scaleDivChanged();
public:
void setTitle( const QString &title );
void setTitle( const QwtText &title );
QwtText title() const;
void setLayoutFlag( LayoutFlag, bool on );
bool testLayoutFlag( LayoutFlag ) const;
void setBorderDist( int dist1, int dist2 );
int startBorderDist() const;
int endBorderDist() const;
void getBorderDistHint( int &start, int &end ) const;
void getMinBorderDist( int &start, int &end ) const;
void setMinBorderDist( int start, int end );
void setMargin( int );
int margin() const;
void setSpacing( int );
int spacing() const;
void setScaleDiv( const QwtScaleDiv & );
void setTransformation( QwtTransform * );
void setScaleDraw( QwtScaleDraw * );
const QwtScaleDraw *scaleDraw() const;
QwtScaleDraw *scaleDraw();
void setLabelAlignment( Qt::Alignment );
void setLabelRotation( double rotation );
void setColorBarEnabled( bool );
bool isColorBarEnabled() const;
void setColorBarWidth( int );
int colorBarWidth() const;
void setColorMap( const QwtInterval &, QwtColorMap * );
QwtInterval colorBarInterval() const;
const QwtColorMap *colorMap() const;
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
int titleHeightForWidth( int width ) const;
int dimForLength( int length, const QFont &scaleFont ) const;
void drawColorBar( QPainter *painter, const QRectF & ) const;
void drawTitle( QPainter *painter, QwtScaleDraw::Alignment,
const QRectF &rect ) const;
void setAlignment( QwtScaleDraw::Alignment );
QwtScaleDraw::Alignment alignment() const;
QRectF colorBarRect( const QRectF& ) const;
protected:
virtual void paintEvent( QPaintEvent * );
virtual void resizeEvent( QResizeEvent * );
void draw( QPainter * ) const;
void scaleChange();
void layoutScale( bool update_geometry = true );
private:
void initScale( QwtScaleDraw::Alignment );
class PrivateData;
PrivateData *d_data;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtScaleWidget::LayoutFlags )
#endif
QwtTransform
A transformation between coordinate systems.
Definition: qwt_transform.h:35
QwtScaleDraw::Alignment
Alignment
Definition: qwt_scale_draw.h:38
QwtScaleDraw
A class for drawing scales.
Definition: qwt_scale_draw.h:31
QwtScaleWidget
A Widget which contains a scale.
Definition: qwt_scale_widget.h:33
QwtText
A class representing a text.
Definition: qwt_text.h:51
QwtScaleWidget::LayoutFlags
QFlags< LayoutFlag > LayoutFlags
Layout flags of the title.
Definition: qwt_scale_widget.h:49
QwtScaleDiv
A class representing a scale division.
Definition: qwt_scale_div.h:36
QwtColorMap
QwtColorMap is used to map values into colors.
Definition: qwt_color_map.h:33
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:26
QwtScaleWidget::LayoutFlag
LayoutFlag
Layout flags of the title.
Definition: qwt_scale_widget.h:39