# QT widget to adjust integer values on the fly

**URL:** <https://www.ruby-forum.com/t/qt-widget-to-adjust-integer-values-on-the-fly/234631>\
**Category:** GNU Radio\
**Created:** [March 18, 2015, 5:00pm UTC](https://www.ruby-forum.com/t/qt-widget-to-adjust-integer-values-on-the-fly/234631 "2015-03-18T17:00:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [March 18, 2015, 5:00pm UTC](https://www.ruby-forum.com/t/qt-widget-to-adjust-integer-values-on-the-fly/234631/1 "2015-03-18T17:00:03Z")

</div>

I have a GRC flowgraph that includes a custom C++ block which dumps  
custom vectors out a port, so I use the QT GUI Vector Sink to display  
these.  
The block also requires integer params which I need to adjust while  
the flowgraph is running.

I have a problem, because as near as I can tell…  
a) QT GUI Entry (and QT GUI Label) only display the value, changes the  
user makes to QT GUI Entry while the flowgraph is running do not seem  
to be propogated to the flowgraph block params that use the required  
variable names - which unless I am mistaken here (possible) makes me  
wonder what the point of the Entry is vs the Label - if this is  
incorrect please let me know and I would like to investigate why I do  
not see this happening on my flowgraphs  
b) QT GUI Range seems to always output float values, there is no way  
that I see to set the output type to handle integers, so when I try to  
change the value and it is passed to an integer block param swig(?)  
generates a runtime TypeError and the value does not actually change  
in the block (although it seems to work fine for float params)  
c) I want to use the QT option for the GUI because WX, while it has a  
Slider and Text Box that appear to have formatting options to provide  
integers(?), does not seem to have something akin to the QT GUI Vector  
Sink that is so incredibly useful.

Programming GUI widgets or graphical sinks is not something I wish to  
tackle at this stage.

Can someone recommend an apporach to handling this?

I could just make all the integer params into floats (and convert them  
inside the custom block C++ code) as a workaround, but I am hoping GRC  
has a better way to handle this.

Thanks

---

<div class="post-metadata">

**Author:** ![MurphyS\_John](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@MurphyS\_John](https://www.ruby-forum.com/u/MurphyS_John)\
**Post date:** [March 18, 2015, 5:08pm UTC](https://www.ruby-forum.com/t/qt-widget-to-adjust-integer-values-on-the-fly/234631/2 "2015-03-18T17:08:33Z")

</div>

On Wed, Mar 18, 2015 at 11:58 AM, Murphy, John [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> variable names - which unless I am mistaken here (possible) makes me  
> wonder what the point of the Entry is vs the Label - if this is  
> incorrect please let me know and I would like to investigate why I do  
> not see this happening on my flowgraphs  
> b) QT GUI Range seems to always output float values, there is no way  
> that I see to set the output type to handle integers, so when I try to  
> change the value and it is passed to an integer block param swig(?)  
> generates a runtime TypeError and the value does not actually change  
> in the block (although it seems to work fine for float params)

We can look into adding the formatter option to this block – we’re  
working  
on updating it soon, anyways, to remove the use of PyQWT.

In the meantime, you can cast it yourself when you use it. Say your  
Range  
block variable is “var”, when you pass it to a block, say “int(var)” to  
cast it to an integer.

Just remember that all of the edit boxes for parameters in GRC are  
Python,  
so you can put a Python expression in them as you need.

Tom

---

<div class="post-metadata">

**Author:** ![MurphyS\_John](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@MurphyS\_John](https://www.ruby-forum.com/u/MurphyS_John)\
**Post date:** [March 18, 2015, 5:19pm UTC](https://www.ruby-forum.com/t/qt-widget-to-adjust-integer-values-on-the-fly/234631/3 "2015-03-18T17:19:01Z")

</div>

Ah! Thanks, Tom, that works.
