Tool Grid Widget (toolgrid)

A widget containing a grid of clickable actions/buttons.

class orangecanvas.gui.toolgrid.ToolGrid(parent=None, columns=4, buttonSize=None, iconSize=None, toolButtonStyle=3)[source]

Bases: PyQt5.QtWidgets.QFrame

A widget containing a grid of actions/buttons.

Actions can be added using standard QWidget.addAction(QAction)() and QWidget.insertAction(int, QAction)() methods.

Parameters:
  • parent (QWidget) – Parent widget.
  • columns (int) – Number of columns in the grid layout.
  • buttonSize (QSize, optional) – Size of tool buttons in the grid.
  • iconSize (QSize, optional) – Size of icons in the buttons.
  • toolButtonStyle (Qt.ToolButtonStyle) – Tool button style.
actionTriggered(QAction)

Signal emitted when an action is triggered.

actionHovered(QAction)

Signal emitted when an action is hovered.

setButtonSize(size)[source]

Set the button size.

buttonSize()[source]

Return the button size.

setIconSize(size)[source]

Set the button icon size.

iconSize()[source]

Return the icon size

setToolButtonStyle(style)[source]

Set the tool button style.

toolButtonStyle()[source]

Return the tool button style.

setColumnCount(columns)[source]

Set the number of button/action columns.

columns()[source]

Return the number of columns in the grid.

clear()[source]

Clear all actions/buttons.

insertAction(before, action)[source]

Insert a new action at the position currently occupied by before (can also be an index).

Parameters:
  • before (QAction or int) – Position where the action should be inserted.
  • action (QAction) – Action to insert
setActions(actions)[source]

Clear the grid and add actions.

buttonForAction(action)[source]

Return the QToolButton instance button for action.

createButtonForAction(action)[source]

Create and return a QToolButton for action.

count()[source]

Return the number of buttons/actions in the grid.

actionEvent(self, QActionEvent)[source]
paintEvent(self, QPaintEvent)[source]
eventFilter(self, QObject, QEvent) → bool[source]