VToolHeader

The VToolHeader is a widget used as header bar for tool box.

Inherits: QWidget

Methods

Signals

Description

The VToolHeader is a widget used as header bar for tool box.

The header can have a button expand-collapse with the method setCollapseButton, a subject related icon with setIcon, a title with setTitle and a set of buttons with add_button.

These widgets are placed from left to right but the orientation may be reversed with setOrientation.

_images/theader.png

A VToolHeader with a button expand-collapse, an icon, a title and a set of two buttons.

Documentation

Methods

__init__(parent, icon=None, title='Tool Header', orientation=Qt.LeftToRight)

Instanciate the VToolHeader.

Arguments:

  • parent The parent of the header
  • icon The icon, may be a QIcon, a QPixmap or an image file path
  • title The title str(title)
  • orientation QT.LayoutDirection
add_button(icon=None, name=None)

Add a tool button to the header.

Arguments:

  • icon The icon of the button.
  • name The name of the button used for the property objectName, if None, the name ‘headerButton_x’ will be used.

Returns the instance of the button.

count_buttons()

Returns the number of tool buttons.

Type: int()

getFrameShadow()

Returns the shadow property of the header.

This is a pyqtProperty

Type: QFrame.Shadow

getFrameShape()

Returns the shape property of the header.

This is a pyqtProperty

Type: QFrame.Shape

get_height()

Returns the height of the header.

Type: int()

getIcon()

Returns the icon of the header.

This is a pyqtProperty

Type: QIcon()

getOrientation()

Returns the orientation of the button’s layout.

This is a pyqtProperty

Type: Qt.LayoutDirection

getTitle()

Returns the title of the header.

This is a pyqtProperty

Type: str() or QString()

get_width()

Returns the width of the header.

Type: int()

hasCollapseButton()

Returns True if the header has a button collapse-expand.

This is a pyqtProperty

isOrientedByLanguage()

Returns True if the widgets are oriented by the locale language.

This is a pyqtProperty

remove_button(btn)

Remove a tool button from the header.

Arguments:

  • btn The instance of the button.
remove_icon()
Remove the header’s icon.
set_collapsed_left_icon(icon)

Sets the icon wich represent the state collapsed.

This icon is used for the header oriented from left to rigth.

Arguments:

  • icon A QIcon or a QPixmap instance or an image file path.
set_collapsed_right_icon(icon)

Sets the icon wich represent the state collapsed.

This icon is used for the header oriented from right to left.

Arguments:

  • icon A QIcon or a QPixmap instance or an image file path.
setCollapseButton(b)

Sets the button collapse-expand.

This button is used to show-hide the tool box that have this header.

The icon, by default, is a little black triangle and can be customized.

This property can be defined in the Qt Designer.

Arguments:

  • b Boolean.

Raise TypeError if the argument is not boolean.

See: set_expanded_icon, set_collapsed_left_icon, set_collapsed_right_icon and set_expanding_buttons

set_expanded_icon(icon)

Sets the icon wich represent the state expanded.

Arguments:

  • icon A QIcon or a QPixmap instance or an image file path
set_expanding_buttons(down=None, left=None, right=None)

Sets the icons used for the button collapse-expand.

Arguments:

  • down The icon wich represent the state expanded.
  • left The left side icon wich represent the state collapsed.
  • right The right side icon wich represent the state collapsed.

Icons may be QIcon or QPixmap instances or image file paths.

setFrameShadow_(shadow)

Sets the shadow for the header frame.

This property can be defined in the Qt Designer.

Arguments:

  • shadow QFrame.Shadow
setFrameShape_(shape)

Sets the shape of the header.

This property can be defined in the Qt Designer.

Arguments:

  • shape QFrame.Shape.
setIcon(icon)

Sets the header’s icon.

This property can be defined in the Qt Designer.

Arguments:

  • icon A QIcon or QPixmap instance or an image file path
setOrientation(orientation)

Sets the orientation of the widgets.

This property can be defined in the Qt Designer.

Arguments:

  • orientation Qt.LayoutDirection.
setOrientedByLanguage(b)

Sets the orientation in accordance with the language.

Theses languages are written from right to left:

  • Arabic [ar]
  • Hebrew [he]
  • Persian [fa]
  • Urdu [ur]
  • Syriac [syr]

This property can be defined in the Qt Designer.

Arguments:

  • b Boolean.
set_style_sheet(sheet)

Sets a style sheet to the header.

Arguments:

  • sheet str()
setTitle(title)

Sets the title of the header.

This property can be defined in the Qt Designer.

Arguments:

  • title str() or QString().

Signals

expandRequest(bool)

This signal is sent whenever the user click on the button collapse-expand.

Type:

  • bool Boolean, True for expand, False for collapse.
headerButtonClicked(button)

This signal is sent whenever the user click on a button.

Type:

  • button QPushButton instance.

Table Of Contents

Previous topic

VLineEdit

This Page