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

Plasma

Plasma::IconWidget

Plasma::IconWidget Class Reference

#include <iconwidget.h>

Inheritance diagram for Plasma::IconWidget:

Inheritance graph
[legend]

List of all members.


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
QSizeF iconSize () const
 IconWidget (const QIcon &icon, const QString &text, QGraphicsItem *parent=0)
 IconWidget (const QString &text, QGraphicsItem *parent=0)
 IconWidget (QGraphicsItem *parent=0)
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 ~IconWidget ()

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

Detailed Description

Definition at line 54 of file iconwidget.h.


Constructor & Destructor Documentation

IconWidget::IconWidget ( QGraphicsItem *  parent = 0  )  [explicit]

Creates a new Plasma::IconWidget.

Parameters:
parent the QGraphicsItem this icon is parented to.

Definition at line 267 of file iconwidget.cpp.

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

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

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

Definition at line 274 of file iconwidget.cpp.

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

Creates a new Plasma::IconWidget 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 282 of file iconwidget.cpp.

IconWidget::~IconWidget (  )  [virtual]

Destroys this Plasma::IconWidget.

Definition at line 291 of file iconwidget.cpp.


Member Function Documentation

QAction * IconWidget::action (  )  const

Returns:
the currently associated action, if any.

Definition at line 350 of file iconwidget.cpp.

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

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

void IconWidget::addIconAction ( QAction *  action  ) 

Plasma::IconWidget 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::IconWidget.

Parameters:
action the QAction to associate with this icon.

Definition at line 319 of file iconwidget.cpp.

void Plasma::IconWidget::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::IconWidget::clicked (  )  [signal]

Indicates when the icon has been clicked.

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

Indicates when the icon has been double-clicked.

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

For internal use only.

Definition at line 965 of file iconwidget.cpp.

bool IconWidget::drawBackground (  )  const

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

Definition at line 400 of file iconwidget.cpp.

void IconWidget::hoverEnterEvent ( QGraphicsSceneHoverEvent *  event  )  [protected]

Definition at line 1144 of file iconwidget.cpp.

void IconWidget::hoverLeaveEvent ( QGraphicsSceneHoverEvent *  event  )  [protected]

Definition at line 1157 of file iconwidget.cpp.

QIcon Plasma::IconWidget::icon (  )  const

Returns:
the icon associated with this icon.

QSizeF Plasma::IconWidget::iconSize (  )  const

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

QString Plasma::IconWidget::infoText (  )  const

Returns the meta text associated with this icon.

bool IconWidget::invertedLayout (  )  const

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

Definition at line 1233 of file iconwidget.cpp.

void IconWidget::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 1228 of file iconwidget.cpp.

bool IconWidget::isDown (  )  [protected]

Definition at line 1051 of file iconwidget.cpp.

void IconWidget::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  event  )  [protected]

Definition at line 1134 of file iconwidget.cpp.

void IconWidget::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event  )  [protected]

Definition at line 1081 of file iconwidget.cpp.

void IconWidget::mousePressEvent ( QGraphicsSceneMouseEvent *  event  )  [protected]

Definition at line 1056 of file iconwidget.cpp.

void IconWidget::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event  )  [protected]

Definition at line 1101 of file iconwidget.cpp.

int IconWidget::numDisplayLines (  ) 

Returns:
the number of lines allowed to display

Definition at line 369 of file iconwidget.cpp.

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

Definition at line 904 of file iconwidget.cpp.

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

Indicates when the icon has been pressed.

void IconWidget::setAction ( QAction *  action  ) 

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

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

Definition at line 333 of file iconwidget.cpp.

void IconWidget::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 383 of file iconwidget.cpp.

void IconWidget::setIcon ( const QString &  icon  ) 

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

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

Definition at line 1030 of file iconwidget.cpp.

void IconWidget::setIcon ( const QIcon &  icon  ) 

Sets the graphical icon for this Plasma::IconWidget.

Parameters:
icon the KIcon to associate with this icon.

Definition at line 1040 of file iconwidget.cpp.

void IconWidget::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 1008 of file iconwidget.cpp.

void IconWidget::setNumDisplayLines ( int  numLines  ) 

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

Definition at line 374 of file iconwidget.cpp.

void IconWidget::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 1222 of file iconwidget.cpp.

void IconWidget::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 1170 of file iconwidget.cpp.

void IconWidget::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 509 of file iconwidget.cpp.

void IconWidget::setText ( const QString &  text  ) 

Sets the text associated with this icon.

Parameters:
text the text to associate with this icon.

Definition at line 990 of file iconwidget.cpp.

void IconWidget::setUnpressed (  )  [slot]

Shortcut for setPressed(false).

Definition at line 1182 of file iconwidget.cpp.

QPainterPath IconWidget::shape (  )  const

reimplemented from QGraphicsItem

Definition at line 405 of file iconwidget.cpp.

QSizeF IconWidget::sizeFromIconSize ( const qreal  iconWidth  )  const

Returns:
optimal size given a size for the icon
Parameters:
iconWidth desired width of the icon

Definition at line 1238 of file iconwidget.cpp.

QString Plasma::IconWidget::text (  )  const

Returns the text associated with this icon.


Property Documentation

QIcon IconWidget::icon [read, write]

Definition at line 59 of file iconwidget.h.

QSizeF IconWidget::iconSize [read]

Definition at line 60 of file iconwidget.h.

QString IconWidget::infoText [read, write]

Definition at line 58 of file iconwidget.h.

QString Plasma::IconWidget::svg [write]

Definition at line 61 of file iconwidget.h.

QString IconWidget::text [read, write]

Definition at line 57 of file iconwidget.h.


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

Plasma

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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