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

libplasma

Plasma::Icon

Plasma::Icon Class Reference

#include <icon.h>

Inheritance diagram for Plasma::Icon:

Inheritance graph
[legend]

List of all members.


Detailed Description

Definition at line 51 of file icon.h.


Public Slots

void setPressed (bool pressed=true)
void setUnpressed ()

Signals

void activated ()
void changed ()
void clicked ()
void doubleClicked ()
void pressed (bool down)

Public Member Functions

QAction * action () const
void addIconAction (QAction *action)
void drawActionButtonBase (QPainter *painter, const QSize &size, int element)
bool drawBackground () const
QIcon icon () const
 Icon (const QIcon &icon, const QString &text, QGraphicsItem *parent=0)
 Icon (const QString &text, QGraphicsItem *parent=0)
 Icon (QGraphicsItem *parent=0)
QSizeF iconSize () const
QString infoText () const
bool invertedLayout () const
void invertLayout (bool invert)
int numDisplayLines ()
void setAction (QAction *action)
void setDrawBackground (bool draw)
Q_INVOKABLE void setIcon (const QString &icon)
void setIcon (const QIcon &icon)
void setInfoText (const QString &text)
void setNumDisplayLines (int numLines)
void setOrientation (Qt::Orientation orientation)
void setSvg (const QString &svgFilePath, const QString &svgIconElement=QString())
void setText (const QString &text)
QPainterPath shape () const
QSizeF sizeFromIconSize (const qreal iconWidth) const
QString text () const
virtual ~Icon ()

Protected Member Functions

void hoverEnterEvent (QGraphicsSceneHoverEvent *event)
void hoverLeaveEvent (QGraphicsSceneHoverEvent *event)
bool isDown ()
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
void mousePressEvent (QGraphicsSceneMouseEvent *event)
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)

Properties

QIcon icon
QSizeF iconSize
QString infoText
QString svg
QString text

Constructor & Destructor Documentation

Plasma::Icon::Icon ( QGraphicsItem *  parent = 0  )  [explicit]

Creates a new Plasma::Icon.

Parameters:
parent the QGraphicsItem this icon is parented to.

Definition at line 262 of file icon.cpp.

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

Convenience constructor to create a Plasma::Icon with text.

Parameters:
text the text that will be displayed with this icon.
parent the QGraphicsItem this icon is parented to.

Definition at line 269 of file icon.cpp.

Plasma::Icon::Icon ( const QIcon &  icon,
const QString &  text,
QGraphicsItem *  parent = 0 
)

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

Parameters:
icon the icon that will be displayed with this icon.
text the text that will be displayed with this icon.
parent The QGraphicsItem this icon is parented to.

Definition at line 277 of file icon.cpp.

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

Destroys this Plasma::Icon.

Definition at line 286 of file icon.cpp.


Member Function Documentation

QAction * Plasma::Icon::action (  )  const

Returns:
the currently associated action, if any.

Definition at line 345 of file icon.cpp.

void Plasma::Icon::activated (  )  [signal]

Indicates when the icon has been activated following the single or doubleclick settings.

void Plasma::Icon::addIconAction ( QAction *  action  ) 

Plasma::Icon allows the user to specify a number of actions (currently four) to be displayed around the widget.

This method allows for a created QAction to be added to the Plasma::Icon.

Parameters:
action the QAction to associate with this icon.

Definition at line 317 of file icon.cpp.

void Plasma::Icon::changed (  )  [signal]

Indicates that something about the icon may have changed (image, text, etc) only actually works for icons associated with an action.

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

Indicates when the icon has been clicked.

void Plasma::Icon::doubleClicked (  )  [signal]

Indicates when the icon has been double-clicked.

void Plasma::Icon::drawActionButtonBase ( QPainter *  painter,
const QSize &  size,
int  element 
)

Definition at line 947 of file icon.cpp.

bool Plasma::Icon::drawBackground (  )  const

Returns:
true if a background area is to be drawn for the icon

Definition at line 386 of file icon.cpp.

void Plasma::Icon::hoverEnterEvent ( QGraphicsSceneHoverEvent *  event  )  [protected]

Definition at line 1121 of file icon.cpp.

void Plasma::Icon::hoverLeaveEvent ( QGraphicsSceneHoverEvent *  event  )  [protected]

Definition at line 1133 of file icon.cpp.

QIcon Plasma::Icon::icon (  )  const

Returns:
the icon associated with this icon.

QSizeF Plasma::Icon::iconSize (  )  const

Returns:
the size of this Plasma::Icon's graphical icon.

QString Plasma::Icon::infoText (  )  const

Returns the meta text associated with this icon.

bool Plasma::Icon::invertedLayout (  )  const

Returns:
if the layout of the icons should appear inverted or not

Definition at line 1189 of file icon.cpp.

void Plasma::Icon::invertLayout ( bool  invert  ) 

inverts the layout of the icons if the orientation is horizontal, normally we get icon on the left with left-to-right languages

Parameters:
invert if we want to invert the layout of icons

Definition at line 1184 of file icon.cpp.

bool Plasma::Icon::isDown (  )  [protected]

Definition at line 1028 of file icon.cpp.

void Plasma::Icon::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  event  )  [protected]

Definition at line 1111 of file icon.cpp.

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

Definition at line 1058 of file icon.cpp.

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

Definition at line 1033 of file icon.cpp.

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

Definition at line 1078 of file icon.cpp.

int Plasma::Icon::numDisplayLines (  ) 

Returns:
the number of lines allowed to display

Definition at line 364 of file icon.cpp.

void Plasma::Icon::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget = 0 
) [protected]

Definition at line 871 of file icon.cpp.

void Plasma::Icon::pressed ( bool  down  )  [signal]

Indicates when the icon has been pressed.

void Plasma::Icon::setAction ( QAction *  action  ) 

Associate an action with this Icon this makes the Icon follow the state of the action, using its icon, text, etc.

when the Icon is clicked, it will also trigger the action. Unlike addIconAction, there can be only one associated action.

Definition at line 331 of file icon.cpp.

void Plasma::Icon::setDrawBackground ( bool  draw  ) 

Sets whether or not to draw a background area for the icon.

  • draw true if a background should be drawn or not

Definition at line 378 of file icon.cpp.

void Plasma::Icon::setIcon ( const QString &  icon  ) 

Convenience method to set the icon of this Plasma::Icon using a QString path to the icon.

Parameters:
icon the path to the icon to associate with this Plasma::Icon.

Definition at line 1008 of file icon.cpp.

void Plasma::Icon::setIcon ( const QIcon &  icon  ) 

Sets the graphical icon for this Plasma::Icon.

Parameters:
icon the KIcon to associate with this icon.

Definition at line 1018 of file icon.cpp.

void Plasma::Icon::setInfoText ( const QString &  text  ) 

Sets the additional information to be displayed by this icon.

Parameters:
text additional meta text associated with this icon.

Definition at line 988 of file icon.cpp.

void Plasma::Icon::setNumDisplayLines ( int  numLines  ) 

Parameters:
numLines the number of lines to show in the display.

Definition at line 369 of file icon.cpp.

void Plasma::Icon::setOrientation ( Qt::Orientation  orientation  ) 

let set the orientation of the icon Qt::Vertical: text under the icon Qt::Horizontal text at a side of the icon depending by the direction of the language

Parameters:
orientation the orientation we want

Definition at line 1178 of file icon.cpp.

void Plasma::Icon::setPressed ( bool  pressed = true  )  [slot]

Sets the appearance of the icon to pressed or restores the appearance to normal.

This does not simulate a mouse button press.

Parameters:
pressed whether to appear as pressed (true) or as normal (false)

Definition at line 1146 of file icon.cpp.

void Plasma::Icon::setSvg ( const QString &  svgFilePath,
const QString &  svgIconElement = QString() 
)

Convenience method to set the svg image to use when given the filepath and name of svg.

Parameters:
svgFilePath the svg filepath including name of the svg.
svgIconElement the svg element to use when displaying the svg. Defaults to all of them.

Definition at line 493 of file icon.cpp.

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

Sets the text associated with this icon.

Parameters:
text the text to associate with this icon.

Definition at line 973 of file icon.cpp.

void Plasma::Icon::setUnpressed (  )  [slot]

Shortcut for setPressed(false).

Definition at line 1158 of file icon.cpp.

QPainterPath Plasma::Icon::shape (  )  const

reimplemented from QGraphicsItem

Definition at line 391 of file icon.cpp.

QSizeF Plasma::Icon::sizeFromIconSize ( const qreal  iconWidth  )  const

Returns:
optimal size given a size for the icon

Parameters:
iconWidth desired width of the icon

Definition at line 1194 of file icon.cpp.

QString Plasma::Icon::text (  )  const

Returns the text associated with this icon.


Property Documentation

QIcon Plasma::Icon::icon [read, write]

Definition at line 56 of file icon.h.

QSizeF Plasma::Icon::iconSize [read]

Definition at line 57 of file icon.h.

QString Plasma::Icon::infoText [read, write]

Definition at line 55 of file icon.h.

QString Plasma::Icon::svg [write]

Definition at line 58 of file icon.h.

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

Definition at line 54 of file icon.h.


The documentation for this class was generated from the following files:
  • icon.h
  • icon.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
  •   libsolidcontrol
  •   libtaskmanager
  • 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