Skip to main content
`Ctrl`+`K`

# `WaitingPushButton`: Button with waiting status

WaitingPushButton module

class WaitingPushButton(parent=None, text=None, icon=None)

  Button which allows to display a waiting status when, for example, something is still computing.

  The component is graphically disabled when it is in waiting. Then we overwrite the enabled method to dissociate the 2 concepts: graphically enabled/disabled, and enabled/disabled

  sizeHint()

    Returns the recommended size for the widget.

    This implementation of the recommended size always consider there is an icon. In this way it avoid to update the layout when the waiting icon is displayed.

  setDisabledWhenWaiting(isDisabled)

    Enable or disable the auto disable behaviour when the button is waiting.

    Parameters:

      isDisabled (bool) – Enable the auto-disable behaviour

  isDisabledWhenWaiting()

    Returns true if the button is auto disabled when it is waiting.

    Return type:

      bool

  disabledWhenWaiting

    Property to enable/disable the auto disabled state when the button is waiting.

  setIcon(icon)

    Set the button icon. If the button is waiting, the icon is not visible directly, but will be visible when the waiting state will be removed.

    Parameters:

      icon (qt.QIcon) – An icon

  getIcon()

    Returns the icon set to the button. If the widget is waiting it is not returning the visible icon, but the one requested by the application (the one displayed when the widget is not in waiting state).

    Return type:

      qt.QIcon

  icon

    Property providing access to the icon.

  setEnabled(enabled)

    Set the enabled state of the widget.

    Parameters:

      enabled (bool) – The enabled state

  isEnabled()

    Returns the enabled state of the widget.

    Return type:

      bool

  enabled

    Property providing access to the enabled state of the widget

  setWaiting(waiting)

    Set the waiting state of the widget.

    Parameters:

      waiting (bool) – Requested state

  isWaiting()

    Returns true if the widget is in waiting state.

    Return type:

      bool

  wait()

    Enable the waiting state.

  stopWaiting()

    Disable the waiting state.

  swapWaiting()

    Swap the waiting state.