How to use tango within Qtcreator

108 views Asked by At

I have just started using Qt creator. I have created a simple form in QT4 designer and I used python for it. It is a simple form with two fields and a button. These two fields populate values from the device that I have defined in my jive.I am using the following statement in python to read the values from the device:

taurus.Attribute('device_name/instance_name/attribute_name').getDisplayValue()

This statement fetches the value of the attribute and I am appending this value to the text fields I have on the form.I have an "import taurus" statement in my python code.I am trying to do the similar thing in C++ but I am not sure on how we can read the values from the device defined in jive. So could you let me know how this can be achieved.

1

There are 1 answers

0
Yoann Quenach de Quivillic On

This question is really framework-specific. There isn't many Tango users on StackOverflow. Have a look at the QTango documentation on QTWatcher and QTWriter.

Here is a basic example where the attribute value from your device is linked to a ProgressBar:

QProgressBar *pbar = new QProgressBar(this);
QTWatcher *pbarWatcher = new QTWatcher(this);
pbarWatcher­->attach(pbar, SLOT(setValue(int)));
// configure maximum and minimum values when available
pbarWatcher­->setAutoConfSlot(QTWatcher::Min, SLOT(setMinimum(int)));
pbarWatcher-­>setAutoConfSlot(QTWatcher::Max, SLOT(setMaximum(int)));
pbarWatcher­->setSource("$1/short_scalar_ro");