QT GUI Tab Widget

From GNU Radio
Revision as of 14:38, 9 June 2020 by 172.18.0.7 (talk) (Added syntax clarification)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This block creates a tabbed widget to organize other widgets. The ID of this block can be used as the tab_id in the GUI hints of other widgets.

The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Do not include the square brackets. Both the tab specification and the grid position are optional.

See GUI Hint for more info

sampling_40.png

As of writing with GNURadio 3.8.0 on Windows it is tricky to find the correct tab_id to use in GRC. To get the correct tab_id do the following:

In the main windows of GNU Radio Companion (GRC) check the menu item "View->Generate Code preview" Insert a QT GUI Tab Widget from the right menu bar (Core->GUI Widgets->QT->QT GUI Tab Widget) Double click the QT GUI Tab Widget and go to the tab "Generated Code". The last line in the code view should read something like this:

self.top_grid_layout.addWidget(self.qtgui_tab_widget_0)

This means, that our tab_id is "qtgui_tab_widget_0" (without the double-quotes).

Now you know the tab_id and you can use it to put some graph into that tab. For example, add a QT GUI Time Sink, and go to its 'GUI Hint' property. Enter "qtgui_tab_widget_0@0" and this will put the graph in the first tab.


If you try to use the tab widget somehwere and get an error like the following, this means your tab_id is wrong.

Generate Error: (TypeError("unsupported operand type(s) for %: 'NoneType' and 'str'",), u'<%\n win = ... ... sip.wrapinstance(self.${id}.pyqwidget(), Qt.QWidget)\n${gui_hint() % win}') >>> Failure