• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

KTitleWidget Class Reference

#include <ktitlewidget.h>

Inheritance diagram for KTitleWidget:

Inheritance graph
[legend]

List of all members.


Detailed Description

Standard title widget with a white background and round border.

This class provides a widget often used for dialog titles.

ktitlewidget.png

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 a 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>

Definition at line 61 of file ktitlewidget.h.


Public Types

enum  ImageAlignment { ImageLeft, ImageRight }
enum  MessageType { PlainMessage, InfoMessage, WarningMessage, ErrorMessage }

Public Slots

void setAutoHideTimeout (int msecs)
void setComment (const QString &comment, MessageType type=PlainMessage)
void setPixmap (MessageType type, ImageAlignment alignment=ImageRight)
void setPixmap (const QIcon &icon, ImageAlignment alignment=ImageRight)
void setPixmap (const QString &icon, ImageAlignment alignment=ImageRight)
void setPixmap (const QPixmap &pixmap, ImageAlignment alignment=ImageRight)
void setText (const QString &text, MessageType type)
void setText (const QString &text, Qt::Alignment alignment=Qt::AlignLeft|Qt::AlignVCenter)

Public Member Functions

int autoHideTimeout () const
QString comment () const
 KTitleWidget (QWidget *parent=0)
const QPixmap * pixmap () const
void setBuddy (QWidget *buddy)
void setWidget (QWidget *widget)
QString text () const
virtual ~KTitleWidget ()

Protected Member Functions

void changeEvent (QEvent *e)
bool eventFilter (QObject *object, QEvent *event)
void showEvent (QShowEvent *event)

Properties

int autoHideTimeout
QPixmap pixmap
QString text

Member Enumeration Documentation

enum KTitleWidget::ImageAlignment

Possible title pixmap alignments.

  • ImageLeft: Display the pixmap left
  • ImageRight: Display the pixmap right (default)
Enumerator:
ImageLeft  Display the pixmap on the left.
ImageRight  Display the pixmap on the right.

Definition at line 76 of file ktitlewidget.h.

enum KTitleWidget::MessageType

Comment message types.

Enumerator:
PlainMessage  Normal comment.
InfoMessage  Information the user should be alerted to.
WarningMessage  A warning the user should be alerted to.
ErrorMessage  An error message.

Definition at line 84 of file ktitlewidget.h.


Constructor & Destructor Documentation

KTitleWidget::KTitleWidget ( QWidget *  parent = 0  )  [explicit]

Constructs a title widget with the given.

Parameters:
parent. 

Definition at line 80 of file ktitlewidget.cpp.

KTitleWidget::~KTitleWidget (  )  [virtual]

Definition at line 120 of file ktitlewidget.cpp.


Member Function Documentation

int KTitleWidget::autoHideTimeout (  )  const

Get the current timeout value in milliseconds.

Returns:
timeout value in msecs

void KTitleWidget::changeEvent ( QEvent *  e  )  [protected]

Reimplemented from QWidget.

Definition at line 165 of file ktitlewidget.cpp.

QString KTitleWidget::comment (  )  const

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

See also:
setComment()

Definition at line 150 of file ktitlewidget.cpp.

bool KTitleWidget::eventFilter ( QObject *  object,
QEvent *  event 
) [protected]

Definition at line 125 of file ktitlewidget.cpp.

const QPixmap* KTitleWidget::pixmap (  )  const

Returns:
the pixmap displayed in the title

See also:
setPixmap()

void KTitleWidget::setAutoHideTimeout ( int  msecs  )  [slot]

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

Parameters:
msecs timeout value in milliseconds

Definition at line 266 of file ktitlewidget.cpp.

void KTitleWidget::setBuddy ( 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

Definition at line 160 of file ktitlewidget.cpp.

void KTitleWidget::setComment ( const QString &  comment,
MessageType  type = PlainMessage 
) [slot]

Parameters:
comment Text displayed beneath the main title as a comment.

It can either be plain text or rich text.

Parameters:
type The sort of message it is.
See also:
MessageType

comment()

Definition at line 193 of file ktitlewidget.cpp.

void KTitleWidget::setPixmap ( MessageType  type,
ImageAlignment  alignment = ImageRight 
) [slot]

Parameters:
pixmap the icon to display in the header.

The pixmap is by default right, but

Parameters:
alignment can be used to display it also left.
See also:
pixmap()

Definition at line 256 of file ktitlewidget.cpp.

void KTitleWidget::setPixmap ( const QIcon &  icon,
ImageAlignment  alignment = ImageRight 
) [slot]

Parameters:
pixmap the icon to display in the header.

The pixmap is by default right, but

Parameters:
alignment can be used to display it also left.
See also:
pixmap()

Definition at line 251 of file ktitlewidget.cpp.

void KTitleWidget::setPixmap ( const QString &  icon,
ImageAlignment  alignment = ImageRight 
) [slot]

Parameters:
icon name of the icon to display in the header.

The pixmap is by default right, but

Parameters:
alignment can be used to display it also left.
See also:
pixmap()

Definition at line 246 of file ktitlewidget.cpp.

void KTitleWidget::setPixmap ( const QPixmap &  pixmap,
ImageAlignment  alignment = ImageRight 
) [slot]

Parameters:
pixmap Pixmap displayed in the header.

The pixmap is by default right, but

Parameters:
alignment can be used to display it also left.
See also:
pixmap()

Definition at line 219 of file ktitlewidget.cpp.

void KTitleWidget::setText ( const QString &  text,
MessageType  type 
) [slot]

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.

Parameters:
type The sort of message it is; will also set the icon accordingly
See also:
MessageType

text()

Definition at line 187 of file ktitlewidget.cpp.

void KTitleWidget::setText ( const QString &  text,
Qt::Alignment  alignment = Qt::AlignLeft | Qt::AlignVCenter 
) [slot]

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.

Parameters:
alignment Alignment of the text. Default is left and vertical centered.
See also:
text()

Definition at line 174 of file ktitlewidget.cpp.

void KTitleWidget::setWidget ( QWidget *  widget  ) 

Parameters:
widget Widget displayed on the title widget.

Definition at line 140 of file ktitlewidget.cpp.

void KTitleWidget::showEvent ( QShowEvent *  event  )  [protected]

Reimplemented from QWidget.

Definition at line 277 of file ktitlewidget.cpp.

QString KTitleWidget::text (  )  const

Returns:
the text displayed in the title

See also:
setText()


Property Documentation

int KTitleWidget::autoHideTimeout [read, write]

Definition at line 67 of file ktitlewidget.h.

const QPixmap * KTitleWidget::pixmap [read, write]

Definition at line 66 of file ktitlewidget.h.

QString KTitleWidget::text [read, write]

Definition at line 65 of file ktitlewidget.h.


The documentation for this class was generated from the following files:
  • ktitlewidget.h
  • ktitlewidget.cpp

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal