IconWidget Class Reference
from PyKDE4.plasma import *
Inherits: QGraphicsWidget → QObject
Namespace: Plasma
Detailed Description
Signals |
| activated () |
| changed () |
| clicked () |
| doubleClicked () |
| pressed (bool down) |
Methods |
| __init__ (self, QGraphicsItem parent=0) |
| __init__ (self, QString text, QGraphicsItem parent=0) |
| __init__ (self, QIcon icon, QString text, QGraphicsItem parent=0) |
QAction | action (self) |
| activated (self) |
| addIconAction (self, QAction action) |
| changed (self) |
| clicked (self) |
| doubleClicked (self) |
| drawActionButtonBase (self, QPainter painter, QSize size, int element) |
bool | drawBackground (self) |
| hoverEnterEvent (self, QGraphicsSceneHoverEvent event) |
| hoverLeaveEvent (self, QGraphicsSceneHoverEvent event) |
QIcon | icon (self) |
QSizeF | iconSize (self) |
QString | infoText (self) |
| invertLayout (self, bool invert) |
bool | invertedLayout (self) |
bool | isDown (self) |
| mouseDoubleClickEvent (self, QGraphicsSceneMouseEvent event) |
| mouseMoveEvent (self, QGraphicsSceneMouseEvent event) |
| mousePressEvent (self, QGraphicsSceneMouseEvent event) |
| mouseReleaseEvent (self, QGraphicsSceneMouseEvent event) |
int | numDisplayLines (self) |
Qt.Orientation | orientation (self) |
| paint (self, QPainter painter, QStyleOptionGraphicsItem option, QWidget widget=0) |
| pressed (self, bool down) |
| removeIconAction (self, QAction action) |
bool | sceneEventFilter (self, QGraphicsItem watched, QEvent event) |
| setAction (self, QAction action) |
| setDrawBackground (self, bool draw) |
| setIcon (self, QIcon icon) |
| setIcon (self, QString icon) |
| setInfoText (self, QString text) |
| setNumDisplayLines (self, int numLines) |
| setOrientation (self, Qt.Orientation orientation) |
| setPressed (self, bool pressed=1) |
| setSvg (self, QString svgFilePath, QString svgIconElement=QString()) |
| setText (self, QString text) |
| setTextBackgroundColor (self, QColor color) |
| setUnpressed (self) |
QPainterPath | shape (self) |
QSizeF | sizeFromIconSize (self, float iconWidth) |
QString | svg (self) |
QString | text (self) |
QColor | textBackgroundColor (self) |
Method Documentation
Creates a new Plasma.IconWidget.
- Parameters:
-
| parent | the QGraphicsItem this icon is parented to.
|
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.
|
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.
|
- Returns:
- the currently associated action, if any.
Indicates when the icon has been activated following the single
or doubleclick settings
- Signal syntax:
QObject.connect(source, SIGNAL("activated()"), target_slot)
addIconAction |
( |
self, |
|
|
|
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.
|
Indicates that something about the icon may have changed (image, text, etc)
only actually works for icons associated with an action
- Signal syntax:
QObject.connect(source, SIGNAL("changed()"), target_slot)
Indicates when the icon has been clicked.
- Signal syntax:
QObject.connect(source, SIGNAL("clicked()"), target_slot)
Indicates when the icon has been double-clicked
- Signal syntax:
QObject.connect(source, SIGNAL("doubleClicked()"), target_slot)
drawActionButtonBase |
( |
self, |
|
|
|
QPainter |
painter, |
|
|
QSize |
size, |
|
|
int |
element |
|
) |
|
|
|
bool drawBackground |
( |
|
self ) |
|
- Returns:
- true if a background area is to be drawn for the icon
- Returns:
- the icon associated with this icon.
- Returns:
- the size of this Plasma.IconWidget's graphical icon.
Returns the meta text associated with this icon.
invertLayout |
( |
self, |
|
|
|
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
|
bool invertedLayout |
( |
|
self ) |
|
- Returns:
- if the layout of the icons should appear inverted or not
int numDisplayLines |
( |
|
self ) |
|
- Returns:
- the number of lines allowed to display
- Returns:
- the orientation of the icon
pressed |
( |
self, |
|
|
|
bool |
down |
|
) |
|
|
|
Indicates when the icon has been pressed.
- Signal syntax:
QObject.connect(source, SIGNAL("pressed(bool)"), target_slot)
removeIconAction |
( |
self, |
|
|
|
QAction |
action |
|
) |
|
|
|
Removes a previously set iconAction. The action will be removed from the widget
but will not be deleted.
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.
setDrawBackground |
( |
self, |
|
|
|
bool |
draw |
|
) |
|
|
|
Sets whether or not to draw a background area for the icon
@arg draw true if a background should be drawn or not
setIcon |
( |
self, |
|
|
|
QIcon |
icon |
|
) |
|
|
|
Sets the graphical icon for this Plasma.IconWidget.
- Parameters:
-
| icon | the KIcon to associate with this 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.
|
Sets the additional information to be displayed by
this icon.
- Parameters:
-
| text | additional meta text associated with this icon.
|
setNumDisplayLines |
( |
self, |
|
|
|
int |
numLines |
|
) |
|
|
|
- Parameters:
-
| numLines | the number of lines to show in the display.
|
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
|
setPressed |
( |
self, |
|
|
|
bool |
pressed=1 |
|
) |
|
|
|
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)
|
setSvg |
( |
self, |
|
|
|
QString |
svgFilePath, |
|
|
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.
|
Sets the text associated with this icon.
- Parameters:
-
| text | the text to associate with this icon.
|
setTextBackgroundColor |
( |
self, |
|
|
|
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
Shortcut for setPressed(false)
reimplemented from QGraphicsItem
QSizeF sizeFromIconSize |
( |
self, |
|
|
|
float |
iconWidth |
|
) |
|
|
|
- Returns:
- optimal size given a size for the icon
- Parameters:
-
| | iconWidth desired width of the icon
|
- Returns:
- the path to the svg file set, if any
Returns the text associated with this icon.
QColor textBackgroundColor |
( |
|
self ) |
|
- Returns:
- the color to use behind the text of the icon
- Since:
- 4.3