KDE 4.5 PyKDE API Reference

- KDE's Python API

# KTitleWidget Class Reference

`from PyKDE4.kdeui import *`

Inherits: QWidget → QObject

## Detailed Description

Standard title widget with a white background and round border.

This class provides a widget often used for dialog titles.

"KTitleWidget with title and icon"

Usage KTitleWidget is very simple to use. You can either use its default text (and pixmap) properties or display your own widgets in the title widget.

A title text with a left aligned pixmap:

    KTitleWidget *titleWidget = new KTitleWidget(this);
    titleWidget->setText(i18n("Title"));
    titleWidget->setPixmap(KIcon("screen").pixmap(22, 22), KTitleWidget.ImageLeft);

Use it with an own widget:

    KTitleWidget *checkboxTitleWidget = new KTitleWidget(this);

    QWidget *checkBoxTitleMainWidget = new QWidget(this);
    QVBoxLayout *titleLayout = new QVBoxLayout(checkBoxTitleMainWidget);
    titleLayout->setMargin(6);

    QCheckBox *checkBox = new QCheckBox("Text Checkbox", checkBoxTitleMainWidget);
    titleLayout->addWidget(checkBox);

    checkboxTitleWidget->setWidget(checkBoxTitleMainWidget);

See also:
  KPageView

Author:
  Urs Wolfer <uwolfer @kde.org>

## Enumerations
ImageAlignment | { ImageLeft, ImageRight }
MessageType | { PlainMessage, InfoMessage, WarningMessage, ErrorMessage }
## Methods
| __init__ (self, QWidget parent=0)
| __init__ (self, KTitleWidget a0)
int | autoHideTimeout (self)
| changeEvent (self, QEvent e)
QString | comment (self)
bool | eventFilter (self, QObject object, QEvent event)
QPixmap | pixmap (self)
| setAutoHideTimeout (self, int msecs)
| setBuddy (self, QWidget buddy)
| setComment (self, QString comment, KTitleWidget.MessageType type=KTitleWidget.PlainMessage)
| setPixmap (self, QPixmap pixmap, KTitleWidget.ImageAlignment alignment=KTitleWidget.ImageRight)
| setPixmap (self, QString icon, KTitleWidget.ImageAlignment alignment=KTitleWidget.ImageRight)
| setPixmap (self, QIcon icon, KTitleWidget.ImageAlignment alignment=KTitleWidget.ImageRight)
| setPixmap (self, KTitleWidget.MessageType type, KTitleWidget.ImageAlignment alignment=KTitleWidget.ImageRight)
| setText (self, QString text, Qt::Alignment alignment=Qt.AlignLeft|Qt.AlignVCenter)
| setText (self, QString text, KTitleWidget.MessageType type)
| setWidget (self, QWidget widget)
| showEvent (self, QShowEvent event)
QString | text (self)

## Method Documentation

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

Constructs a title widget with the given

Parameters:

  | parent. |

__init__ | ( | self, |
|  | KTitleWidget | a0
| ) |  |  |

int autoHideTimeout | ( |  | self ) |

Get the current timeout value in milliseconds

Returns:
  timeout value in msecs

changeEvent | ( | self, |
|  | QEvent | e
| ) |  |  |

QString comment | ( |  | self ) |

Returns:
  the text displayed in the comment below the title, if any

See also:
  setComment()

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

QPixmap pixmap | ( |  | self ) |

Returns:
  the pixmap displayed in the title

See also:
  setPixmap()

setAutoHideTimeout | ( | self, |
|  | int | msecs
| ) |  |  |

Set the autohide timeout of the label Set value to 0 to disable autohide, which is the default.

Parameters:

  | msecs | timeout value in milliseconds

setBuddy | ( | self, |
|  | QWidget | buddy
| ) |  |  |

Sets this label's buddy to buddy. When the user presses the shortcut key indicated by the label in this title widget, the keyboard focus is transferred to the label's buddy widget.

Parameters:

  | buddy | the widget to activate when the shortcut key is activated

setComment | ( | self, |
|  | QString | comment,
|  | KTitleWidget.MessageType | type=KTitleWidget.PlainMessage
| ) |  |  |

Parameters:

  | comment | Text displayed beneath the main title as a comment. It can either be plain text or rich text.
  | type | The sort of message it is. See also: MessageType See also: comment()

setPixmap | ( | self, |
|  | QPixmap | pixmap,
|  | KTitleWidget.ImageAlignment | alignment=KTitleWidget.ImageRight
| ) |  |  |

Parameters:

  | pixmap | the icon to display in the header. The pixmap is by default right, but
  | alignment | can be used to display it also left.

See also:
  pixmap()

setPixmap | ( | self, |
|  | QString | icon,
|  | KTitleWidget.ImageAlignment | alignment=KTitleWidget.ImageRight
| ) |  |  |

Parameters:

  | pixmap | the icon to display in the header. The pixmap is by default right, but
  | alignment | can be used to display it also left.

See also:
  pixmap()

setPixmap | ( | self, |
|  | QIcon | icon,
|  | KTitleWidget.ImageAlignment | alignment=KTitleWidget.ImageRight
| ) |  |  |

Parameters:

  | pixmap | the icon to display in the header. The pixmap is by default right, but
  | alignment | can be used to display it also left.

See also:
  pixmap()

setPixmap | ( | self, |
|  | KTitleWidget.MessageType | type,
|  | KTitleWidget.ImageAlignment | alignment=KTitleWidget.ImageRight
| ) |  |  |

Parameters:

  | pixmap | the icon to display in the header. The pixmap is by default right, but
  | alignment | can be used to display it also left.

See also:
  pixmap()

setText | ( | self, |
|  | QString | text,
|  | Qt::Alignment | alignment=Qt.AlignLeft|Qt.AlignVCenter
| ) |  |  |

Parameters:

  | text | Text displayed on the label. It can either be plain text or rich text. If it is plain text, the text is displayed as a bold title text.
  | type | The sort of message it is; will also set the icon accordingly See also: MessageType See also: text()

setText | ( | self, |
|  | QString | text,
|  | KTitleWidget.MessageType | type
| ) |  |  |

Parameters:

  | text | Text displayed on the label. It can either be plain text or rich text. If it is plain text, the text is displayed as a bold title text.
  | type | The sort of message it is; will also set the icon accordingly See also: MessageType See also: text()

setWidget | ( | self, |
|  | QWidget | widget
| ) |  |  |

Parameters:

  | widget | Widget displayed on the title widget.

showEvent | ( | self, |
|  | QShowEvent | event
| ) |  |  |

QString text | ( |  | self ) |

Returns:
  the text displayed in the title

See also:
  setText()

## Enumeration Documentation

ImageAlignment

Possible title pixmap alignments.

- ImageLeft: Display the pixmap left
- ImageRight: Display the pixmap right (default)

Enumerator:

  ImageLeft |
  ImageRight |

MessageType

Comment message types

Enumerator:

  PlainMessage |
  InfoMessage |
  WarningMessage |
  ErrorMessage |