KGuiItem

#include <KGuiItem>

Public Member Functions

 KGuiItem ()
 
 KGuiItem (const QString &text, const QString &iconName=QString(), const QString &toolTip=QString(), const QString &whatsThis=QString())
 
 KGuiItem (const QString &text, const QIcon &icon, const QString &toolTip=QString(), const QString &whatsThis=QString())
 
 KGuiItem (const KGuiItem &other)
 
 ~KGuiItem ()
 
bool hasIcon () const
 
QIcon icon () const
 
QString iconName () const
 
bool isEnabled () const
 
KGuiItemoperator= (const KGuiItem &other)
 
QString plainText () const
 
void setEnabled (bool enable)
 
void setIcon (const QIcon &iconset)
 
void setIconName (const QString &iconName)
 
void setText (const QString &text)
 
void setToolTip (const QString &tooltip)
 
void setWhatsThis (const QString &whatsThis)
 
QString text () const
 
QString toolTip () const
 
QString whatsThis () const
 

Static Public Member Functions

static void assign (QPushButton *button, const KGuiItem &item)
 

Detailed Description

An abstract class for setting the text, icon, tooltip and WhatsThis data on a GUI item (e.g.

a QPushButton).

Author
Holger Freyther freyh[email protected][email protected][email protected]ahoo.[email protected]com
See also
KStandardGuiItem

Definition at line 32 of file kguiitem.h.

Constructor & Destructor Documentation

KGuiItem::KGuiItem ( )

Constructs an empty KGuiItem.

You can use the various methods provided by this class to set the text, icon... etc.

Definition at line 53 of file kguiitem.cpp.

KGuiItem::KGuiItem ( const QString text,
const QString iconName = QString(),
const QString toolTip = QString(),
const QString whatsThis = QString() 
)
explicit

Constructs a KGuiItem with the provided arguments.

Parameters
textthe text to use with the GUI item
iconNamethe name of the icon to display next to the text on the item; QIcon::fromTheme() is used to get a icon with that name from the icon themes available on the system
tooltipthe tooltip to use for this item
whatsThisthe text to use for the WhatThis help message

Definition at line 58 of file kguiitem.cpp.

KGuiItem::KGuiItem ( const QString text,
const QIcon icon,
const QString toolTip = QString(),
const QString whatsThis = QString() 
)

Constructs a KGuiItem with the provided arguments.

Parameters
textthe text to use with the GUI item
iconthe QIcon object used to get an icon to display next to the text on this item
tooltipthe tooltip to use for this item
whatsThisthe text to use for the WhatThis help message

Definition at line 68 of file kguiitem.cpp.

KGuiItem::KGuiItem ( const KGuiItem other)

Constructs a copy of other.

Definition at line 78 of file kguiitem.cpp.

KGuiItem::~KGuiItem ( )

Destructor.

Definition at line 98 of file kguiitem.cpp.

Member Function Documentation

void KGuiItem::assign ( QPushButton button,
const KGuiItem item 
)
static

A static method that can be used to set the text, icon, tooltip and WhatThis properties from item on button.

// Create a QDialogButtonBox with two buttons, Yes and No
// Assing the text and icon from KStandardGuiItem::yes()/no() to the buttons in the
// button dialog box

Definition at line 207 of file kguiitem.cpp.

bool KGuiItem::hasIcon ( ) const

Returns true if this GUI item has an icon set for it and false otherwise.

Definition at line 168 of file kguiitem.cpp.

QIcon KGuiItem::icon ( ) const

Returns the icon used by this GUI item.

This will return a null QIcon if no icon was previously set for this item.

Definition at line 136 of file kguiitem.cpp.

QString KGuiItem::iconName ( ) const

Returns the name of the icon used by this GUI item.

This will return an empty string if no icon was previously set for this item.

Definition at line 148 of file kguiitem.cpp.

bool KGuiItem::isEnabled ( ) const

Returns true if this GUI item is enabled and false otherwise.

See also
QWidget::isEnabled()

Definition at line 163 of file kguiitem.cpp.

KGuiItem & KGuiItem::operator= ( const KGuiItem other)

Assigns other to this KGuiItem object and returns a reference to this object.

Definition at line 84 of file kguiitem.cpp.

QString KGuiItem::plainText ( ) const

Returns the text used by this GUI item after stripping all existing '&' characters which denote keyboard accelerators.

See also
text()

Definition at line 108 of file kguiitem.cpp.

void KGuiItem::setEnabled ( bool  enable)

Toggles the enabled property of this GUI item.

See also
QWidget::setEnabled()

Definition at line 202 of file kguiitem.cpp.

void KGuiItem::setIcon ( const QIcon iconset)

Sets the icon to be shown next to the text of this GUI item.

Definition at line 178 of file kguiitem.cpp.

void KGuiItem::setIconName ( const QString iconName)

Sets the name of the icon that will be shown next to the text of this GUI item.

The actual QIcon will be obtained by using QIcon::fromTheme().

Definition at line 185 of file kguiitem.cpp.

void KGuiItem::setText ( const QString text)

Sets the text to use for this GUI item.

Definition at line 173 of file kguiitem.cpp.

void KGuiItem::setToolTip ( const QString tooltip)

Sets the tooltip text.

Definition at line 192 of file kguiitem.cpp.

void KGuiItem::setWhatsThis ( const QString whatsThis)

Sets the WhatThis text.

Definition at line 197 of file kguiitem.cpp.

QString KGuiItem::text ( ) const

Returns the text used by this GUI item; this may contain '&' characters which denote a keyboard accelerator shortcut that can be used to invoke the GUI item, e.g.

Alt + 'O' for button "&OK". (Note that the '&' is not visible to the user).

You can get the plain text without the accelerator denoting character '&', by using plainText().

Definition at line 103 of file kguiitem.cpp.

QString KGuiItem::toolTip ( ) const

Returns the tooltip used for this GUI item.

This will return an empty string if no tooltip was previously set for this item.

Definition at line 153 of file kguiitem.cpp.

QString KGuiItem::whatsThis ( ) const

Returns the WhatThis text used for this GUI item.

This will return an empty string if no WhatThis text was previously set for this item.

Definition at line 158 of file kguiitem.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 22:44:44 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.