Plasma
Plasma::IconWidget Class Reference
#include <iconwidget.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 |
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 () |
Qt::Orientation | orientation () const |
void | removeIconAction (QAction *action) |
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) |
void | setTextBackgroundColor (const QColor &color) |
QPainterPath | shape () const |
QSizeF | sizeFromIconSize (const qreal iconWidth) const |
QString | svg () const |
QString | text () const |
QColor | textBackgroundColor () 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) |
bool | sceneEventFilter (QGraphicsItem *watched, QEvent *event) |
Properties | |
QAction | action |
QIcon | icon |
QSizeF | iconSize |
QString | infoText |
int | numDisplayLines |
Qt::Orientation | orientation |
QString | svg |
QString | text |
QColor | textBackgroundColor |
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 290 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 297 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 305 of file iconwidget.cpp.
IconWidget::~IconWidget | ( | ) | [virtual] |
Destroys this Plasma::IconWidget.
Definition at line 314 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:
-
action the QAction to associate with this icon.
Definition at line 347 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 | |||
) |
bool IconWidget::drawBackground | ( | ) | const |
- Returns:
- true if a background area is to be drawn for the icon
Definition at line 431 of file iconwidget.cpp.
void IconWidget::hoverEnterEvent | ( | QGraphicsSceneHoverEvent * | event | ) | [protected] |
Definition at line 1199 of file iconwidget.cpp.
void IconWidget::hoverLeaveEvent | ( | QGraphicsSceneHoverEvent * | event | ) | [protected] |
Definition at line 1213 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 1281 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 1276 of file iconwidget.cpp.
bool IconWidget::isDown | ( | ) | [protected] |
Definition at line 1106 of file iconwidget.cpp.
void IconWidget::mouseDoubleClickEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected] |
Definition at line 1189 of file iconwidget.cpp.
void IconWidget::mouseMoveEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected] |
Definition at line 1136 of file iconwidget.cpp.
void IconWidget::mousePressEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected] |
Definition at line 1111 of file iconwidget.cpp.
void IconWidget::mouseReleaseEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected] |
Definition at line 1156 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 932 of file iconwidget.cpp.
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.
Definition at line 362 of file iconwidget.cpp.
bool IconWidget::sceneEventFilter | ( | QGraphicsItem * | watched, | |
QEvent * | event | |||
) | [protected] |
Definition at line 1227 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 390 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 414 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 1085 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 1095 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 1063 of file iconwidget.cpp.
void IconWidget::setNumDisplayLines | ( | int | numLines | ) |
- Parameters:
-
numLines the number of lines to show in the display.
Definition at line 405 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 1265 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 1242 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 540 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 1045 of file iconwidget.cpp.
void IconWidget::setTextBackgroundColor | ( | const QColor & | color | ) |
Sets the color to use behind the text of the icon.
- Parameters:
-
color the color, or QColor() to reset it to no background color
- Since:
- 4.3
Definition at line 1008 of file iconwidget.cpp.
void IconWidget::setUnpressed | ( | ) | [slot] |
Shortcut for setPressed(false).
Definition at line 1254 of file iconwidget.cpp.
QPainterPath IconWidget::shape | ( | ) | const |
reimplemented from QGraphicsItem
Definition at line 436 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 1286 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 [read, write] |
Definition at line 63 of file iconwidget.h.
QIcon IconWidget::icon [read, write] |
Definition at line 59 of file iconwidget.h.
QSizeF IconWidget::iconSize [read] |
Definition at line 61 of file iconwidget.h.
QString IconWidget::infoText [read, write] |
Definition at line 58 of file iconwidget.h.
int IconWidget::numDisplayLines [read, write] |
Definition at line 65 of file iconwidget.h.
Qt::Orientation IconWidget::orientation [read, write] |
Definition at line 64 of file iconwidget.h.
QString IconWidget::svg [read, write] |
Definition at line 62 of file iconwidget.h.
QString IconWidget::text [read, write] |
Definition at line 57 of file iconwidget.h.
QColor IconWidget::textBackgroundColor [read, write] |
Definition at line 60 of file iconwidget.h.
The documentation for this class was generated from the following files: