KStatusBar

KDE 4.7 PyKDE API Reference

- KDE's Python API

# KStatusBar Class Reference

`from PyKDE4.kdeui import *`

Inherits: QStatusBar → QWidget → QObject

## Detailed Description

KDE statusbar widget

Display status messages.

You can insert text labels or custom widgets. Their geometry is managed internally. KStatusBar resizes itself, but positioning is left to KMainWindow (or to you, if you don't use KMainWindow ).

A special type of item is a message which is a temporary text-message displayed on top of other items in full-width. Messages are visible for specified time, or until you call the slot QStatusBar.clearMessage(). See QStatusBar.showMessage for details.

It is useful to connect the KActionCollection signals to the QStatusBar.showMessage slots.

KStatusBar inherits QStatusBar, you can freely use all QStatusBar methods.

Empty text items are not visible. They will become visible when you change (add) text.

Author:
  Mark Donohoe <donohoe@kde.org> and Sven Radej <radej@kde.org>

See also:
  KActionCollection

## Signals
| pressed (int a0)
| released (int a0)
## Methods
| __init__ (self, QWidget parent=0)
| changeItem (self, QString text, int id)
bool | eventFilter (self, QObject object, QEvent event)
bool | hasItem (self, int id)
| insertFixedItem (self, QString text, int id)
| insertItem (self, QString text, int id, int stretch=0)
| insertPermanentFixedItem (self, QString text, int id)
| insertPermanentItem (self, QString text, int id, int stretch=0)
QString | itemText (self, int id)
| removeItem (self, int id)
| setItemAlignment (self, int id, Qt::Alignment alignment)
| setItemFixed (self, int id, int width=-1)

## Signal Documentation

pressed | ( | int | a0
| ) |  |  |

Emitted when mouse is pressed over item id.

Connect to this signal if you want to respond to mouse press events.

Signal syntax:
  `QObject.connect(source, SIGNAL("pressed(int)"), target_slot)`

released | ( | int | a0
| ) |  |  |

Emitted when mouse is released over item id.

Connect to this signal if you want to respond to mouse release events (clicks).

Signal syntax:
  `QObject.connect(source, SIGNAL("released(int)"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | QWidget | parent=0
| ) |  |  |

Constructs a status bar. parent is usually KMainWindow.

changeItem | ( | self, |
|  | QString | text,
|  | int | id
| ) |  |  |

Changes the text in a status bar field.

The item will be resized to fit the text. If you change text to be empty, item will not be visible (until you add some text).

Parameters:

  | text | The label's text string
  | id | The id of item.

bool eventFilter | ( | self, |
|  | QObject | object,
|  | QEvent | event
| ) |  |  |

bool hasItem | ( | self, |
|  | int | id
| ) |  |  |

Returns true if an item with id exists already in KStatusBar, otherwise returns false.

Parameters:

  | id | id of the item

insertFixedItem | ( | self, |
|  | QString | text,
|  | int | id
| ) |  |  |

Inserts a fixed width temporary text label into status bar. The width will be set according to text, but will remain fixed even if you change text. You can change fixed width by calling setItemFixed.

Parameters:

  | text | The label's text string
  | id | id of item

insertItem | ( | self, |
|  | QString | text,
|  | int | id,
|  | int | stretch=0
| ) |  |  |

Inserts a temporary text label into the status bar. Parameter stretch is passed to QStatusBar.addWidget .

Parameters:

  | text | The label's text string.
  | id | id of item
  | stretch | stretch passed to QStatusBar.addWidget

See also:
  QStatusbar.addWidget

insertPermanentFixedItem | ( | self, |
|  | QString | text,
|  | int | id
| ) |  |  |

Inserts a fixed width permanent text label into status bar. The width will be set according to text, but will remain fixed even if you change text. You can change fixed width by calling setItemFixed.

Parameters:

  | text | The label's text string
  | id | id of item

insertPermanentItem | ( | self, |
|  | QString | text,
|  | int | id,
|  | int | stretch=0
| ) |  |  |

Inserts a permanent text label into the status bar. Parameter stretch is passed to QStatusBar.addWidget .

Parameters:

  | text | The label's text string.
  | id | id of item
  | stretch | stretch passed to QStatusBar.addPermanentWidget

See also:
  QStatusbar.addPermanentWidget

QString itemText | ( | self, |
|  | int | id
| ) |  |  |

The text of an item, if it exists.

removeItem | ( | self, |
|  | int | id
| ) |  |  |

Removes an item.

Parameters:

  | id | The item to remove.

setItemAlignment | ( | self, |
|  | int | id,
|  | Qt::Alignment | alignment
| ) |  |  |

Sets the alignment of item id. By default all fields are aligned AlignHCenter | AlignVCenter. See QLabel.setAlignment for details.

setItemFixed | ( | self, |
|  | int | id,
|  | int | width=-1
| ) |  |  |

Sets item id to have fixed width. This cannot be undone, but you can always set new fixed width.

Parameters:

  | id | id of item
  | width | fixed width in pixels. Default -1 is to adapt to text width.