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 | |
| 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) |
| Q_INVOKABLE void | setIcon (const QString &icon) |
| void | setIcon (const QIcon &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:
-
parent the 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:
-
text the text that will be displayed with this icon. parent the 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:
-
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 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:
-
action the 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 1599 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 1214 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 1450 of file iconwidget.cpp.
| void IconWidget::hoverLeaveEvent | ( | QGraphicsSceneHoverEvent * | event | ) | [protected] |
Definition at line 1465 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 1536 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 1531 of file iconwidget.cpp.
| bool IconWidget::isDown | ( | ) | [protected] |
Definition at line 1353 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 1440 of file iconwidget.cpp.
| void IconWidget::mouseMoveEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected] |
Definition at line 1383 of file iconwidget.cpp.
| void IconWidget::mousePressEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected] |
Definition at line 1358 of file iconwidget.cpp.
| void IconWidget::mouseReleaseEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected] |
Definition at line 1403 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 1108 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:
-
the QAction 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 1482 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.
- draw true if a background should be drawn or not
Definition at line 482 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 1286 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 1296 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 1260 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:
-
preferred icon size, pass an invalid size to unset this value
- Since:
- 4.5
Definition at line 1342 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:
-
preferred icon size, pass an invalid size to unset this value
- Since:
- 4.5
Definition at line 1331 of file iconwidget.cpp.
| void IconWidget::setNumDisplayLines | ( | int | numLines | ) |
- Parameters:
-
numLines the 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:
-
orientation the orientation we want
Definition at line 1520 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:
-
preferred icon size, pass an invalid size to unset this value
- Since:
- 4.5
Definition at line 1320 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 1497 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 634 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 1239 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 1202 of file iconwidget.cpp.
| void IconWidget::setUnpressed | ( | ) | [slot] |
Shortcut for setPressed(false)
Definition at line 1509 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:
-
iconWidth desired width of the icon
Definition at line 1541 of file iconwidget.cpp.
| QSizeF IconWidget::sizeHint | ( | Qt::SizeHint | which, |
| const QSizeF & | constraint = QSizeF() |
||
| ) | const [protected] |
Definition at line 671 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 66 of file iconwidget.h.
bool IconWidget::drawBackground [read, write] |
Definition at line 65 of file iconwidget.h.
QIcon IconWidget::icon [read, write] |
Definition at line 61 of file iconwidget.h.
QSizeF IconWidget::iconSize [read] |
Definition at line 63 of file iconwidget.h.
QString IconWidget::infoText [read, write] |
Definition at line 60 of file iconwidget.h.
QSizeF IconWidget::maximumIconSize [read, write] |
Definition at line 71 of file iconwidget.h.
QSizeF IconWidget::minimumIconSize [read, write] |
Definition at line 70 of file iconwidget.h.
int IconWidget::numDisplayLines [read, write] |
Definition at line 68 of file iconwidget.h.
Qt::Orientation IconWidget::orientation [read, write] |
Definition at line 67 of file iconwidget.h.
QSizeF IconWidget::preferredIconSize [read, write] |
Definition at line 69 of file iconwidget.h.
QString IconWidget::svg [read, write] |
Definition at line 64 of file iconwidget.h.
QString IconWidget::text [read, write] |
Definition at line 59 of file iconwidget.h.
QColor IconWidget::textBackgroundColor [read, write] |
Definition at line 62 of file iconwidget.h.
The documentation for this class was generated from the following files:
KDE 4.6 API Reference