# eric7.EricWidgets.EricSqueezeLabels

Module implementing labels that squeeze their contents to fit the size of the label.

### Global Attributes

None

### Classes

EricSqueezeLabel | Class implementing a label that squeezes its contents to fit its size.
EricSqueezeLabelPath | Class implementing a label showing a file path compacted to fit its size.

### Functions

None

## EricSqueezeLabel

Class implementing a label that squeezes its contents to fit its size.

### Derived from

QLabel

### Class Attributes

None

### Class Methods

None

### Methods

EricSqueezeLabel | Constructor
paintEvent | Protected method called when some painting is required.
setText | Public method to set the label's text.

### Static Methods

None

#### EricSqueezeLabel (Constructor)

EricSqueezeLabel(parent=None)

Constructor

parent (QWidget)
  reference to the parent Widget

#### EricSqueezeLabel.paintEvent

paintEvent(event)

Protected method called when some painting is required.

event (QPaintEvent)
  reference to the paint event

#### EricSqueezeLabel.setText

setText(txt)

Public method to set the label's text.

txt (str)
  the text to be shown

Up

## EricSqueezeLabelPath

Class implementing a label showing a file path compacted to fit its size.

### Derived from

QLabel

### Class Attributes

None

### Class Methods

None

### Methods

EricSqueezeLabelPath | Constructor
length | Public method to return the length of a text in pixels.
paintEvent | Protected method called when some painting is required.
setPath | Public method to set the path of the label.
setSurrounding | Public method to set the surrounding of the path string.
setTextPath | Public method to set the surrounding and the path of the label.

### Static Methods

None

#### EricSqueezeLabelPath (Constructor)

EricSqueezeLabelPath(parent=None)

Constructor

parent (QWidget)
  reference to the parent Widget

#### EricSqueezeLabelPath.length

length(txt)

Public method to return the length of a text in pixels.

txt (str)
  text to calculate the length for after wrapped

Return:
  length of the wrapped text in pixels

Return Type:
  int

#### EricSqueezeLabelPath.paintEvent

paintEvent(event)

Protected method called when some painting is required.

event (QPaintEvent)
  reference to the paint event

#### EricSqueezeLabelPath.setPath

setPath(path)

Public method to set the path of the label.

path (str)
  path to be shown

#### EricSqueezeLabelPath.setSurrounding

setSurrounding(surrounding)

Public method to set the surrounding of the path string.

surrounding (str)
  the a string containing placeholders for the path

#### EricSqueezeLabelPath.setTextPath

setTextPath(surrounding, path)

Public method to set the surrounding and the path of the label.

surrounding (str)
  the a string containing placeholders for the path
path (str)
  path to be shown

Up