GNU Radio 3.7.1 C++ API
QT Graphical User Interface

Introduction

This is the gr-qtgui package. It contains various QT-based graphical user interface blocks that add graphical sinks to a GNU Radio flowgraph. The Python namespaces is in gnuradio.qtgui, which would be normally imported as:

    from gnuradio import qtgui

See the Doxygen documentation for details about the blocks available in this package. The relevant blocks are listed in the QT Graphical Interfaces group.

A quick listing of the details can be found in Python after importing by using:

    help(qtgui)

Blocks

There are a number of available QTGUI blocks for different plotting purposes. These include:

  • Time Domain: x-axis is time, y-axis is amplitude.
  • Frequency Domain or PSD: x-axis is frequency, y-axis is magnitude in dB.
  • Waterfall or spectrogram: x-axis is frequency, y-axis is time, z-axis is intensity related to magnitude in dB.
  • Constellation: polar plot of real vs. imaginary.
  • Time Raster: time vs. time with the z-axis being intensity based on value of the sample.
  • Combined Sink: combines time, frequency, waterfall, and constellation plots into one widget.

The time domain, frequency domain, and waterfall have both a complex and a floating point block. The constellation plot only makes sense with complex inputs. The time raster plots accept bits and floats.

Because the time raster plots are designed to show structure over time in a signal, frame, packet, etc., they never drop samples. This is a fairly taxing job and performance can be an issue. Since it is expected that this block will work on a frame or packet structure, we tend to be at the lowest possible rate at this point, so that will help. Expect performance issues at high data rates.

Note: There seem to be extra performance issue with the raster plotters in QWT version 5 that were fixed with QWT version 6. As such, the time raster plots have incredibly poor performance with QWT5 to the point of almost being unusable. In the future, we may restrict compilation and installation of these plots only if QWT6 or higher is discovered. For now, just be aware of this limitation.

Dependencies

The QT GUI blocks require the following dependencies.

  • QtCore (version >= 4.4)
  • QtGui (version >= 4.4)
  • QtOpenGL (version >= 4.4)
  • PyQt4 for Qt4 (version >= 4.4)
  • Qwt (version >= 5.2)
  • PyQwt5 for Qt4 (version >= 5.2)

Usage

To use the qtgui interface, a bit of boiler-plate lines must be included. First, the sink is defined, then it must be exposed from C++ into Python using the "sip.wrapinstance" command, and finally, the "show" method is run on the new Python object. This sets up the QT environment to show the widget, but the qApplication must also be launched.

In the "main" function of the code, the qApp is retrieved. Then, after the GNU Radio top block is started (remember that start() is a non-blocking call to launch the main thread of the flowgraph), the qapp's "exec_()" function is called. This function is a blocking call while the GUI is alive.

from PyQt4 import Qt
from gnuradio import qtgui
import sys, sip

class grclass(gr.top_block):
    ....

    self.snk = qtgui.sink_c(1024,           #fftsize
                            samp_rate,      #bw
                            "QT GUI Plot")  #name

    self.snk_win = sip.wrapinstance(self.snk.pyqwidget(), Qt.QWidget)
    self.snk_win.show()

def main():
    qapp = Qt.QApplication(sys.argv)
    tb = grclass()
    tb.start()
    qapp.exec_()
    tb.stop()

There are graphical controls in all but the combined plotting tools. In the margins of the GUIs (that is, not on the canvas showing the signal itself), right-clicking the mouse will pull up a drop-down menu that will allow you to change difference parameters of the plots. These include things like the look of the lines (width, color, style, markers, etc.), the ability to start and stop the display, the ability to save to a file, and other plot-specific controls (FFT size for the frequency and waterfall plots, etc.).