KGuiItem

Search for usage in LXR

#include <KGuiItem>

Public Member Functions

 KGuiItem ()
 
 KGuiItem (const KGuiItem &other)
 
 KGuiItem (const QString &text, const QIcon &icon, const QString &toolTip=QString(), const QString &whatsThis=QString())
 
 KGuiItem (const QString &text, const QString &iconName=QString(), const QString &toolTip=QString(), const QString &whatsThis=QString())
 
 ~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.nosp@m.er@y.nosp@m.ahoo..nosp@m.com
See also
KStandardGuiItem

Definition at line 33 of file kguiitem.h.

Constructor & Destructor Documentation

◆ KGuiItem() [1/4]

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 39 of file kguiitem.cpp.

◆ KGuiItem() [2/4]

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 44 of file kguiitem.cpp.

◆ KGuiItem() [3/4]

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 53 of file kguiitem.cpp.

◆ KGuiItem() [4/4]

KGuiItem::KGuiItem ( const KGuiItem & other)
default

Constructs a copy of other.

◆ ~KGuiItem()

KGuiItem::~KGuiItem ( )
default

Destructor.

Member Function Documentation

◆ assign()

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, of Yes and No standard type
// Assign the text and icon from KStandardGuiItem::quit()/continue() to the buttons in the
// button dialog box
KGuiItem::assign(buttonBox->button(QDialogButtonBox::No), KStandardGuiItem::continue());
static void assign(QPushButton *button, const KGuiItem &item)
A static method that can be used to set the text, icon, tooltip and WhatThis properties from item on ...
Definition kguiitem.cpp:172
KGuiItem quit()
Returns the 'Quit' gui item.

Definition at line 172 of file kguiitem.cpp.

◆ hasIcon()

bool KGuiItem::hasIcon ( ) const

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

Definition at line 133 of file kguiitem.cpp.

◆ icon()

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 101 of file kguiitem.cpp.

◆ iconName()

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 113 of file kguiitem.cpp.

◆ isEnabled()

bool KGuiItem::isEnabled ( ) const

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

See also
QWidget::isEnabled()

Definition at line 128 of file kguiitem.cpp.

◆ operator=()

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

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

◆ plainText()

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 73 of file kguiitem.cpp.

◆ setEnabled()

void KGuiItem::setEnabled ( bool enable)

Toggles the enabled property of this GUI item.

See also
QWidget::setEnabled()

Definition at line 167 of file kguiitem.cpp.

◆ setIcon()

void KGuiItem::setIcon ( const QIcon & iconset)

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

Definition at line 143 of file kguiitem.cpp.

◆ setIconName()

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 150 of file kguiitem.cpp.

◆ setText()

void KGuiItem::setText ( const QString & text)

Sets the text to use for this GUI item.

Definition at line 138 of file kguiitem.cpp.

◆ setToolTip()

void KGuiItem::setToolTip ( const QString & tooltip)

Sets the tooltip text.

Definition at line 157 of file kguiitem.cpp.

◆ setWhatsThis()

void KGuiItem::setWhatsThis ( const QString & whatsThis)

Sets the WhatThis text.

Definition at line 162 of file kguiitem.cpp.

◆ text()

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 68 of file kguiitem.cpp.

◆ toolTip()

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 118 of file kguiitem.cpp.

◆ whatsThis()

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 123 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-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.