• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

Public Types | Public Slots | Public Member Functions | Protected Member Functions | Properties | List of all members
KTitleWidget Class Reference

#include <ktitlewidget.h>

Inheritance diagram for KTitleWidget:
QWidget

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 (const QIcon &icon, ImageAlignment alignment=ImageRight)
 
void setPixmap (const QPixmap &pixmap, ImageAlignment alignment=ImageRight)
 
void setPixmap (const QString &icon, ImageAlignment alignment=ImageRight)
 
void setPixmap (MessageType type, 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

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

Protected Member Functions

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

Properties

int autoHideTimeout
 
QString comment
 
QPixmap pixmap
 
QString text
 

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);
KIcon
A wrapper around QIcon that provides KDE icon features.
Definition: kicon.h:41
KTitleWidget
Standard title widget with a white background and round border.
Definition: ktitlewidget.h:62
KTitleWidget::pixmap
QPixmap pixmap
Definition: ktitlewidget.h:67
KTitleWidget::ImageLeft
@ ImageLeft
Display the pixmap on the left.
Definition: ktitlewidget.h:78
KTitleWidget::setText
void setText(const QString &text, Qt::Alignment alignment=Qt::AlignLeft|Qt::AlignVCenter)
Definition: ktitlewidget.cpp:201
KTitleWidget::setPixmap
void setPixmap(const QPixmap &pixmap, ImageAlignment alignment=ImageRight)
Definition: ktitlewidget.cpp:231
i18n
QString i18n(const char *text)

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);
KTitleWidget::setWidget
void setWidget(QWidget *widget)
Definition: ktitlewidget.cpp:167
QWidget
See also
KPageView
Author
Urs Wolfer <uwolfer @ kde.org>

Definition at line 61 of file ktitlewidget.h.

Member Enumeration Documentation

◆ ImageAlignment

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 77 of file ktitlewidget.h.

◆ MessageType

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 85 of file ktitlewidget.h.

Constructor & Destructor Documentation

◆ KTitleWidget()

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

Constructs a title widget with the given.

Parameters
parent.

Definition at line 107 of file ktitlewidget.cpp.

◆ ~KTitleWidget()

KTitleWidget::~KTitleWidget ( )
virtual

Definition at line 147 of file ktitlewidget.cpp.

Member Function Documentation

◆ autoHideTimeout()

int KTitleWidget::autoHideTimeout ( ) const

Get the current timeout value in milliseconds.

Returns
timeout value in msecs

Definition at line 273 of file ktitlewidget.cpp.

◆ changeEvent()

void KTitleWidget::changeEvent ( QEvent *  e)
protected

Definition at line 192 of file ktitlewidget.cpp.

◆ comment()

QString KTitleWidget::comment ( ) const
Returns
the text displayed in the comment below the title, if any
See also
setComment()

Definition at line 177 of file ktitlewidget.cpp.

◆ eventFilter()

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

Definition at line 152 of file ktitlewidget.cpp.

◆ pixmap()

const QPixmap * KTitleWidget::pixmap ( ) const
Returns
the pixmap displayed in the title
See also
setPixmap()

Definition at line 182 of file ktitlewidget.cpp.

◆ setAutoHideTimeout

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
msecstimeout value in milliseconds

Definition at line 278 of file ktitlewidget.cpp.

◆ setBuddy()

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
buddythe widget to activate when the shortcut key is activated

Definition at line 187 of file ktitlewidget.cpp.

◆ setComment

void KTitleWidget::setComment ( const QString &  comment,
MessageType  type = PlainMessage 
)
slot
Parameters
commentText displayed beneath the main title as a comment. It can either be plain text or rich text.
typeThe sort of message it is.
See also
MessageType
comment()

Definition at line 220 of file ktitlewidget.cpp.

◆ setPixmap [1/4]

void KTitleWidget::setPixmap ( const QIcon &  icon,
ImageAlignment  alignment = ImageRight 
)
slot
Parameters
pixmapthe icon to display in the header. The pixmap is by default right, but
alignmentcan be used to display it also left.
See also
pixmap()

Definition at line 263 of file ktitlewidget.cpp.

◆ setPixmap [2/4]

void KTitleWidget::setPixmap ( const QPixmap &  pixmap,
ImageAlignment  alignment = ImageRight 
)
slot
Parameters
pixmapPixmap displayed in the header. The pixmap is by default right, but
alignmentcan be used to display it also left.
See also
pixmap()

Definition at line 231 of file ktitlewidget.cpp.

◆ setPixmap [3/4]

void KTitleWidget::setPixmap ( const QString &  icon,
ImageAlignment  alignment = ImageRight 
)
slot
Parameters
iconname of the icon to display in the header. The pixmap is by default right, but
alignmentcan be used to display it also left.
See also
pixmap()

Definition at line 258 of file ktitlewidget.cpp.

◆ setPixmap [4/4]

void KTitleWidget::setPixmap ( MessageType  type,
ImageAlignment  alignment = ImageRight 
)
slot
Parameters
pixmapthe icon to display in the header. The pixmap is by default right, but
alignmentcan be used to display it also left.
See also
pixmap()

Definition at line 268 of file ktitlewidget.cpp.

◆ setText [1/2]

void KTitleWidget::setText ( const QString &  text,
MessageType  type 
)
slot
Parameters
textText 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.
typeThe sort of message it is; will also set the icon accordingly
See also
MessageType
text()

Definition at line 214 of file ktitlewidget.cpp.

◆ setText [2/2]

void KTitleWidget::setText ( const QString &  text,
Qt::Alignment  alignment = Qt::AlignLeft | Qt::AlignVCenter 
)
slot
Parameters
textText 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.
alignmentAlignment of the text. Default is left and vertical centered.
See also
text()

Definition at line 201 of file ktitlewidget.cpp.

◆ setWidget()

void KTitleWidget::setWidget ( QWidget *  widget)
Parameters
widgetWidget displayed on the title widget.

Definition at line 167 of file ktitlewidget.cpp.

◆ showEvent()

void KTitleWidget::showEvent ( QShowEvent *  event)
protected

Definition at line 289 of file ktitlewidget.cpp.

◆ text()

QString KTitleWidget::text ( ) const
Returns
the text displayed in the title
See also
setText()

Definition at line 172 of file ktitlewidget.cpp.

Property Documentation

◆ autoHideTimeout

int KTitleWidget::autoHideTimeout
readwrite

Definition at line 1 of file ktitlewidget.h.

◆ comment

QString KTitleWidget::comment
readwrite

Definition at line 1 of file ktitlewidget.h.

◆ pixmap

QPixmap KTitleWidget::pixmap
readwrite

Definition at line 1 of file ktitlewidget.h.

◆ text

QString KTitleWidget::text
readwrite

Definition at line 1 of file ktitlewidget.h.


The documentation for this class was generated from the following files:
  • ktitlewidget.h
  • ktitlewidget.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal