Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-105519

Add a valueUpdated(QVariant value) signal for QOpcUaNode

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.3.1
    • OpcUA

    Description

      In most cases, only a change in the "Value" attribute is of interest.
       
      There is already a function to get the value of the "Value" attribute ("QVariant QOpcUaNode::valueAttribute() const") it would make sense to have a signal for detecting changes in the variable value.
       
      The now existing signal attributeUpdated(QOpcUa::NodeAttribute attr, QVariant value) triggers for every kind of attribute. Therefore, you always have to check in the SLOT what kind of attribute has been changed. A direct SIGNAL/SLOT (QOpcUANode/QSpinBox) connection is not possible because you have to evaluate the attribute first.
       
      A new SIGNAL valueUpdated(QVariant value) would simplify this.
      The valueUpdated(QVariant value) signal is only triggered for the "Value" attribute.
       
      The attached source code includes the needed changes to add the signal.
       
      Below is a simple example, printValue(QVariant value) returns the fill level of a tank, for example.
       
      slot:
      void MyClass::printValue(QVariant value)

      {    qDebug("The value: %d",value.toInt); }

       
      /* Example with current Signals */
       
      void MyClass::printValue(QOpcUa::NodeAttribute attr, QVariant value){
         if(attr == QOpcUa::NodeAttribute::Value)

      {       printValue(value.toInt());    }

      }
      connect(mOpcNode, &QOpcUaNode::attributeUpdated, spin, &MyClass::printValue);
       
      /* Example with new signal valueUpdated() */
      connect(mOpcNode, &QOpcUaNode::valueUpdated, this, &MyClass::printValue);

      Attachments

        Activity

          People

            fmeerkoetter Frank Meerkötter
            tuomas.vaarala Tuomas Vaarala
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: