NodeList Class
The Node List is used to list nodes on a specified routing More...
Header: | #include <CDPBaseWidgets/NodeList.h> |
Public Types
enum | SendMethod { onSelectionChanged, onSlotOnly } |
Properties
|
|
Public Functions
NodeList(QWidget *parent = nullptr) | |
QString | cdpTargetRouting() const |
QString | column() const |
int | columnPrecision() const |
QStringList | forceNodes() const |
QStringList | modelFilter() const |
bool | sendEscapingEnabled() const |
SendMethod | sendMethod() const |
virtual void | setColumn(const QString &name) |
virtual void | setColumnPrecision(int precision) |
virtual void | setForceNodes(const QStringList &nodes) |
virtual void | setModelFilter(const QStringList &modelTypes) |
void | setSendEscapingEnabled(bool enabled) |
void | setSendMethod(SendMethod method) |
Public Slots
virtual void | selectRow(int row) |
virtual void | sendSelections() |
virtual void | setCdpTargetRouting(const QString &routing) |
virtual void | setFilterString(const QString &filter) |
Signals
void | indexClicked(int) |
void | selectedIndexChanged(int) |
void | selectedIndexChanged(QString) |
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 List 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 list is configured to show the node name by default, but this can be changed by editing the column 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.
Widget Signal | Description |
---|---|
selectedIndexChanged(int) | The index of the selected item (will only emit when one item is selected). |
selectedIndexStringChanged(QString) | The index of the selected items, using ";" as separator when there are more than one item. |
selectedNodeChanged(QString) | The text/column of the selected items, using ";" as separator when there are more than one item. Editing the column property will enable sending a different column than Name. |
selectedNodeFullPathChanged(QString) | This is similar to selectedNodeChanged, but will add cdpTargetRouting + "." as prefix on each item. |
indexClicked(int) | The index of the clicked item. |
The widget contains slots for setting target routing, item filtering, and triggering the selection signals to emit as described below.
Widget Slot | Description |
---|---|
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 also includes a forceNodes property that ignores the cdpTargetRouting property and forces the items to show in the list.
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.
QListView { background: #fafbfc; alternate-background-color: #edf0f3; color: #48505a; border: 1px solid #e7e9ec; selection-color: #ffffff; selection-background-color: #3399cc; }
Note: The searching of nodes was added for native GUI in CDP 4.12
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) |
column : QString
This property holds the node data object to show in the list.
Access functions:
QString | column() const |
virtual void | setColumn(const QString &name) |
columnPrecision : int
This property holds the column precision to use for numbers. The precision is disabled if set to a negative number.
Access functions:
int | columnPrecision() const |
virtual void | setColumnPrecision(int precision) |
forceNodes : QStringList
This property holds a list of nodes to show in the list.
This is useful when wanting a fixed subset of nodes or for testing within the CDP Studio Design mode.
Access functions:
QStringList | forceNodes() const |
virtual void | setForceNodes(const QStringList &nodes) |
modelFilter : QStringList
This property holds a list of model types that the list accepts and shows.
Access functions:
QStringList | modelFilter() const |
virtual void | setModelFilter(const QStringList &modelTypes) |
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
NodeList::NodeList(QWidget *parent = nullptr)
Default constructs an instance of NodeList.
[protected]
void NodeList::createModel()
[signal]
void NodeList::indexClicked(int)
[virtual slot]
void NodeList::selectRow(int row)
[signal]
void NodeList::selectedIndexChanged(int)
Note: Signal selectedIndexChanged 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(nodeList, static_cast<void(NodeList::*)(int)>(&NodeList::selectedIndexChanged), [=](int ){ /* ... */ });
[signal]
void NodeList::selectedIndexChanged(QString)
Note: Signal selectedIndexChanged 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(nodeList, static_cast<void(NodeList::*)(QString)>(&NodeList::selectedIndexChanged), [=](QString ){ /* ... */ });
[signal]
void NodeList::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(nodeList, static_cast<void(NodeList::*)(QString)>(&NodeList::selectedNodeChanged), [=](QString ){ /* ... */ });
[signal]
void NodeList::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(nodeList, static_cast<void(NodeList::*)(QStringList)>(&NodeList::selectedNodeChanged), [=](QStringList ){ /* ... */ });
[signal]
void NodeList::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(nodeList, static_cast<void(NodeList::*)(QString)>(&NodeList::selectedNodeChangedEncoded), [=](QString ){ /* ... */ });
[signal]
void NodeList::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(nodeList, static_cast<void(NodeList::*)(QStringList)>(&NodeList::selectedNodeChangedEncoded), [=](QStringList ){ /* ... */ });
[signal]
void NodeList::selectedNodeFullPathChanged(QString)
[protected]
void NodeList::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
[virtual slot]
void NodeList::sendSelections()
[virtual slot]
void NodeList::setFilterString(const QString &filter)
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.