• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • GUI - CDP Widgets
  • CDPBaseMeter

CDPBaseMeter Class

The Meter is a classic gauge widget supporting alarms, ticks, decimal numbers and lots of properties for styling/customizing the widget. More...

Header: #include <CDPBaseMeter>
Inherits: CDPBaseWidget and CDPBaseCom
Inherited By:

CDPBaseMeter2N

  • List of all members, including inherited members

Public Types

enum AspectRatio { Unlocked, Locked, HeightForWidth }
typedef MeterDataMap
typedef MeterSvgMap
enum MeterType { Custom, Round, RoundScaleRight, GMT }
typedef NeedleEnabledMap

Properties

  • ErrorColor : QColor
  • NormalColor : QColor
  • WarningColor : QColor
  • WarningHighColor : QColor
  • alarmSectorLimit : bool
  • alarmShow : bool
  • aspectRatio : AspectRatio
  • cdpOfflineValue : const double
  • cdpOfflineValueEnabled : const bool
  • cdpRouting : QString
  • cdpScaling : const double
  • cdpStyleRouting : QString
  • fill : bool
  • fillColor : QColor
  • fillOffset : double
  • fillStartValue : double
  • fillWidth : double
  • maxValue : double
  • meterType : MeterType
  • minValue : double
  • needle : bool
  • needleStyle : int
  • numFont : QFont
  • numOffset : int
  • numPostfix : QString
  • numPrecision : int
  • numPrecisionMethod : CDPBaseTickMarks::NumPrecision
  • numShow : bool
  • svgFile : QString
  • svgUpdateAll : bool
  • textPrefix : QString
  • textSuffix : QString
  • ticksColor : QColor
  • ticksMajor : int
  • ticksMajorLength : int
  • ticksMajorWidth : int
  • ticksMinor : int
  • ticksMinorLength : int
  • ticksMinorWidth : int
  • ticksOffset : double
  • ticksShow : bool
  • unitCircle : bool
  • unitCircleShowMin : bool
  • value : double
  • valueMaxError : double
  • valueMaxNormal : double
  • valueMaxWarning : double
  • valueMaxWarningHigh : double
  • valueMinError : double
  • valueMinNormal : double
  • valueMinWarning : double
  • valueMinWarningHigh : double
  • 6 properties inherited from CDPBaseWidget

Public Functions

CDPBaseMeter(QWidget *parent = 0, bool bSetMeterType = false)
virtual ~CDPBaseMeter()
double alarmSectorCenter(int layer = FirstLayer)
double alarmSectorError(int layer = FirstLayer)
virtual bool alarmSectorLimit(int layer = FirstLayer)
double alarmSectorNormal(int layer = FirstLayer)
double alarmSectorWarning(int layer = FirstLayer)
double alarmSectorWarningHigh(int layer = FirstLayer)
QString cdpStyle()
virtual QColor errorColor(int layer = FirstLayer)
virtual QColor fillColor(int layer = FirstLayer)
virtual bool fillEnabled(int layer = FirstLayer)
virtual double fillOffset(int layer = FirstLayer)
virtual double fillStartValue(int layer = FirstLayer)
virtual double fillWidth(int layer = FirstLayer)
virtual AspectRatio getAspectRatio()
virtual MeterType getMeterType()
virtual CDPBaseTickMarks::NumPrecision getPrecisionMethod(int layer = FirstLayer)
virtual bool isCustom()
virtual int majorTickLength(int layer = FirstLayer)
virtual int majorTickWidth(int layer = FirstLayer)
virtual int majorTicks(int layer = FirstLayer)
virtual double maxValue(int layer = FirstLayer)
virtual double minValue(int layer = FirstLayer)
virtual int minorTickLength(int layer = FirstLayer)
virtual int minorTickWidth(int layer = FirstLayer)
virtual int minorTicks(int layer = FirstLayer)
virtual bool needleEnabled(int layer = FirstLayer)
virtual int needleStyle(int layer = FirstLayer)
virtual QColor normalColor(int layer = FirstLayer)
virtual const QFont &numFont(int layer = FirstLayer)
virtual int numOffset(int layer = FirstLayer)
virtual QString numPostfix(int layer = FirstLayer)
virtual bool numShow(int layer = FirstLayer)
virtual int precision(int layer = FirstLayer)
virtual QString routing()
virtual void setAlarmSectorLimit(bool enable, int layer = FirstLayer)
virtual void setAspectRatio(AspectRatio ratio)
void setCdpStyle(QString routing)
virtual void setErrorColor(QColor color, int layer = FirstLayer)
virtual void setFillColor(const QColor &color, int layer = FirstLayer)
virtual void setFillEnabled(bool enable, int layer = FirstLayer)
virtual void setFillOffset(double offset, int layer = FirstLayer)
virtual void setFillStartValue(double value, int layer = FirstLayer)
virtual void setFillWidth(double width, int layer = FirstLayer)
virtual void setMajorTickLength(int length, int layer = FirstLayer)
virtual void setMajorTickWidth(int width, int layer = FirstLayer)
virtual void setMajorTicks(int ticks, int layer = FirstLayer)
virtual void setMeterType(MeterType type)
virtual void setMinorTickLength(int length, int layer = FirstLayer)
virtual void setMinorTickWidth(int width, int layer = FirstLayer)
virtual void setMinorTicks(int ticks, int layer = FirstLayer)
virtual void setNeedleEnabled(bool enable, int layer = FirstLayer)
virtual void setNormalColor(QColor color, int layer = FirstLayer)
virtual void setNumFont(const QFont &value, int layer = FirstLayer)
virtual void setNumOffset(int value, int layer = FirstLayer)
virtual void setNumPostfix(QString postfix, int layer = FirstLayer)
virtual void setNumShow(bool show, int layer = FirstLayer)
virtual void setPrecision(int value, int layer = FirstLayer)
virtual void setPrecisionMethod(CDPBaseTickMarks::NumPrecision value, int layer = FirstLayer)
virtual void setRouting(QString routing)
virtual void setShowAlarms(bool show, int layer = FirstLayer)
virtual void setShowTicks(bool show, int layer = FirstLayer)
virtual void setSvgFile(const QString &svg)
virtual void setSvgUpdateAll(bool show)
virtual void setTickColor(const QColor &color, int layer = FirstLayer)
virtual void setTickOffset(double offset, int layer = FirstLayer)
virtual void setUnitCircle(bool unitCircle, int layer = FirstLayer)
virtual void setUnitCircleShowMin(bool showMin, int layer = FirstLayer)
virtual void setWarningColor(QColor color, int layer = FirstLayer)
virtual void setWarningHighColor(QColor color, int layer = FirstLayer)
virtual bool showAlarms(int layer = FirstLayer)
virtual bool showTicks(int layer = FirstLayer)
virtual QString svgFile()
virtual bool svgUpdateAll()
virtual const QString &textPrefix()
virtual const QString &textSuffix()
virtual QColor tickColor(int layer = FirstLayer)
virtual double tickOffset(int layer = FirstLayer)
virtual bool unitCircle(int layer = FirstLayer)
virtual bool unitCircleShowMin(int layer = FirstLayer)
virtual double value(int layer = FirstLayer, bool limited = true)
virtual double valueMaxError(int layer = FirstLayer)
virtual double valueMaxNormal(int layer = FirstLayer)
virtual double valueMaxWarning(int layer = FirstLayer)
virtual double valueMaxWarningHigh(int layer = FirstLayer)
virtual double valueMinError(int layer = FirstLayer)
virtual double valueMinNormal(int layer = FirstLayer)
virtual double valueMinWarning(int layer = FirstLayer)
virtual double valueMinWarningHigh(int layer = FirstLayer)
virtual QColor warningColor(int layer = FirstLayer)
virtual QColor warningHighColor(int layer = FirstLayer)
  • 8 public functions inherited from CDPBaseWidget
  • 17 public functions inherited from CDPBaseCom
  • 4 public functions inherited from CDPBaseControlVisible

Public Slots

QSize minimumSizeHint() const override
virtual void setAlarmSectorCenter(double value, int layer = FirstLayer)
virtual void setAlarmSectorError(double value, int layer = FirstLayer)
virtual void setAlarmSectorNormal(double value, int layer = FirstLayer)
virtual void setAlarmSectorWarning(double value, int layer = FirstLayer)
virtual void setAlarmSectorWarningHigh(double value, int layer = FirstLayer)
virtual void setMaxValue(double max, int layer = FirstLayer)
virtual void setMinValue(double min, int layer = FirstLayer)
virtual void setNeedleStyle(int style, int layer = FirstLayer)
virtual void setTextPrefix(const QString &text)
virtual void setTextSuffix(const QString &text)
virtual void setValue(double value)
void setValue(double value, int layer)
virtual void setValueMaxError(double value, int layer = FirstLayer)
virtual void setValueMaxNormal(double value, int layer = FirstLayer)
virtual void setValueMaxWarning(double value, int layer = FirstLayer)
virtual void setValueMaxWarningHigh(double value, int layer = FirstLayer)
virtual void setValueMinError(double value, int layer = FirstLayer)
virtual void setValueMinNormal(double value, int layer = FirstLayer)
virtual void setValueMinWarning(double value, int layer = FirstLayer)
virtual void setValueMinWarningHigh(double value, int layer = FirstLayer)
virtual void setWidgetFont(const QString &font)
virtual void setWidgetStyle(int style)
virtual void setWidgetTheme(const QString &theme)
QSize sizeHint() const override
  • 10 public slots inherited from CDPBaseWidget

Protected Functions

virtual void ensureLayerInMap(int layer)
virtual int heightForWidth(int w) const
QSizeF initCoordinateSystem(QPainter &painter, QRectF &rect)
virtual void loadPixmaps(bool skipSVG = false)
void loadSvg(bool skipColor = false)
virtual void paintEvent(QPaintEvent *ev)
void processSvgFile(QString svg)
void renderPixmapFromMap(QPixmap &pix, ParserSVG::StyleMap &map, QSizeF &widgetToSvgScaling, bool bCreateNewPix = true)
virtual void resizeEvent(QResizeEvent *ev)
virtual void updateAlarmValues(int layer = FirstLayer)
virtual void updateAlarmsFromSector(int layer = FirstLayer, bool bUpdate = true)
virtual void updateMeterData()
virtual void updateWidgetToSvgScaling()
virtual QString valueText(int layer = FirstLayer, bool limited = true)
  • 4 protected functions inherited from CDPBaseCom
  • 1 protected function inherited from CDPBaseControlVisible

Additional Inherited Members

  • 1 signal inherited from CDPBaseWidget
  • 2 static public members inherited from CDPBaseCom

Detailed Description

The Meter is a classic gauge widget supporting alarms, ticks, decimal numbers and lots of properties for styling/customizing the widget.

The meter is based on svg, but most visual features can be overridden by properties.

All widgets support controlling any class property of string or numeric types using routing. When there is no routing property available for a certain feature, we can add it using a Dynamic Property. For more information about this, see the Design Mode Manual regarding Dynamic Routing.

Styling by SVG

Use the svgFile property to style the widget using a svg file. Styling by svg enables switching between different themes in runtime (as long as the files are placed at identical locations within theme directories).

Main element structure

The following tree view shows the svg structure that can be used on the CDPBaseMeter.

svg
└─── Layer1
      ├─── cdpTop               (element group)
      │     ├─── < Path >       (transparent rect/path)
      │     └─── < Group >      (graphics)
      ├─── cdpNeedleCenterCW    (transparent rect/path)
      ├─── cdpNeedleMin         (transparent rect/path)
      ├─── cdpNeedleMax         (transparent rect/path)
      ├─── cdpNeedleGraphics    (element group)
      │     ├─── cdpRectOutline (transparent rect/path)
      │     ├─── cdpRectCenter  (transparent rect/path)
      │     └─── < Group >      (graphics)
      ├─── cdpTextValue         (element group)
      │     ├─── < Path >       (transparent rect/path)
      │     └─── < Text >       (text)
      ├─── cdpTextPrefix        (element group)
      │     ├─── < Path >       (transparent rect/path)
      │     └─── < Text >       (text)
      ├─── cdpTextSuffix        (element group)
      │     ├─── < Path >       (transparent rect/path)
      │     └─── < Text >       (text)
      ├─── cdpTicksNumber       (text)
      ├─── cdpTicksColor        (text)
      ├─── cdpTicksMinorNo3T    (transparent rect/path)
      ├─── cdpTicksMajorNo9T    (transparent rect/path)
      ├─── cdpTicksOffset       (transparent rect/path)
      ├─── cdpTicksNumOffset    (transparent rect/path)
      ├─── cdpTicksNumRect      (transparent rect/path)
      ├─── cdpTicksMajorSize    (transparent rect/path)
      ├─── cdpTicksMinorSize    (transparent rect/path)
      ├─── cdpFillColor         (text)
      ├─── cdpFillOffset        (transparent rect/path)
      ├─── cdpFillWidth         (transparent rect/path)
      └─── cdpBackground        (element group or rect/path)
            ├─── < Path >       (transparent rect/path)
            └─── < Group >      (graphics)

The following table explains the named elements in more detail. All elements showing in bold are required for the widget to show correctly.

PropertyTypeDescription
cdpToprect or an element group containing a rectThe cdpTop element should contain graphics like glass or similar to be painted on top of other graphics in the svg. To ensure that the svg parser gets the correct size (and aspect ratio), we have to place a transparent rect along with the graphics within a group element.
cdpNeedleCenterCWrectThe center of this rectangle should be placed at the rotation point of the cdpNeedle graphics Note that to get counter clock wise rotation (from min to max) the name of this element must be changed to cdpNeedleCenterCCW.
cdpNeedleMinrectThe center of this rect should be placed at the minimum position that the needle can move to (tip of the needle will ne placed at the center of the point).
cdpNeedleMaxrectThe center of this rect should be placed at the maximum position that the needle can move to (tip of the needle will ne placed at the center of the point).
cdpNeedleGraphicsgroup containing rects for outline and needle center in a group containing the actual graphicsThe transparent rect describing the needle size must be named cdpRectOutline while the needle center must be named cdpRectCenter. The group containing the actual graphics doesn't require a name. Draw the needle pointing upwards.

Skipping this element makes the widget unable to show ticks.

Users should take note that drawing a tiny needle on a big sized meter might scale the needle width below 1 px when the meter is scaled down. Alarms and ticks will disappear when this happens.

cdpTextValuegroup containing rect and textThe value of the meter will get placed within this rect and get color and size similar to the the text element. Styles added in layer, Styles, are only supported in meters with one needle.
cdpTextPrefixgroup containing rect and textThe prefix or main text of the meter will get placed within this rect and get color and size similar to the the text element.
cdpTextSuffixgroup containing rect and textThe suffix text of the meter will get placed within this rect and get color and size similar to the the text element.

Meters with multiple needles can use this element in all layers to show the suffix in different positions. When used on multiple needles, suffix styles will get overwritten by the layer suffixes.

cdpTicksNumbertextThis text enables tick numbers and sets font color and size (font family is read from the interface). Note that though this element is not present, tick numbers can be enabled using the numShow widget property.
cdpTicksColortextThis text enables ticks and sets the tick color. Note that though this element is not present, ticks can be enabled using the 'ticksShow' widget property.
cdpTicksMinorNo3TrectThe number between 'No' and 'T' is the default number of minor ticks (between major ticks).
cdpTicksMajorNo9TrectThe number between 'No' and 'T' is the default number of minor ticks (between major ticks).
cdpTicksOffsetrectOffset between the needle point and the tick. Add the word "Negative" to the name for negative direction.
cdpTicksNumOffsetrectOffset between tick and number. Add the word "Negative" to the name for negative direction.
cdpTicksNumRectrectThe max width of the tick numbers. When the limit is reached, numbers will get scaled down to fit this width. The element is optional, but when not present, a large maxValue might make the meter look weird if the background is not designed for it.
cdpTicksMajorSizerectThe rect specifies the width and height of the major ticks. Add the word "Negative" to the name for negative direction.
cdpTicksMinorSizerectThe rect specifies the width and height of the minor ticks. Add the word "Negative" to the name for negative direction.
cdpFillColortextThis text enables fill sector and sets the fill color. Note that though this element is not present, fill sector can be enabled using the CDPBaseMeter::fill widget property. The user will then have to specify the color manually in CDPBaseMeter::fillColor.
cdpFillOffsetrectThe height of this rect specifies the offset from needle tip to the edge of the fill sector. When fillOffset is not set, CDPBaseMeter::ticksOffset will be used instead. Similar to the other offset elements, negative direction is set by adding "Negative" to the name.
cdpFillWidthrectThe height of this rect specifies the thickness/width of the fill sector. When fill width is not set, CDPBaseMeter::ticksMinorLength will be used instead.
cdpBackgroundrect or an element group containing a rectThe cdpBackground should contain the actual background graphics. To ensure that the svg parser gets the correct background size (and aspect ratio), we have to place a transparent rect along with the graphics within a group element.

Style element structure

The meter supports the following structure for styles.

svg
└─── Styles
      ├─── cdpTopStyleX         (element group)
      │     ├─── < Path >       (transparent rect/path)
      │     └─── < Group >      (graphics)
      ├─── cdpMiddleStyleX      (element group)
      │     ├─── < Path >       (transparent rect/path)
      │     └─── < Group >      (graphics)
      ├─── cdpNeedle1StyleX     (element group)
      │     ├─── < Path >       (transparent rect/path)
      │     └─── < Group >      (graphics)
      ├─── cdpTextValueStyleX   (text)
      ├─── cdpTextPrefixStyleX  (text)
      ├─── cdpTextSuffixStyleX  (text)
      ├─── cdpTextScaleStyleX   (text)
      └─── cdpBackgroundStyleX  (element group or rect/path)
            ├─── < Path >       (transparent rect/path)
            └─── < Group >      (graphics)
PropertyTypeDescription
cdpNeedle1StyleXelement group containing a rectNeedle styles are currently only supported for the needles in Layer 1 and 2. The style elements are drawn using the same guidelines as cdpNeedleGraphics in the main element structure, but do not require the special named rects other than a rect for outline that can be named anything. Center position will be read from the main needle.

Adding an element named cdpNeedle1Style0 will override the default main needle. This will make the main needle show only when adding a widget style number that does not exist in the svg. The most common thing to do is adding style elements starting at 1 (cdpNeedle1Style1) and keeping the main needle for style 0.

cdpTextSuffixStyleXtextSuffix styles are currently only supported for the needle in Layer 1. When a meter has more than one needle, suffix elements in other layers will override styles with similar numbers.

Note: The art boards of the document must be identical to the bacground rect unless wanting to offset contents like ticks, numbers and needle. In Adobe Illustrator, the artboards are edited in document setup.

Member Type Documentation

enum CDPBaseMeter::AspectRatio

This enum type specifies how to handle aspect ratio:

ConstantValueDescription
CDPBaseMeter::Unlocked0Sets no aspect ratio. This can make the widget look undesirable, because the “ticks” uses the coordinates of the svg.
CDPBaseMeter::Locked1Sets aspect ratio as specified by the original sized svg.
CDPBaseMeter::HeightForWidth2Sets the default height identical to the width, but in most cases this option will be identical to “Locked”.

typedef CDPBaseMeter::MeterDataMap

typedef CDPBaseMeter::MeterSvgMap

enum CDPBaseMeter::MeterType

This enum type specifies a styling type:

ConstantValueDescription
CDPBaseMeter::Custom0Style by svg file (enables svgFile property).
CDPBaseMeter::Round1Generates stylesheet with color.
CDPBaseMeter::RoundScaleRight2No custom styling (enables styleSheet property).
CDPBaseMeter::GMT3Style by css file (enables cssFile property).

typedef CDPBaseMeter::NeedleEnabledMap

Property Documentation

ErrorColor : QColor

This property holds the color for error indicator.

Access functions:

virtual QColor errorColor(int layer = FirstLayer)
virtual void setErrorColor(QColor color, int layer = FirstLayer)

NormalColor : QColor

This property holds the color for normal indicator.

Access functions:

virtual QColor normalColor(int layer = FirstLayer)
virtual void setNormalColor(QColor color, int layer = FirstLayer)

WarningColor : QColor

This property holds the color for warning indicator.

Access functions:

virtual QColor warningColor(int layer = FirstLayer)
virtual void setWarningColor(QColor color, int layer = FirstLayer)

WarningHighColor : QColor

This property holds the color for warning high indicator.

Access functions:

virtual QColor warningHighColor(int layer = FirstLayer)
virtual void setWarningHighColor(QColor color, int layer = FirstLayer)

alarmSectorLimit : bool

This property holds whether or not to limit the alarm sectors to the meter min/max values.

Access functions:

virtual bool alarmSectorLimit(int layer = FirstLayer)
virtual void setAlarmSectorLimit(bool enable, int layer = FirstLayer)

alarmShow : bool

This property holds whether or not to show the alarm indicators.

Access functions:

virtual bool showAlarms(int layer = FirstLayer)
virtual void setShowAlarms(bool show, int layer = FirstLayer)

aspectRatio : AspectRatio

This property holds the aspect ratio of the widget.

Access functions:

virtual AspectRatio getAspectRatio()
virtual void setAspectRatio(AspectRatio ratio)

cdpOfflineValue : const double

This property holds the value to show when communication is offline and cdpOfflineValueEnabled is set to true.

The property has no effect when cdpOfflineValueEnabled is set to false.

See also cdpOfflineValueEnabled.

cdpOfflineValueEnabled : const bool

This property holds whether or not to show cdpOfflineValue when communication is offline.

Setting the property to false will make the widget keep/show the last value when communication is down.

See also cdpOfflineValue.

cdpRouting : QString

This property holds when wanting to display a cdp object in the widget, this property specifies its full name.

Access functions:

virtual QString routing()
virtual void setRouting(QString routing)

cdpScaling : const double

This property holds the factor to multiply the incoming signal/property value.

cdpStyleRouting : QString

Set the routing of the CDP object that are to change the widget svg style. Note that when cdpStyleProperty is empty we assume the object to be a CDPSignal (similar to adding 'Value' in cdpStyleProperty).

Access functions:

QString cdpStyle()
void setCdpStyle(QString routing)

fill : bool

This property holds whether to enable or disable the fill sector.

When the property is not edited, meaning that the property name does not show in bold text in the property pane, the fill sector is enabled automatically based on the SVG file that styles the widget. In other words, it shows whether the SVG is configured to show fill by default.

Setting this property to false, ensures that fill is disabled even though it might be supported by the SVG. This could increase performance on systems with limited resources (as the widget won't need to repaint the fill sector each paint event).

The only reason to set the property true, is in a scenario where the fill should always show. This is useful if you want to set fill sector on a SVG that does not support it by default, and maintain the fill sector when switching between two such themes. Note that having it true while switching between non fill and default fill themes will make the fill color of the latter show for both themes.

Access functions:

virtual bool fillEnabled(int layer = FirstLayer)
virtual void setFillEnabled(bool enable, int layer = FirstLayer)

See also fillOffset, fillWidth, and fillColor.

fillColor : QColor

This property holds the color to fill the sector from min to current value.

Setting the property to any color will enable fill, while pressing the reset button next to the property will disable it.

Note that switching theme will override any manual color configuration. To make a fill color stick when switching theme, this have to be added to the SVG file as described in the meter styling guide.

Access functions:

virtual QColor fillColor(int layer = FirstLayer)
virtual void setFillColor(const QColor &color, int layer = FirstLayer)

See also fillOffset and fillWidth.

fillOffset : double

This property holds the offset from needle tip to the edge of the fill sector.

When fillOffset is not set, CDPBaseMeter::ticksOffset will be used instead.

Set CDPBaseMeter::svgUpdateAll to false to make properties like offset stick when switching themes. When false, only properties that affect colors will get updated from the SVG.

Access functions:

virtual double fillOffset(int layer = FirstLayer)
virtual void setFillOffset(double offset, int layer = FirstLayer)

See also fillColor and fillWidth.

fillStartValue : double

This property holds the value of the fill starting point.

The property defaults to minimum value when it has not been edited (showing in regular font in the property pane)

Access functions:

virtual double fillStartValue(int layer = FirstLayer)
virtual void setFillStartValue(double value, int layer = FirstLayer)

fillWidth : double

This property holds the tickness/width of the fill sector.

When fillWidth is not set, CDPBaseMeter::ticksMinorLength will be used instead.

Set CDPBaseMeter::svgUpdateAll to false to make properties like fill width stick when switching themes. When false, only properties that affect colors will get updated from the SVG.

Access functions:

virtual double fillWidth(int layer = FirstLayer)
virtual void setFillWidth(double width, int layer = FirstLayer)

See also fillColor and fillOffset.

maxValue : double

This property holds the value at the end of the meter.

Access functions:

virtual double maxValue(int layer = FirstLayer)
virtual void setMaxValue(double max, int layer = FirstLayer)

meterType : MeterType

This property holds meter type, have to be set to “Custom” to be able to select custom .SVG file.

Access functions:

virtual MeterType getMeterType()
virtual void setMeterType(MeterType type)

minValue : double

This property holds value at the start of the meter.

Access functions:

virtual double minValue(int layer = FirstLayer)
virtual void setMinValue(double min, int layer = FirstLayer)

needle : bool

Access functions:

virtual bool needleEnabled(int layer = FirstLayer)
virtual void setNeedleEnabled(bool enable, int layer = FirstLayer)

needleStyle : int

Access functions:

virtual int needleStyle(int layer = FirstLayer)
virtual void setNeedleStyle(int style, int layer = FirstLayer)

numFont : QFont

This property holds the font type for the numbers.

Access functions:

virtual const QFont &numFont(int layer = FirstLayer)
virtual void setNumFont(const QFont &value, int layer = FirstLayer)

numOffset : int

This property holds the distance from the numbers to the meter edge.

Access functions:

virtual int numOffset(int layer = FirstLayer)
virtual void setNumOffset(int value, int layer = FirstLayer)

numPostfix : QString

This property holds the postfix for the numbers on the meter.

Access functions:

virtual QString numPostfix(int layer = FirstLayer)
virtual void setNumPostfix(QString postfix, int layer = FirstLayer)

numPrecision : int

This property holds the number of decimals to show.

Access functions:

virtual int precision(int layer = FirstLayer)
virtual void setPrecision(int value, int layer = FirstLayer)

numPrecisionMethod : CDPBaseTickMarks::NumPrecision

This property holds the precision method to use on numbers.

[AutoLimited] automatically limits the numbers of decimals to that in numPrecision property. Hides decimals if none is present.

[AutoNoLimit] Do not use the numPrecision property. Hides decimals if none is present..

[Fixed] Always show the number of decimals specified by numPrecision property.

Access functions:

virtual CDPBaseTickMarks::NumPrecision getPrecisionMethod(int layer = FirstLayer)
virtual void setPrecisionMethod(CDPBaseTickMarks::NumPrecision value, int layer = FirstLayer)

numShow : bool

This property holds whether or not to show numbers.

Access functions:

virtual bool numShow(int layer = FirstLayer)
virtual void setNumShow(bool show, int layer = FirstLayer)

svgFile : QString

This property holds the path to the svg file that styles the widget.

The path can be either to a resource or a file on disk.

Note: Resources can be overridden by files on disk with identical names.

Access functions:

virtual QString svgFile()
virtual void setSvgFile(const QString &svg)

svgUpdateAll : bool

This property holds whether to update all properties from svg or only the most important ones.

When this property is false, setting a new svg file will only affect number and tick colors, not properties like number of ticks, tick length and so on.

Access functions:

virtual bool svgUpdateAll()
virtual void setSvgUpdateAll(bool show)

See also ticksMajor, ticksMajorLength, and ticksColor.

textPrefix : QString

This property holds the main text for the meter.

Access functions:

virtual const QString &textPrefix()
virtual void setTextPrefix(const QString &text)

textSuffix : QString

This property holds the unit text for the meter.

Access functions:

virtual const QString &textSuffix()
virtual void setTextSuffix(const QString &text)

ticksColor : QColor

This property holds the color for the ticks.

Access functions:

virtual QColor tickColor(int layer = FirstLayer)
virtual void setTickColor(const QColor &color, int layer = FirstLayer)

ticksMajor : int

This property holds how many major ticks you want.

Access functions:

virtual int majorTicks(int layer = FirstLayer)
virtual void setMajorTicks(int ticks, int layer = FirstLayer)

ticksMajorLength : int

This property holds the length of the major ticks.

Access functions:

virtual int majorTickLength(int layer = FirstLayer)
virtual void setMajorTickLength(int length, int layer = FirstLayer)

ticksMajorWidth : int

This property holds the width of the major ticks.

Access functions:

virtual int majorTickWidth(int layer = FirstLayer)
virtual void setMajorTickWidth(int width, int layer = FirstLayer)

ticksMinor : int

This property holds how many minor ticks you want.

Access functions:

virtual int minorTicks(int layer = FirstLayer)
virtual void setMinorTicks(int ticks, int layer = FirstLayer)

ticksMinorLength : int

This property holds the length of the minor ticks.

Access functions:

virtual int minorTickLength(int layer = FirstLayer)
virtual void setMinorTickLength(int length, int layer = FirstLayer)

ticksMinorWidth : int

This property holds the width of the minor ticks.

Access functions:

virtual int minorTickWidth(int layer = FirstLayer)
virtual void setMinorTickWidth(int width, int layer = FirstLayer)

ticksOffset : double

This property holds the offset between each tick.

Access functions:

virtual double tickOffset(int layer = FirstLayer)
virtual void setTickOffset(double offset, int layer = FirstLayer)

ticksShow : bool

This property holds whether to show or hide the ticks.

Access functions:

virtual bool showTicks(int layer = FirstLayer)
virtual void setShowTicks(bool show, int layer = FirstLayer)

unitCircle : bool

This property holds whether the meter is supposed to cover a full circle.

Set this property to make values like 355 equal -5 (if the range crosses zero).

Access functions:

virtual bool unitCircle(int layer = FirstLayer)
virtual void setUnitCircle(bool unitCircle, int layer = FirstLayer)

unitCircleShowMin : bool

This property holds whether or not to show min value in a full circle where min and max is the same point.

Access functions:

virtual bool unitCircleShowMin(int layer = FirstLayer)
virtual void setUnitCircleShowMin(bool showMin, int layer = FirstLayer)

value : double

This property holds the default value of the meter.

Access functions:

virtual double value(int layer = FirstLayer, bool limited = true)
virtual void setValue(double value)
void setValue(double value, int layer)

valueMaxError : double

This property holds the max value of the error indicator.

Access functions:

virtual double valueMaxError(int layer = FirstLayer)
virtual void setValueMaxError(double value, int layer = FirstLayer)

valueMaxNormal : double

This property holds the max value of the normal indicator.

Access functions:

virtual double valueMaxNormal(int layer = FirstLayer)
virtual void setValueMaxNormal(double value, int layer = FirstLayer)

valueMaxWarning : double

This property holds the max value of the warning indicator.

Access functions:

virtual double valueMaxWarning(int layer = FirstLayer)
virtual void setValueMaxWarning(double value, int layer = FirstLayer)

valueMaxWarningHigh : double

This property holds the max value of the warning high indicator.

Access functions:

virtual double valueMaxWarningHigh(int layer = FirstLayer)
virtual void setValueMaxWarningHigh(double value, int layer = FirstLayer)

valueMinError : double

This property holds the min value of the error indicator.

Access functions:

virtual double valueMinError(int layer = FirstLayer)
virtual void setValueMinError(double value, int layer = FirstLayer)

valueMinNormal : double

This property holds the min value of the normal indicator.

Access functions:

virtual double valueMinNormal(int layer = FirstLayer)
virtual void setValueMinNormal(double value, int layer = FirstLayer)

valueMinWarning : double

This property holds the min value of the warning indicator.

Access functions:

virtual double valueMinWarning(int layer = FirstLayer)
virtual void setValueMinWarning(double value, int layer = FirstLayer)

valueMinWarningHigh : double

This property holds the min value of the warning high indicator.

Access functions:

virtual double valueMinWarningHigh(int layer = FirstLayer)
virtual void setValueMinWarningHigh(double value, int layer = FirstLayer)

Member Function Documentation

CDPBaseMeter::CDPBaseMeter(QWidget *parent = 0, bool bSetMeterType = false)

Default constructs an instance of CDPBaseMeter.

[virtual] CDPBaseMeter::~CDPBaseMeter()

Destroys the instance of CDPBaseMeter. The destructor is virtual.

double CDPBaseMeter::alarmSectorCenter(int layer = FirstLayer)

See also setAlarmSectorCenter().

double CDPBaseMeter::alarmSectorError(int layer = FirstLayer)

See also setAlarmSectorError().

double CDPBaseMeter::alarmSectorNormal(int layer = FirstLayer)

See also setAlarmSectorNormal().

double CDPBaseMeter::alarmSectorWarning(int layer = FirstLayer)

See also setAlarmSectorWarning().

double CDPBaseMeter::alarmSectorWarningHigh(int layer = FirstLayer)

See also setAlarmSectorWarningHigh().

[virtual protected] void CDPBaseMeter::ensureLayerInMap(int layer)

[virtual protected] int CDPBaseMeter::heightForWidth(int w) const

[protected] QSizeF CDPBaseMeter::initCoordinateSystem(QPainter &painter, QRectF &rect)

[virtual] bool CDPBaseMeter::isCustom()

[virtual protected] void CDPBaseMeter::loadPixmaps(bool skipSVG = false)

[protected] void CDPBaseMeter::loadSvg(bool skipColor = false)

[slot] QSize CDPBaseMeter::minimumSizeHint() const

[virtual protected] void CDPBaseMeter::paintEvent(QPaintEvent *ev)

[protected] void CDPBaseMeter::processSvgFile(QString svg)

[protected] void CDPBaseMeter::renderPixmapFromMap(QPixmap &pix, ParserSVG::StyleMap &map, QSizeF &widgetToSvgScaling, bool bCreateNewPix = true)

[virtual protected] void CDPBaseMeter::resizeEvent(QResizeEvent *ev)

[virtual slot] void CDPBaseMeter::setAlarmSectorCenter(double value, int layer = FirstLayer)

See also alarmSectorCenter().

[virtual slot] void CDPBaseMeter::setAlarmSectorError(double value, int layer = FirstLayer)

See also alarmSectorError().

[virtual slot] void CDPBaseMeter::setAlarmSectorNormal(double value, int layer = FirstLayer)

See also alarmSectorNormal().

[virtual slot] void CDPBaseMeter::setAlarmSectorWarning(double value, int layer = FirstLayer)

See also alarmSectorWarning().

[virtual slot] void CDPBaseMeter::setAlarmSectorWarningHigh(double value, int layer = FirstLayer)

See also alarmSectorWarningHigh().

[virtual slot] void CDPBaseMeter::setWidgetFont(const QString &font)

[virtual slot] void CDPBaseMeter::setWidgetStyle(int style)

[virtual slot] void CDPBaseMeter::setWidgetTheme(const QString &theme)

[slot] QSize CDPBaseMeter::sizeHint() const

[virtual protected] void CDPBaseMeter::updateAlarmValues(int layer = FirstLayer)

[virtual protected] void CDPBaseMeter::updateAlarmsFromSector(int layer = FirstLayer, bool bUpdate = true)

[virtual protected] void CDPBaseMeter::updateMeterData()

[virtual protected] void CDPBaseMeter::updateWidgetToSvgScaling()

[virtual protected] QString CDPBaseMeter::valueText(int layer = FirstLayer, bool limited = true)

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2025 CDP Technologies. Privacy and cookie policy.

Return to top