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

Plasma

  • Plasma
  • IconWidget
Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
Plasma::IconWidget Class Reference

#include <iconwidget.h>

Inheritance diagram for Plasma::IconWidget:
Inheritance graph
[legend]

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

 IconWidget (QGraphicsItem *parent=0)
 
 IconWidget (const QString &text, QGraphicsItem *parent=0)
 
 IconWidget (const QIcon &icon, const QString &text, QGraphicsItem *parent=0)
 
virtual ~IconWidget ()
 
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
 
QString infoText () const
 
bool invertedLayout () const
 
void invertLayout (bool invert)
 
QSizeF maximumIconSize () const
 
QSizeF minimumIconSize () const
 
int numDisplayLines ()
 
Qt::Orientation orientation () const
 
QSizeF preferredIconSize () const
 
void removeIconAction (QAction *action)
 
void setAction (QAction *action)
 
void setDrawBackground (bool draw)
 
void setIcon (const QIcon &icon)
 
Q_INVOKABLE void setIcon (const QString &icon)
 
void setInfoText (const QString &text)
 
void setMaximumIconSize (const QSizeF &size)
 
void setMinimumIconSize (const QSizeF &size)
 
void setNumDisplayLines (int numLines)
 
void setOrientation (Qt::Orientation orientation)
 
void setPreferredIconSize (const QSizeF &size)
 
void setSvg (const QString &svgFilePath, const QString &svgIconElement=QString())
 
void setText (const QString &text)
 
void setTextBackgroundColor (const QColor &color)
 
QPainterPath shape () const
 
Q_INVOKABLE QSizeF sizeFromIconSize (const qreal iconWidth) const
 
QString svg () const
 
QString text () const
 
QColor textBackgroundColor () const
 

Protected Member Functions

void changeEvent (QEvent *event)
 
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)
 
bool sceneEventFilter (QGraphicsItem *watched, QEvent *event)
 
QSizeF sizeHint (Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const
 

Properties

QAction action
 
bool drawBackground
 
QIcon icon
 
QSizeF iconSize
 
QString infoText
 
QSizeF maximumIconSize
 
QSizeF minimumIconSize
 
int numDisplayLines
 
Qt::Orientation orientation
 
QSizeF preferredIconSize
 
QString svg
 
QString text
 
QColor textBackgroundColor
 

Detailed Description

Definition at line 56 of file iconwidget.h.

Constructor & Destructor Documentation

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

Creates a new Plasma::IconWidget.

Parameters
parentthe QGraphicsItem this icon is parented to.

Definition at line 351 of file iconwidget.cpp.

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

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

Parameters
textthe text that will be displayed with this icon.
parentthe QGraphicsItem this icon is parented to.

Definition at line 358 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
iconthe icon that will be displayed with this icon.
textthe text that will be displayed with this icon.
parentThe QGraphicsItem this icon is parented to.

Definition at line 366 of file iconwidget.cpp.

IconWidget::~IconWidget ( )
virtual

Destroys this Plasma::IconWidget.

Definition at line 375 of file iconwidget.cpp.

Member Function Documentation

QAction* Plasma::IconWidget::action ( ) const
Returns
the currently associated action, if any.
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
actionthe QAction to associate with this icon.

Definition at line 415 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 IconWidget::changeEvent ( QEvent *  event)
protected

Definition at line 1629 of file iconwidget.cpp.

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 
)

Definition at line 1242 of file iconwidget.cpp.

bool Plasma::IconWidget::drawBackground ( ) const
Returns
true if a background area is to be drawn for the icon
void IconWidget::hoverEnterEvent ( QGraphicsSceneHoverEvent *  event)
protected

Definition at line 1484 of file iconwidget.cpp.

void IconWidget::hoverLeaveEvent ( QGraphicsSceneHoverEvent *  event)
protected

Definition at line 1498 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 1566 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
invertif we want to invert the layout of icons

Definition at line 1561 of file iconwidget.cpp.

bool IconWidget::isDown ( )
protected

Definition at line 1381 of file iconwidget.cpp.

QSizeF Plasma::IconWidget::maximumIconSize ( ) const
Returns
The size that should be the maximum beyond the icon shouldn't scale when the icon will be when positioned in a layout. The default is QSizeF(-1, -1); an invalid size means the icon will attempt to be at its default and "optimal" size
Since
4.5
QSizeF Plasma::IconWidget::minimumIconSize ( ) const
Returns
The size that should be the minimum beyond the icon shouldn't scale when the icon will be when positioned in a layout. The default is QSizeF(-1, -1); an invalid size means the icon will attempt to be at its default and "optimal" size
Since
4.5
void IconWidget::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  event)
protected

Definition at line 1470 of file iconwidget.cpp.

void IconWidget::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
protected

Definition at line 1413 of file iconwidget.cpp.

void IconWidget::mousePressEvent ( QGraphicsSceneMouseEvent *  event)
protected

Definition at line 1386 of file iconwidget.cpp.

void IconWidget::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
protected

Definition at line 1433 of file iconwidget.cpp.

int Plasma::IconWidget::numDisplayLines ( )
Returns
the number of lines allowed to display
Qt::Orientation Plasma::IconWidget::orientation ( ) const
Returns
the orientation of the icon
void IconWidget::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget = 0 
)
protected

Definition at line 1136 of file iconwidget.cpp.

QSizeF Plasma::IconWidget::preferredIconSize ( ) const
Returns
The size you prefer the icon will be when positioned in a layout. The default is QSizeF(-1, -1); an invalid size means the icon will attempt to be at its default and "optimal" size
Since
4.5
void Plasma::IconWidget::pressed ( bool  down)
signal

Indicates when the icon has been pressed.

void IconWidget::removeIconAction ( QAction *  action)

Removes a previously set iconAction.

The action will be removed from the widget but will not be deleted.

Parameters
theQAction to be removed, if 0 all actions will be removed

Definition at line 430 of file iconwidget.cpp.

bool IconWidget::sceneEventFilter ( QGraphicsItem *  watched,
QEvent *  event 
)
protected

Definition at line 1514 of file iconwidget.cpp.

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 458 of file iconwidget.cpp.

void IconWidget::setDrawBackground ( bool  draw)

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

Parameters
drawtrue if a background should be drawn or not

Definition at line 482 of file iconwidget.cpp.

void IconWidget::setIcon ( const QIcon &  icon)

Sets the graphical icon for this Plasma::IconWidget.

Parameters
iconthe KIcon to associate with this icon.

Definition at line 1324 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
iconthe path to the icon to associate with this Plasma::IconWidget.

Definition at line 1314 of file iconwidget.cpp.

void IconWidget::setInfoText ( const QString &  text)

Sets the additional information to be displayed by this icon.

Parameters
textadditional meta text associated with this icon.

Definition at line 1288 of file iconwidget.cpp.

void IconWidget::setMaximumIconSize ( const QSizeF &  size)

Set the size that should be the maximum beyond the icon shouldn't scale when the icon will be when positioned in a layout.

Parameters
preferredicon size, pass an invalid size to unset this value
Since
4.5

Definition at line 1370 of file iconwidget.cpp.

void IconWidget::setMinimumIconSize ( const QSizeF &  size)

Set the size that should be the minimum beyond the icon shouldn't scale when the icon will be when positioned in a layout.

Parameters
preferredicon size, pass an invalid size to unset this value
Since
4.5

Definition at line 1359 of file iconwidget.cpp.

void IconWidget::setNumDisplayLines ( int  numLines)
Parameters
numLinesthe number of lines to show in the display.

Definition at line 473 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
orientationthe orientation we want

Definition at line 1550 of file iconwidget.cpp.

void IconWidget::setPreferredIconSize ( const QSizeF &  size)

Set the size you prefer the icon will be when positioned in a layout.

Parameters
preferredicon size, pass an invalid size to unset this value
Since
4.5

Definition at line 1348 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
pressedwhether to appear as pressed (true) or as normal (false)

Definition at line 1527 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
svgFilePaththe svg filepath including name of the svg.
svgIconElementthe svg element to use when displaying the svg. Defaults to all of them.

Definition at line 634 of file iconwidget.cpp.

void IconWidget::setText ( const QString &  text)

Sets the text associated with this icon.

Parameters
textthe text to associate with this icon.

Definition at line 1267 of file iconwidget.cpp.

void IconWidget::setTextBackgroundColor ( const QColor &  color)

Sets the color to use behind the text of the icon.

Parameters
colorthe color, or QColor() to reset it to no background color
Since
4.3

Definition at line 1230 of file iconwidget.cpp.

void IconWidget::setUnpressed ( )
slot

Shortcut for setPressed(false)

Definition at line 1539 of file iconwidget.cpp.

QPainterPath IconWidget::shape ( ) const

reimplemented from QGraphicsItem

Definition at line 515 of file iconwidget.cpp.

QSizeF IconWidget::sizeFromIconSize ( const qreal  iconWidth) const
Returns
optimal size given a size for the icon
Parameters
iconWidthdesired width of the icon

Definition at line 1571 of file iconwidget.cpp.

QSizeF IconWidget::sizeHint ( Qt::SizeHint  which,
const QSizeF &  constraint = QSizeF() 
) const
protected

Definition at line 681 of file iconwidget.cpp.

QString Plasma::IconWidget::svg ( ) const
Returns
the path to the svg file set, if any
QString Plasma::IconWidget::text ( ) const

Returns the text associated with this icon.

QColor Plasma::IconWidget::textBackgroundColor ( ) const
Returns
the color to use behind the text of the icon
Since
4.3

Property Documentation

QAction * IconWidget::action
readwrite

Definition at line 66 of file iconwidget.h.

bool IconWidget::drawBackground
readwrite

Definition at line 65 of file iconwidget.h.

QIcon IconWidget::icon
readwrite

Definition at line 61 of file iconwidget.h.

QSizeF IconWidget::iconSize
read

Definition at line 63 of file iconwidget.h.

QString IconWidget::infoText
readwrite

Definition at line 60 of file iconwidget.h.

QSizeF IconWidget::maximumIconSize
readwrite

Definition at line 71 of file iconwidget.h.

QSizeF IconWidget::minimumIconSize
readwrite

Definition at line 70 of file iconwidget.h.

int IconWidget::numDisplayLines
readwrite

Definition at line 68 of file iconwidget.h.

Qt::Orientation IconWidget::orientation
readwrite

Definition at line 67 of file iconwidget.h.

QSizeF IconWidget::preferredIconSize
readwrite

Definition at line 69 of file iconwidget.h.

QString IconWidget::svg
readwrite

Definition at line 64 of file iconwidget.h.

QString IconWidget::text
readwrite

Definition at line 59 of file iconwidget.h.

QColor IconWidget::textBackgroundColor
readwrite

Definition at line 62 of file iconwidget.h.


The documentation for this class was generated from the following files:
  • iconwidget.h
  • iconwidget.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:35 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal