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

libplasma

Plasma::PushButton

Plasma::PushButton Class Reference

#include <pushbutton.h>

Inheritance diagram for Plasma::PushButton:

Inheritance graph
[legend]

List of all members.


Detailed Description

Class that emulates a QPushButton inside Plasma.

Author:
Siraj Razick

Matias Valdenegro

Matt Broadstone

Definition at line 48 of file pushbutton.h.


Signals

void clicked ()
void toggled (bool checked)

Public Member Functions

 PushButton (Widget *parent=0)
 PushButton (const QString &text, Widget *parent=0)
 PushButton (const KIcon &icon, const QString &text, Widget *parent=0)
virtual ~PushButton ()
QString text () const
void setText (const QString &text)
KIcon icon () const
void setIcon (const KIcon &icon)
Q_INVOKABLE void setIcon (const QString &path)
QSizeF iconSize () const
void setIconSize (const QSizeF &size)
bool isDown () const
bool isFlat () const
void setFlat (bool flat)
bool isCheckable () const
void setCheckable (bool checkable)
bool isChecked () const
void setChecked (bool checked)
QSizeF minimumSize () const
Qt::Orientations expandingDirections () const
QSizeF sizeHint () const

Protected Member Functions

void mousePressEvent (QGraphicsSceneMouseEvent *event)
void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
void paintWidget (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)

Properties

QString text
QSizeF iconSize
KIcon icon
bool flat
bool checkable
bool checked

Constructor & Destructor Documentation

Plasma::PushButton::PushButton ( Widget *  parent = 0  )  [explicit]

Creates a new Plasma::PushButton.

Parameters:
parent the Widge this button is parented to.

Definition at line 120 of file pushbutton.cpp.

Plasma::PushButton::PushButton ( const QString &  text,
Widget *  parent = 0 
) [explicit]

Creates a new Plasma::PushButton with a text label.

Parameters:
text the text to display next to the button.
parent the QGraphicsItem this icon is parented to.

Definition at line 127 of file pushbutton.cpp.

Plasma::PushButton::PushButton ( const KIcon &  icon,
const QString &  text,
Widget *  parent = 0 
) [explicit]

Creates a new Plasma::PushButton with an icon and text.

Parameters:
icon the icon to display with this button.
text the text to display with this button.
parent the QGraphicsItem this icon is parented to.

Definition at line 135 of file pushbutton.cpp.

Plasma::PushButton::~PushButton (  )  [virtual]

Destroys this Plasma::PushButton.

Definition at line 144 of file pushbutton.cpp.


Member Function Documentation

QString Plasma::PushButton::text (  )  const

Returns:
text associated with this Plasma::PushButton

void Plasma::PushButton::setText ( const QString &  text  ) 

Sets the text to be displayed by this button.

Parameters:
text the text to display

Definition at line 162 of file pushbutton.cpp.

KIcon Plasma::PushButton::icon (  )  const

Returns:
the icon displayed by this button.

void Plasma::PushButton::setIcon ( const KIcon &  icon  ) 

Sets the icon to be displayed by this Plasma::Icon.

Parameters:
icon the KIcon to display.

Definition at line 173 of file pushbutton.cpp.

void Plasma::PushButton::setIcon ( const QString &  path  ) 

Convenience method to set the icon of this Plasma::PushButton based on the icon path, or name.

See also:
KIconLoader
Parameters:
path the path to, or name of the icon to display.

Definition at line 179 of file pushbutton.cpp.

QSizeF Plasma::PushButton::iconSize (  )  const

Returns:
the size of the icon displayed by this Plasma::PushButton.

void Plasma::PushButton::setIconSize ( const QSizeF &  size  ) 

Sets the size of icon shown by this button.

Parameters:
size size of the icon.

Definition at line 199 of file pushbutton.cpp.

bool Plasma::PushButton::isDown (  )  const

Returns:
whether this button is currently in a down/pressed state.

Definition at line 208 of file pushbutton.cpp.

bool Plasma::PushButton::isFlat (  )  const

Returns:
whether this button is drawn flat.

Definition at line 213 of file pushbutton.cpp.

void Plasma::PushButton::setFlat ( bool  flat  ) 

Sets whether the button is drawn flat.

Parameters:
flat whether to draw it flat or not.

Definition at line 218 of file pushbutton.cpp.

bool Plasma::PushButton::isCheckable (  )  const

Returns:
whether this button is checkable.

Definition at line 237 of file pushbutton.cpp.

void Plasma::PushButton::setCheckable ( bool  checkable  ) 

Sets whether the button is checkable.

Parameters:
checkable whether button is checkable or not.

Definition at line 242 of file pushbutton.cpp.

bool Plasma::PushButton::isChecked (  )  const

Returns:
whether this button is checked.

Definition at line 224 of file pushbutton.cpp.

void Plasma::PushButton::setChecked ( bool  checked  ) 

Sets whether the button is checked.

Parameters:
checked whether button is checked or not.

Definition at line 229 of file pushbutton.cpp.

QSizeF Plasma::PushButton::minimumSize (  )  const [virtual]

Returns:
minimum size of the Widget.

Reimplemented from Plasma::Widget.

Definition at line 285 of file pushbutton.cpp.

Qt::Orientations Plasma::PushButton::expandingDirections (  )  const [virtual]

This method is used by Plasma::Layout to determine which directions the widget naturally expands.

Returns:
bitmask with the directions that this Widget can be expanded.

Reimplemented from Plasma::Widget.

Definition at line 291 of file pushbutton.cpp.

QSizeF Plasma::PushButton::sizeHint (  )  const [virtual]

Returns the recommended size for this widget.

Note that this size is not necessarily only the size for the widget, but might also include margins etc.

Returns:
recommended size for this Plasma::Widget.

Reimplemented from Plasma::Widget.

Definition at line 296 of file pushbutton.cpp.

void Plasma::PushButton::clicked (  )  [signal]

Triggered when the button has been clicked.

void Plasma::PushButton::toggled ( bool  checked  )  [signal]

Triggered when the checkable button has been toggled.

void Plasma::PushButton::mousePressEvent ( QGraphicsSceneMouseEvent *  event  )  [protected]

Reimplemented from QGraphicsItem.

Definition at line 247 of file pushbutton.cpp.

void Plasma::PushButton::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event  )  [protected]

Reimplemented from QGraphicsItem.

Definition at line 254 of file pushbutton.cpp.

void Plasma::PushButton::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event  )  [protected]

Reimplemented from QGraphicsItem.

Definition at line 270 of file pushbutton.cpp.

void Plasma::PushButton::paintWidget ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget = 0 
) [protected, virtual]

Paints the widget.

Parameters:
painter the QPainter to use to paint.
option the style option used to give specific info on the item being dawn.
widget the parent QWidget (most likely the Corona)

Reimplemented from Plasma::Widget.

Definition at line 149 of file pushbutton.cpp.


Property Documentation

QString Plasma::PushButton::text [read, write]

Definition at line 51 of file pushbutton.h.

QSizeF Plasma::PushButton::iconSize [read, write]

Definition at line 52 of file pushbutton.h.

KIcon Plasma::PushButton::icon [read, write]

Definition at line 53 of file pushbutton.h.

bool Plasma::PushButton::flat [read, write]

Definition at line 54 of file pushbutton.h.

bool Plasma::PushButton::checkable [read, write]

Definition at line 55 of file pushbutton.h.

bool Plasma::PushButton::checked [read, write]

Definition at line 56 of file pushbutton.h.


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

libplasma

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

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference 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