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

CDPComWidget Class

The Com Widget is a proxy for commucation with control objects using widget signals and slots. More...

Header: #include <CDPComWidget>
Inherits: CDPBaseCom,
  • List of all members, including inherited members

Properties

  • cdpMessageCommand : QString
  • cdpMessageParameter : QString
  • cdpOfflineValue : const double
  • cdpOfflineValueEnabled : const bool
  • cdpRouting : QString
  • cdpScaling : const double
  • emitBitChanged : bool
  • pushRoutables : const QStringList

Public Functions

CDPComWidget(QWidget *parent = 0)
QString cdpMessageCommand() const
QString cdpMessageParameter() const
QString cdpRouting()
bool emitBitChanged()
void setEmitBitChanged(bool enabled)
  • 17 public functions inherited from CDPBaseCom

Public Slots

virtual const QStringList &pushRoutables() const
void sendMessage()
void sendMessage(const QString &parameter)
void sendMessages(const QStringList &parameters)
void sendText(QString value)
void sendTextWhenOnline(const QString &value)
void sendTexts(QStringList values)
void sendValue(double value)
void sendValue(int value)
void sendValue(bool value)
virtual void setCdpMessageCommand(const QString &command)
virtual void setCdpMessageParameter(const QString &parameter)
void setCdpRouting(QString routing)
void setGlobalFont(const QString &font)
void setGlobalInCommand(bool enable = true)
void setGlobalSmoothPixmap(bool smooth = true)
void setGlobalStyle(int style)
void setGlobalStyle(double style)
void setGlobalTheme(const QString &theme)

Signals

void bit00Changed(bool value)
void bit01Changed(bool value)
void bit02Changed(bool value)
void bit03Changed(bool value)
void bit04Changed(bool value)
void bit05Changed(bool value)
void bit06Changed(bool value)
void bit07Changed(bool value)
void bit08Changed(bool value)
void bit09Changed(bool value)
void bit10Changed(bool value)
void bit11Changed(bool value)
void bit12Changed(bool value)
void bit13Changed(bool value)
void bit14Changed(bool value)
void bit15Changed(bool value)
void bit16Changed(bool value)
void bit17Changed(bool value)
void bit18Changed(bool value)
void bit19Changed(bool value)
void bit20Changed(bool value)
void bit21Changed(bool value)
void bit22Changed(bool value)
void bit23Changed(bool value)
void bit24Changed(bool value)
void bit25Changed(bool value)
void bit26Changed(bool value)
void bit27Changed(bool value)
void bit28Changed(bool value)
void bit29Changed(bool value)
void bit30Changed(bool value)
void bit31Changed(bool value)
void connectionChanged(bool value)
void pushRoutablesChanged(const QStringList &pushers)
void valueChanged(double value)
void valueChanged(int value)
void valueChanged(qint64 value)
void valueChanged(uint value)
void valueChanged(QString value)

Protected Functions

void ConnectionChanged(bool bConnected) override
void setIQtCDPPointer(IQtCDP *pIQtCDP) override

Reimplemented Protected Functions

virtual void setValue(double value) override
virtual bool setValue(QString value, bool bScale) override
  • 4 protected functions inherited from CDPBaseCom

Additional Inherited Members

  • 2 static public members inherited from CDPBaseCom

Detailed Description

The Com Widget is a proxy for commucation with control objects using widget signals and slots.

To enable connecting the Com Widget signals to different widget targets, it has multiple signals and slots with different value types, like int, double, bool, and string. The user must take care to use signals and slots that fit the target routed in cdpRouting. For instance, connecting valueChanged(int) does not make sense if the remote variable contains a text.

In addition to setting text and numeric values, the widget contains slots for sending messages. The configuration is done in cdpMessageCommand and the optional cdpMessageParameter properties.

The widget is a container to avoid taking up space in the layouts. Place the widget that is to communicate with the Com Widget inside it and add a layout. Press F4 within the CDP Studio Design mode to enable connection mode, and drag and drop connections. Press F3 to go back to standard edit mode. The additional margins can be removed by setting the widget layout...Margin properties to 0.

The widget supports emitting the different bits in a value using separate widget signals, enabled using the emitBitChanged property.

Note: Use this widget only when standard or dynamic routing properties are not possible. Signal and slot connections are not visible without entering the connection mode in CDP Studio Design mode. Further, duplicating connected widgets requires making new signal and slot connections. This could cause issues maintaining the project.

Property Documentation

cdpMessageCommand : QString

This property holds the text command to set when sending messages using the sendMessage() slots.

Access functions:

QString cdpMessageCommand() const
virtual void setCdpMessageCommand(const QString &command)

See also cdpMessageParameter.

cdpMessageParameter : QString

This property holds an optional parameter to add to the message when sending using the sendMessage() slot.

Access functions:

QString cdpMessageParameter() const
virtual void setCdpMessageParameter(const QString &parameter)

See also cdpMessageCommand.

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 the routing to the cdp object we want to communicate with.

Access functions:

QString cdpRouting()
void setCdpRouting(QString routing)

cdpScaling : const double

This property holds the scaling factor to be used when sending/recieving communication values.

Input-values to the CDPComWidget will be multiplied with this value, output-values will be divided.

emitBitChanged : bool

This property holds whether to emit bits of received value as separate qt signals.

Access functions:

bool emitBitChanged()
void setEmitBitChanged(bool enabled)

pushRoutables : const QStringList

Access functions:

virtual const QStringList &pushRoutables() const

Notifier signal:

void pushRoutablesChanged(const QStringList &pushers)

Member Function Documentation

CDPComWidget::CDPComWidget(QWidget *parent = 0)

Default constructs an instance of CDPComWidget.

[protected] void CDPComWidget::ConnectionChanged(bool bConnected)

[signal] void CDPComWidget::bit00Changed(bool value)

[signal] void CDPComWidget::bit01Changed(bool value)

[signal] void CDPComWidget::bit02Changed(bool value)

[signal] void CDPComWidget::bit03Changed(bool value)

[signal] void CDPComWidget::bit04Changed(bool value)

[signal] void CDPComWidget::bit05Changed(bool value)

[signal] void CDPComWidget::bit06Changed(bool value)

[signal] void CDPComWidget::bit07Changed(bool value)

[signal] void CDPComWidget::bit08Changed(bool value)

[signal] void CDPComWidget::bit09Changed(bool value)

[signal] void CDPComWidget::bit10Changed(bool value)

[signal] void CDPComWidget::bit11Changed(bool value)

[signal] void CDPComWidget::bit12Changed(bool value)

[signal] void CDPComWidget::bit13Changed(bool value)

[signal] void CDPComWidget::bit14Changed(bool value)

[signal] void CDPComWidget::bit15Changed(bool value)

[signal] void CDPComWidget::bit16Changed(bool value)

[signal] void CDPComWidget::bit17Changed(bool value)

[signal] void CDPComWidget::bit18Changed(bool value)

[signal] void CDPComWidget::bit19Changed(bool value)

[signal] void CDPComWidget::bit20Changed(bool value)

[signal] void CDPComWidget::bit21Changed(bool value)

[signal] void CDPComWidget::bit22Changed(bool value)

[signal] void CDPComWidget::bit23Changed(bool value)

[signal] void CDPComWidget::bit24Changed(bool value)

[signal] void CDPComWidget::bit25Changed(bool value)

[signal] void CDPComWidget::bit26Changed(bool value)

[signal] void CDPComWidget::bit27Changed(bool value)

[signal] void CDPComWidget::bit28Changed(bool value)

[signal] void CDPComWidget::bit29Changed(bool value)

[signal] void CDPComWidget::bit30Changed(bool value)

[signal] void CDPComWidget::bit31Changed(bool value)

[signal] void CDPComWidget::connectionChanged(bool value)

[slot] void CDPComWidget::sendMessage()

Send a message to the target specified in cdpRouting using the message text command specified in the cdpMessageCommand property. The parameter specified in the cdpMessageParameter property is sent with the message if not empty. It is added as text and will not get scaled by the scaling factor set in cdpScaling.

Note: Use the sendMessage(QString) slot to send a message using a different parameter than cdpMessageParameter.

[slot] void CDPComWidget::sendMessage(const QString &parameter)

Send a message to the target specified in cdpRouting using the message text command specified in the cdpMessageCommand property. The parameter argument contains a string that will be sent along with the message. It is added as text and will not get scaled by the scaling factor set in cdpScaling.

Note: Use the sendMessage() slot to send a message using the parameter specified in the cdpMessageParameter property.

[slot] void CDPComWidget::sendMessages(const QStringList &parameters)

This slot executes sendMessage for each value provided in the parameters list.

[slot] void CDPComWidget::sendText(QString value)

Use this slot to send a text value to the string property target specified in cdpRouting. The slot does not take scaling into account even when the value can be converted to a number. Use the slots prefixed with sendValue to send numeric values that will get scaled using the scaling factor set in cdpScaling.

[slot] void CDPComWidget::sendTextWhenOnline(const QString &value)

This slot behaves similarly to sendText but buffers the value if the widget is offline, sending it upon reconnection. The buffer holds only one value, ensuring that only the most recent offline value is sent when the widget reconnects.

One use case is connecting and sending values received from the main window at startup. At this early stage, the communication link might not have been established yet.

The slot should be used with caution because values sent by the user while offline may not remain valid once the communication is reestablished.

[slot] void CDPComWidget::sendTexts(QStringList values)

This slot executes sendText for each value provided in the values list.

[slot] void CDPComWidget::sendValue(double value)

[slot] void CDPComWidget::sendValue(int value)

[slot] void CDPComWidget::sendValue(bool value)

[slot] void CDPComWidget::setGlobalFont(const QString &font)

Set global font family for all CDP base widgets that implement this feature.

[slot] void CDPComWidget::setGlobalInCommand(bool enable = true)

Set global in-command by setting enable to true or false. This will disable/enable CDP base widgets that implement this feature.

Note: This feature is usually controlled from the control system.

[slot] void CDPComWidget::setGlobalSmoothPixmap(bool smooth = true)

Set global smooth pixmap transform to true or false. This will disable/enable smoothing after transformations in widgets that implements the feature.

Note: Disabling smooth pixmap transform might improve performance on systems with limited resources, but will also make transformed/rotated pixmaps look pixelated.

[slot] void CDPComWidget::setGlobalStyle(int style)

Set a global widget style number to be used by all CDP base widgets that implement this widget styling.

[slot] void CDPComWidget::setGlobalStyle(double style)

Set a global widget style number to be used by all CDP base widgets that implement this widget styling.

[slot] void CDPComWidget::setGlobalTheme(const QString &theme)

Sets the global theme using the theme name.

[protected] void CDPComWidget::setIQtCDPPointer(IQtCDP *pIQtCDP)

[override virtual protected] void CDPComWidget::setValue(double value)

[override virtual protected] bool CDPComWidget::setValue(QString value, bool bScale)

[signal] void CDPComWidget::valueChanged(double value)

Note: Signal valueChanged is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(cDPComWidget, static_cast<void(CDPComWidget::*)(double)>(&CDPComWidget::valueChanged),
    [=](double value){ /* ... */ });

[signal] void CDPComWidget::valueChanged(int value)

Note: Signal valueChanged is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(cDPComWidget, static_cast<void(CDPComWidget::*)(int)>(&CDPComWidget::valueChanged),
    [=](int value){ /* ... */ });

[signal] void CDPComWidget::valueChanged(qint64 value)

Note: Signal valueChanged is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(cDPComWidget, static_cast<void(CDPComWidget::*)(qint64)>(&CDPComWidget::valueChanged),
    [=](qint64 value){ /* ... */ });

[signal] void CDPComWidget::valueChanged(uint value)

Note: Signal valueChanged is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(cDPComWidget, static_cast<void(CDPComWidget::*)(uint)>(&CDPComWidget::valueChanged),
    [=](uint value){ /* ... */ });

[signal] void CDPComWidget::valueChanged(QString value)

Note: Signal valueChanged is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:

connect(cDPComWidget, static_cast<void(CDPComWidget::*)(QString)>(&CDPComWidget::valueChanged),
    [=](QString value){ /* ... */ });

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