Qwt Programmer's manual

QwtScaleIf


NAME

QwtScaleIf - An interface class for widgets containing a scale

SYNOPSIS

#include <qwt_sclif.h>

PUBLIC MEMBERS

setScale (1)
Set user-defined scale
setScale (2)
Set user-defined scale
setScaleMaxMajor
Set Max. number of major tick intervals
setScaleMaxMinor
Set max. number of minor tick intervals
autoScale
adjust scale automatically
scaleMaxMinor
return max. number of minor tick intervals
scaleMaxMajor
return max. number of major tick intervals

PROTECTED MEMBERS

hasUserScale
Check for user-defined scale
scaleChange
Notify change of scale

DESCRIPTION

This interface class is used to provide classes with a protected QwtScaleDraw member and a public interface to access that scale.

INTERNALS

The primary purpose of this class is to define a common interface for classes which are supposed to contain a ScaleDraw class. It provides a protected ScaleDraw member called d_scale and a couple of public member functions which allow direct but restricted access to this scale by the user. Widgets derived from this class have to implement the member function scaleChange(), which is called to notify changes of the scale parameters and usually requires repainting or resizing respectively. In general, a class derived from QwtScaleIf is expected to manage the division and the position of its scale internally when no user-defined scale is set. It should take the d_maxMinor and d_maxMajor members into account, which can be set by the user. An implementation can check if a user-defined scale is set by calling the hasUserScale member.

MEMBER FUNCTION DESCRIPTION


QwtScaleIf::QwtScaleIf

Construct a QwtScaleIf instance

Syntax

QwtScaleIf::QwtScaleIf()

QwtScaleIf::setScale (1)

Specify a user-defined scale.

Syntax

void QwtScaleIf::setScale(double vmin, double vmax, int logarithmic)

Parameters

double vmin, double vmax
boundary values
int logarithmic
If != 0, Build a logarithmic scale

Description

By default, the widget is supposed to control the range of its scale automatically, but sometimes it is desirable to have a user-defined scale which is not in sync with the widget's range, e.g. if a logarithmic scale is needed (sliders don't support that) or if the scale is required to have a fixed range (say 0...100%), independent of the widget's range.

See also

autoScale

QwtScaleIf::setScale (2)

Specify a user-defined scale.

Syntax

void QwtScaleIf::setScale(double vmin, double vmax, int logarithmic)

Parameters

double vmin, double vmax
interval boundaries
int step
major step size
int logarithmic
If != 0, build a logarithmic scale

Description

By default, the widget is supposed to control the range of its scale automatically, but sometimes it is desirable to have a user-defined scale which is not in sync with the widget's range, e.g. if a logarithmic scale is needed (sliders don't support that) or if the scale is required to have a fixed range (say 0...100%), independent of the widget's range.

See also

autoScale

QwtScale::setScale

Assign a user-defined scale division

Syntax

void QwtScale::setScale(const QwtScaleDiv &s)

Parameters

const QwtScaleDiv &s
scale division

QwtScaleIf::autoScale

Advise the widget to control the scale range internally.

Syntax

void QwtScaleIf::autoScale

Description

Autoscaling is on by default.

See also

QwtScaleIf::setScale@

QwtScaleIf::setScaleMaxMajor

Set the maximum number of major tick intervals.

Syntax

void QwtScaleIf::setScaleMaxMajor(int ticks)

Parameters

int ticks
maximal number of major ticks.

Description

The scale's major ticks are calculated automatically such that the number of major intervals does not exceed <ticks>. The default value is 5.

See Also

QwtScaleDraw

QwtScaleIf::setScaleMaxMinor

Set the maximum number of minor tick intervals

Syntax

void QwtScaleIf::setScaleMaxMinor(int ticks)

Parameters

int ticks

Description

The scale's minor ticks are calculated automatically such that the number of minor intervals does not exceed <ticks>. The default value is 3.

See Also

QwtScaleDraw
Qwt Widget Library 02/04/98