KDE 4.9 PyKDE API Reference

- KDE's Python API

# KSqueezedTextLabel Class Reference

`from PyKDE4.kdeui import *`

Inherits: QLabel → QFrame → QWidget → QObject

## Detailed Description

A replacement for QLabel that squeezes its text

A label class that squeezes its text into the label

If the text is too long to fit into the label it is divided into remaining left and right parts which are separated by three dots.

Example: http://www.kde.org/documentation/index.html could be squeezed to http://www.kde...ion/index.html

"KSqueezedTextLabel Widget"

Author:
  Ronny Standtke <Ronny.Standtke@gmx.de>

## Methods

| __init__ (self, QWidget parent=0)
| __init__ (self, QString text, QWidget parent=0)
| clear (self)
| contextMenuEvent (self, QContextMenuEvent a0)
QString | fullText (self)
QSize | minimumSizeHint (self)
| mouseReleaseEvent (self, QMouseEvent a0)
| resizeEvent (self, QResizeEvent a0)
| setAlignment (self, Qt::Alignment a0)
| setText (self, QString text)
| setTextElideMode (self, Qt::TextElideMode mode)
QSize | sizeHint (self)
| squeezeTextToLabel (self)
Qt::TextElideMode | textElideMode (self)

## Method Documentation

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

Default constructor.

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

clear | ( |  | self ) |

Clears the text. Same remark as above.

contextMenuEvent | ( | self, |
|  | QContextMenuEvent | a0
| ) |  |  |

\reimp

QString fullText | ( |  | self ) |

Get the full text set via setText.

Since:
  4.4

QSize minimumSizeHint | ( |  | self ) |

mouseReleaseEvent | ( | self, |
|  | QMouseEvent | a0
| ) |  |  |

\reimp

resizeEvent | ( | self, |
|  | QResizeEvent | a0
| ) |  |  |

Called when widget is resized

setAlignment | ( | self, |
|  | Qt::Alignment | a0
| ) |  |  |

Overridden for internal reasons; the API remains unaffected.

setText | ( | self, |
|  | QString | text
| ) |  |  |

Sets the text. Note that this is not technically a reimplementation of QLabel.setText(), which is not virtual (in Qt 4.3). Therefore, you may need to cast the object to KSqueezedTextLabel in some situations: \Example

     KSqueezedTextLabel* squeezed = new KSqueezedTextLabel("text", parent);
     QLabel* label = squeezed;
     label->setText("new text");	// this will not work
     squeezed->setText("new text");	// works as expected
     static_cast<KSqueezedTextLabel*>(label)->setText("new text");	// works as expected

Parameters:

  | mode | The new text.

setTextElideMode | ( | self, |
|  | Qt::TextElideMode | mode
| ) |  |  |

Sets the text elide mode.

Parameters:

  | mode | The text elide mode.

QSize sizeHint | ( |  | self ) |

squeezeTextToLabel | ( |  | self ) |

does the dirty work

Qt::TextElideMode textElideMode | ( |  | self ) |

Returns the text elide mode.