Tool Box Widget (toolbox)

Tool Box Widget

A reimplementation of the QToolBox widget that keeps all the tabs in a single QScrollArea instance and can keep multiple open tabs.

class orangecanvas.gui.toolbox.ToolBox(parent: QWidget | None = None, **kwargs: Any)[source]

Bases: QFrame

A tool box widget.

tabToggled(index: int, state: bool)

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

Signal emitted when a tab at index is toggled.

setExclusive(exclusive: bool) None[source]

Set exclusive tabs (only one tab can be open at a time).

exclusive() bool[source]

Are the tabs in the toolbox exclusive.

setTabButtonHeight(height: int) None[source]

Set the tab button height.

tabButtonHeight() int[source]

Return the tab button height.

setTabIconSize(size: QSize) None[source]

Set the tab button icon size.

tabIconSize() QSize[source]

Return the tab icon size.

tabButton(index: int) QAbstractButton[source]

Return the tab button at index

tabAction(index: int) QAction[source]

Return open/close action for the tab at index.

addItem(widget: ~PyQt5.QtWidgets.QWidget, text: str, icon: ~PyQt5.QtGui.QIcon = <PyQt5.QtGui.QIcon object>, toolTip: str = '') int[source]

Append the widget in a new tab and return its index.

Parameters:
  • widget (QWidget) – A widget to be inserted. The toolbox takes ownership of the widget.

  • text (str) – Name/title of the new tab.

  • icon (QIcon) – An icon for the tab button.

  • toolTip (str) – Tool tip for the tab button.

Returns:

index – Index of the inserted tab

Return type:

int

insertItem(index: int, widget: ~PyQt5.QtWidgets.QWidget, text: str, icon: ~PyQt5.QtGui.QIcon = <PyQt5.QtGui.QIcon object>, toolTip: str = '') int[source]

Insert the widget in a new tab at position index.

See also

ToolBox.addItem

removeItem(index: int) None[source]

Remove the widget at index.

Note

The widget is hidden but is is not deleted. It is up to the caller to delete it.

count() int[source]

Return the number of widgets inserted in the toolbox.

widget(index: int) QWidget[source]

Return the widget at index.

createTabButton(widget: ~PyQt5.QtWidgets.QWidget, text: str, icon: ~PyQt5.QtGui.QIcon = <PyQt5.QtGui.QIcon object>, toolTip: str = '') QAbstractButton[source]

Create the tab button for widget.

ensureWidgetVisible(child: QWidget, xmargin: int = 50, ymargin: int = 50) None[source]

Scroll the contents so child widget instance is visible inside the viewport.

sizeHint() QSize[source]

Reimplemented.