Difference between revisions of "QT GUI Message Edit Box"
(Revise description. Add Example Flowgraph.)
(revise output screen shot)
|Line 48:||Line 48:|
== Source Files ==
== Source Files ==
Revision as of 02:14, 20 October 2019
The Message Edit Box is a QT widget which manages data through message passing interfaces. The interface ports are Polymorphic Types (PMT), which are opaque data types designed as generic containers of data.
The 'msg' output port produces messages based on the text in the input field(s) and the data type set by the type argument. The data types are checked, and WARN log messages are produced when the data is in the wrong format.
The value of the input field(s) can be updated programmatically through the 'val' input message port. It is also checked for the correct data type.
is_pair argument determines if the input field handles a key:value pair. If set to True, two input fields are created with the left for the key and right for the value. The key is always assumed to be a string and the value is restricted by the data type setting as above.
The block can take a default value. Because the block is capable of handling multiple data types, the default value is entered as a string in the same format as the user enters it into the Value input field of the widget.
Complex numbers are handled a bit differently. Because the Boost lexical_cast function is used, complex numbers MUST be in the form "(a,b)" to represent "a + jb". Note that a space is not valid after the comma, so "(1.23,10.56)" is correct while "(1.23, 10.56)" is not.
static mode prevents the user from changing the data type or the key used in the widget. If also in
pair mode, the key is not displayed and so must be set in the constructor. It is an error if using
pair modes with no default key set.
- msg (output)
- Produces a PMT message from the data in the input field. If the data is not of the correct type and the conversion fails, the block produces a log WARN message, but does not output the data.
- val (input)
- Accepts PMT messages to update the value in the input field(s). The messages are first checked for the correct type (integer, float, string, or complex), and then converted to string(s) to display in the input field(s). When using
is_pair, the PMT is checked to make sure it is a valid PMT pair. Then the key is extracted as a string and the value is processed according to the data type.
- The default value of the message. This is entered as a string regardless of the type and converted internally.
- A label to identify the input field on the screen.
- Pair Mode
TrueIf a key:value pair.
- Static Mode
TrueIf the key input field is a static text box (cannot be edited live).
TrueIf the key used in a key:value pair message.
- GUI Hint
- See GUI Hint for information on how to arrange multiple QT GUIs on the screen.
This flowgraph shows how a Message Edit Box can send a string. When the string has been processed by the Embedded Python Block, the 'clear input' port sends a null string back to the 'val' port of the Message Edit Box to clear the input field. In the flowgraph, the text is sent through a Throttle to a Text Sink, which is an OOT module. See gr-display.
- C++ files
- Header files
- Public header files
- Block definition