• Skip to content
  • Skip to link menu
KDE 4.0 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 48 of file icon.h.


Public Slots

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

Signals

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

Public Member Functions

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

Protected Member Functions

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

Properties

QString text
QString infoText
QIcon icon
QSizeF iconSize
QString svg

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 236 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 243 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 251 of file icon.cpp.

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

Destroys this Plasma::Icon.

Definition at line 260 of file icon.cpp.


Member Function Documentation

QString Plasma::Icon::text (  )  const

Returns the text associated with this icon.

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 895 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 487 of file icon.cpp.

QString Plasma::Icon::infoText (  )  const

Returns the meta text associated with this icon.

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 907 of file icon.cpp.

QIcon Plasma::Icon::icon (  )  const

Returns:
the icon associated with this icon.

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 934 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 924 of file icon.cpp.

QSizeF Plasma::Icon::iconSize (  )  const

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

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

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

This method allows for a created QAction (not a KAction!) to be added to the Plasma::Icon.

Parameters:
action the QAction to associate with this icon.

Definition at line 287 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 1076 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 1081 of file icon.cpp.

bool Plasma::Icon::invertedLayout (  )  const

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

Definition at line 1086 of file icon.cpp.

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

Returns:
optimal size given a size for the icon

Parameters:
iconWidth desidered width of the icon

Definition at line 1091 of file icon.cpp.

int Plasma::Icon::numDisplayLines (  ) 

Returns:
the number of lines allowed to display

Definition at line 330 of file icon.cpp.

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

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

Definition at line 335 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 345 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 353 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 1061 of file icon.cpp.

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

Shortcut for setPressed(false).

Definition at line 1071 of file icon.cpp.

void Plasma::Icon::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 809 of file icon.cpp.

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

Indicates when the icon has been pressed.

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.

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

Definition at line 944 of file icon.cpp.

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

Reimplemented from QGraphicsItem.

Definition at line 949 of file icon.cpp.

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

Reimplemented from QGraphicsItem.

Definition at line 973 of file icon.cpp.

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

Reimplemented from QGraphicsItem.

Definition at line 995 of file icon.cpp.

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

Reimplemented from QGraphicsItem.

Definition at line 1027 of file icon.cpp.

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

Reimplemented from QGraphicsItem.

Definition at line 1035 of file icon.cpp.

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

Reimplemented from QGraphicsItem.

Definition at line 1048 of file icon.cpp.

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

Definition at line 869 of file icon.cpp.


Property Documentation

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

Definition at line 51 of file icon.h.

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

Definition at line 52 of file icon.h.

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

Definition at line 53 of file icon.h.

QSizeF Plasma::Icon::iconSize [read]

Definition at line 54 of file icon.h.

QString Plasma::Icon::svg [write]

Definition at line 55 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
  • 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