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

NodeTree Class

The Node Tree is used to list nodes on a specified routing More...

Header: #include <NodeTree>
  • List of all members, including inherited members

Public Types

enum SendMethod { onSelectionChanged, onSlotOnly }

Properties

  • cdpTargetRouting : QString
  • columns : QStringList
  • columnsPrecision : QStringList
  • columnsToHide : QStringList
  • columnsWidth : QStringList
  • modelFilter : QStringList
  • sendColumn : QString
  • sendEscapingEnabled : bool
  • sendMethod : SendMethod

Public Functions

NodeTree(QWidget *parent = nullptr)
QString cdpTargetRouting() const
QStringList columns() const
QStringList columnsPrecision() const
QStringList columnsToHide() const
QStringList columnsWidth() const
QStringList modelFilter() const
QString sendColumn() const
bool sendEscapingEnabled() const
SendMethod sendMethod() const
virtual void setColumns(const QStringList &columns)
virtual void setColumnsPrecision(const QStringList &columns)
virtual void setColumnsToHide(const QStringList &columns)
virtual void setColumnsWidth(const QStringList &columns)
virtual void setModelFilter(const QStringList &modelTypes)
void setSendColumn(QString column)
void setSendEscapingEnabled(bool enabled)
void setSendMethod(SendMethod method)

Public Slots

virtual void sendSelections()
virtual void setCdpTargetRouting(const QString &routing)
virtual void setFilterString(const QString &filter)
void updateColumnsWidth()

Signals

void selectedNodeChanged(QString)
void selectedNodeChanged(QStringList)
void selectedNodeChangedEncoded(QString)
void selectedNodeChangedEncoded(QStringList)
void selectedNodeFullPathChanged(QString)

Protected Functions

void createModel()
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override

Detailed Description

The Node Tree is used to list nodes on a specified routing

The target routing is configured in the cdpTargetRouting property and nodes are filtered based on the model types specified in the modelFilter property.

The data to show for each node is configured in the columns property.

The widget supports selection and emitting one or more items using widget signals as described in the below list. Use the selectionMode property to enable or disable the selection of multiple items by setting it to SingleSelection or MultiSelection. The sendMethod property decides whether to emit the selections directly or to use the sendSelections() slot. The signals emit the node name by default, but this can be changed using the property named sendColumn.

Widget SignalDescription
selectedNodeChanged(QString)The text/column of the selected items, using ";" as separator when there are more than one item. Editing the sendColumn property will enable sending a different column than Name.
selectedNodeFullPathChanged(QString)This is identical to selectedNodeChanged, but will add cdpTargetRouting + "." as prefix on each item.

The widget contains slots for setting target routing, item filtering, and triggering the selection signals to emit as described below.

Widget SlotDescription
sendSelections()This slot triggers the selection signals to get emitted.
setCdpTargetRouting(QString)This slot can be used to switch the target routing in runtime.
setFilterString(QString)This slot is usually connected from a text input widget, like the Line Edit, to filter what items to show in the list. Useful when there are lots of items and hard to locate the correct one.

The widget is styled by the main window style sheet. This can be overridden in the widget styleSheet property or by using a CDPBaseContainer configured with CSS styling. Using the latter method and having separate CSS files for different themes will allow correct styling when themes are switched in runtime. The below snippet shows an example of CSS styling.

QHeaderView::section {
  background-color: #EDF0F3;
  border: 0px solid #6c6c6c;
  color: #48505A;
  border-bottom: 1px solid #d4d8dc;
}

QTableView {
  background: #EDF0F3;
  alternate-background-color: #F2F4F6;
  color: #48505A;
  border: 0px solid #EDF0F3;
  selection-color: #ffffff;
  selection-background-color: #3399CC;
}

Note: The searching of nodes was added for native GUI in CDP 4.12

Member Type Documentation

enum NodeTree::SendMethod

Property Documentation

cdpTargetRouting : QString

This property holds the target routing to search for nodes.

Access functions:

QString cdpTargetRouting() const
virtual void setCdpTargetRouting(const QString &routing)

columns : QStringList

This property holds the node data objects to show as columns.

Access functions:

QStringList columns() const
virtual void setColumns(const QStringList &columns)

columnsPrecision : QStringList

This property holds a list of column names along with the number of decimals they should use when displaying numeric data The format of the list item is "Name=X", where "Name" is the column name and "X" is the number of decimals.

Access functions:

QStringList columnsPrecision() const
virtual void setColumnsPrecision(const QStringList &columns)

columnsToHide : QStringList

This property holds a list of columns to hide if configured in the columns property The property is useful if you want to emit column data of a selected row without showing the actual column.

Access functions:

QStringList columnsToHide() const
virtual void setColumnsToHide(const QStringList &columns)

columnsWidth : QStringList

This property holds a list of column names along with the initial width the column should have in the table The format of the list item is "Name=X", where "Name" is the column name and "X" is the column pixel width.

Access functions:

QStringList columnsWidth() const
virtual void setColumnsWidth(const QStringList &columns)

modelFilter : QStringList

This property holds a list of model types that the table accepts and shows.

Access functions:

QStringList modelFilter() const
virtual void setModelFilter(const QStringList &modelTypes)

sendColumn : QString

This property holds the column to emit in the selection signals.

Access functions:

QString sendColumn() const
void setSendColumn(QString column)

sendEscapingEnabled : bool

This property holds whether or not to escape quotations in the data emitted using the node selection signals.

Access functions:

bool sendEscapingEnabled() const
void setSendEscapingEnabled(bool enabled)

sendMethod : SendMethod

This property holds whether to emit selections directly or trigger this by the slot named sendSelections.

Access functions:

SendMethod sendMethod() const
void setSendMethod(SendMethod method)

Member Function Documentation

NodeTree::NodeTree(QWidget *parent = nullptr)

Default constructs an instance of NodeTree.

[protected] void NodeTree::createModel()

[signal] void NodeTree::selectedNodeChanged(QString)

Note: Signal selectedNodeChanged 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(nodeTree, static_cast<void(NodeTree::*)(QString)>(&NodeTree::selectedNodeChanged),
    [=](QString ){ /* ... */ });

[signal] void NodeTree::selectedNodeChanged(QStringList)

Note: Signal selectedNodeChanged 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(nodeTree, static_cast<void(NodeTree::*)(QStringList)>(&NodeTree::selectedNodeChanged),
    [=](QStringList ){ /* ... */ });

[signal] void NodeTree::selectedNodeChangedEncoded(QString)

Note: Signal selectedNodeChangedEncoded 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(nodeTree, static_cast<void(NodeTree::*)(QString)>(&NodeTree::selectedNodeChangedEncoded),
    [=](QString ){ /* ... */ });

[signal] void NodeTree::selectedNodeChangedEncoded(QStringList)

Note: Signal selectedNodeChangedEncoded 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(nodeTree, static_cast<void(NodeTree::*)(QStringList)>(&NodeTree::selectedNodeChangedEncoded),
    [=](QStringList ){ /* ... */ });

[signal] void NodeTree::selectedNodeFullPathChanged(QString)

[protected] void NodeTree::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)

[virtual slot] void NodeTree::sendSelections()

[virtual slot] void NodeTree::setFilterString(const QString &filter)

[slot] void NodeTree::updateColumnsWidth()

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