• 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
  • CDPBaseClockDigi

CDPBaseClockDigi Class

The Digital Clock is a type of clock that displays the time numerically. More...

Header: #include <CDPBaseClockDigi>
Inherits: StateChanger, CDPBaseControlVisible,
  • List of all members, including inherited members

Public Types

enum ClockSource { OSClock, CDPClock, CDPRouting }
typedef StylingSvgMap
enum StylingType { NoFile, CSS, SVG }

Properties

  • cdpClockRouting : QString
  • cdpClockSource : ClockSource
  • cdpVisibleRouting : const QString
  • cssFile : QString
  • iconDown : QString
  • iconUp : QString
  • stylingType : StylingType
  • svgFile : QString
  • visible : const bool

Public Functions

CDPBaseClockDigi(QWidget *parent = 0)
virtual QString cdpClockRouting()
virtual ClockSource cdpClockSource()
virtual QString cssFile()
virtual QString iconDown()
virtual QString iconUp()
virtual bool isClockSignalSelected()
virtual bool isCssStyling()
virtual bool isSvgStyling()
virtual void setCdpClockRouting(const QString &routing)
virtual void setCdpClockSource(ClockSource source)
virtual void setCssFile(QString cssFile)
void setIQtCDPPointer(IQtCDP *pIQtCDP) override
virtual void setIconDown(QString icon)
virtual void setIconUp(QString icon)
virtual void setStylingType(StylingType type)
virtual void setSvgFile(QString svg)
virtual StylingType stylingType()
virtual QString svgFile()
int widgetStyle()
  • 3 public functions inherited from StateChanger
  • 4 public functions inherited from CDPBaseControlVisible

Public Slots

virtual void handleVisible(double visible)
virtual void hideWidget()
void setInCommand(bool cmd) override
void setSmoothPixmap(bool smooth) override
void setTimeOffsetSecs(double timeOffsetSec) override
void setWidgetFont(const QString &font) override
void setWidgetStyle(int style) override
void setWidgetTheme(const QString &theme) override
virtual void showWidget()

Protected Functions

QString addUrl(QString path)
virtual bool eventFilter(QObject *obj, QEvent *event)
QString generatedStyleSheet()
double globalTimeOffsetMs()
void loadSvg()
virtual void timerEvent(QTimerEvent *event)
void updateDateTime()
void updateDateTimeFromCdpClock()
void updateDateTimeFromCdpSignal()
void updateDateTimeFromOS()
void updateTextColorFromSvg()
  • 1 protected function inherited from CDPBaseControlVisible

Protected Slots

const QString &getCurrentDownIcon(bool isSvg)
const QString &getCurrentUpIcon(bool isSvg)

Detailed Description

The Digital Clock is a type of clock that displays the time numerically.

The clock can show time based on multiple clock sources. In the cdpClockSource property, the user can select to show time based on OS clock, CDP synch protocol or from the CDP object/property routed in cdpClockRouting.

The value routed in via cdpClockRouting is assumed to be a double value containing time since epoch (number of seconds that have passed since 1970-01-01 00:00:00.000, Coordinated Universal Time (UTC).

When clicked, the clock opens a global dialog for setting a local time offset. The time offset will affect other widgets that implements and uses the time offset part of the interface. The Event List and Analog Clock are examples of other widgets that implements the time offset.

Note: that CDPBaseMainWindow includes a property to enable external control of the time offset property as described in the above. The property is named timeOffsetRouting and works in both directions.

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).

The CDPBaseClockDigi supports reading both background image and text color from svg similar to that of CDPBaseLineEdit described here.

Note: The svg doesn't have to include background image though it is supported, but when present, the widget will generate raster images as described here.

Member Type Documentation

enum CDPBaseClockDigi::ClockSource

This enum type specifies what clock source to use for updating time:

ConstantValueDescription
CDPBaseClockDigi::OSClock0Time from the OS.
CDPBaseClockDigi::CDPClock1Time from cdp synch protocol.
CDPBaseClockDigi::CDPRouting2Time from a CDP signal specified by routing.

typedef CDPBaseClockDigi::StylingSvgMap

enum CDPBaseClockDigi::StylingType

This enum type specifies what styling type to use:

ConstantValueDescription
CDPBaseClockDigi::NoFile0No styling file.
CDPBaseClockDigi::CSS1Style by css file.
CDPBaseClockDigi::SVG2Style by SVG file.

Property Documentation

cdpClockRouting : QString

This property holds the routing to the cdp signal that are to control the clock.

The routed value is assumed to be a double value containing time since epoch (number of seconds that have passed since 1970-01-01 00:00:00.000, Coordinated Universal Time (UTC).

Note: routing has to be selected as clock source to enable editing this property.

Access functions:

virtual QString cdpClockRouting()
virtual void setCdpClockRouting(const QString &routing)

See also cdpClockSource.

cdpClockSource : ClockSource

This property holds the clock source to use when showing time on the clock.

The clock can be set from the operating system, cdp time or a cdp signal (for instance to get time from a gps device).

Access functions:

virtual ClockSource cdpClockSource()
virtual void setCdpClockSource(ClockSource source)

cdpVisibleRouting : const QString

This property holds the full path of the signal/parameter to control visible property.

Note: values not equal to 1 are considered false.

See also visible.

cssFile : QString

This property holds the path to the css file (if styling type is set to CSS).

Access functions:

virtual QString cssFile()
virtual void setCssFile(QString cssFile)

See also stylingType and svgFile.

iconDown : QString

This property holds the path to pixmap for down icon.

Access functions:

virtual QString iconDown()
virtual void setIconDown(QString icon)

iconUp : QString

This property holds the path to pixmap for up icon.

Access functions:

virtual QString iconUp()
virtual void setIconUp(QString icon)

stylingType : StylingType

This property holds the styling method to use when styling the widget.

Access functions:

virtual StylingType stylingType()
virtual void setStylingType(StylingType type)

See also cssFile and svgFile.

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(QString svg)

See also stylingType and cssFile.

visible : const bool

This property holds whether to show or hide the widget.

Member Function Documentation

CDPBaseClockDigi::CDPBaseClockDigi(QWidget *parent = 0)

Default constructs an instance of CDPBaseClockDigi.

[protected] QString CDPBaseClockDigi::addUrl(QString path)

[virtual protected] bool CDPBaseClockDigi::eventFilter(QObject *obj, QEvent *event)

[protected] QString CDPBaseClockDigi::generatedStyleSheet()

[protected slot] const QString &CDPBaseClockDigi::getCurrentDownIcon(bool isSvg)

[protected slot] const QString &CDPBaseClockDigi::getCurrentUpIcon(bool isSvg)

[protected] double CDPBaseClockDigi::globalTimeOffsetMs()

[virtual slot] void CDPBaseClockDigi::handleVisible(double visible)

[virtual slot] void CDPBaseClockDigi::hideWidget()

[virtual] bool CDPBaseClockDigi::isClockSignalSelected()

[virtual] bool CDPBaseClockDigi::isCssStyling()

[virtual] bool CDPBaseClockDigi::isSvgStyling()

[protected] void CDPBaseClockDigi::loadSvg()

void CDPBaseClockDigi::setIQtCDPPointer(IQtCDP *pIQtCDP)

[slot] void CDPBaseClockDigi::setInCommand(bool cmd)

[slot] void CDPBaseClockDigi::setSmoothPixmap(bool smooth)

[slot] void CDPBaseClockDigi::setTimeOffsetSecs(double timeOffsetSec)

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

[slot] void CDPBaseClockDigi::setWidgetStyle(int style)

See also widgetStyle().

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

[virtual slot] void CDPBaseClockDigi::showWidget()

[virtual protected] void CDPBaseClockDigi::timerEvent(QTimerEvent *event)

[protected] void CDPBaseClockDigi::updateDateTime()

[protected] void CDPBaseClockDigi::updateDateTimeFromCdpClock()

[protected] void CDPBaseClockDigi::updateDateTimeFromCdpSignal()

[protected] void CDPBaseClockDigi::updateDateTimeFromOS()

[protected] void CDPBaseClockDigi::updateTextColorFromSvg()

int CDPBaseClockDigi::widgetStyle()

See also setWidgetStyle().

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