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) |
addIconAction (self, QAction action) | |
changeEvent (self, QEvent event) | |
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) |
QSizeF | maximumIconSize (self) |
QSizeF | minimumIconSize (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) | |
QSizeF | preferredIconSize (self) |
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) | |
setMaximumIconSize (self, QSizeF size) | |
setMinimumIconSize (self, QSizeF size) | |
setNumDisplayLines (self, int numLines) | |
setOrientation (self, Qt::Orientation orientation) | |
setPreferredIconSize (self, QSizeF size) | |
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) |
QSizeF | sizeHint (self, Qt::SizeHint which, QSizeF constraint=QSizeF()) |
QString | svg (self) |
QString | text (self) |
QColor | textBackgroundColor (self) |
Signal Documentation
activated | ( | ) |
Indicates when the icon has been activated following the single or doubleclick settings
- Signal syntax:
QObject.connect(source, SIGNAL("activated()"), target_slot)
changed | ( | ) |
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)
clicked | ( | ) |
Indicates when the icon has been clicked.
- Signal syntax:
QObject.connect(source, SIGNAL("clicked()"), target_slot)
doubleClicked | ( | ) |
Indicates when the icon has been double-clicked
- Signal syntax:
QObject.connect(source, SIGNAL("doubleClicked()"), target_slot)
pressed | ( | bool | down | |
) |
Indicates when the icon has been pressed.
- Signal syntax:
QObject.connect(source, SIGNAL("pressed(bool)"), target_slot)
Method Documentation
__init__ | ( | self, | ||
QGraphicsItem | parent=0 | |||
) |
Creates a new Plasma.IconWidget.
- Parameters:
-
parent the QGraphicsItem this icon is parented to.
__init__ | ( | self, | ||
QString | text, | |||
QGraphicsItem | parent=0 | |||
) |
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.
__init__ | ( | self, | ||
QIcon | icon, | |||
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.
QAction action | ( | self ) |
- Returns:
- the currently associated action, if any.
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.
changeEvent | ( | self, | ||
QEvent | event | |||
) |
drawActionButtonBase | ( | self, | ||
QPainter | painter, | |||
QSize | size, | |||
int | element | |||
) |
- Internal:
bool drawBackground | ( | self ) |
- Returns:
- true if a background area is to be drawn for the icon
hoverEnterEvent | ( | self, | ||
QGraphicsSceneHoverEvent | event | |||
) |
hoverLeaveEvent | ( | self, | ||
QGraphicsSceneHoverEvent | event | |||
) |
QIcon icon | ( | self ) |
- Returns:
- the icon associated with this icon.
QSizeF iconSize | ( | self ) |
- Returns:
- the size of this Plasma.IconWidget's graphical icon.
QString infoText | ( | self ) |
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
bool isDown | ( | self ) |
QSizeF maximumIconSize | ( | self ) |
- 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 minimumIconSize | ( | self ) |
- 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
mouseDoubleClickEvent | ( | self, | ||
QGraphicsSceneMouseEvent | event | |||
) |
mouseMoveEvent | ( | self, | ||
QGraphicsSceneMouseEvent | event | |||
) |
mousePressEvent | ( | self, | ||
QGraphicsSceneMouseEvent | event | |||
) |
mouseReleaseEvent | ( | self, | ||
QGraphicsSceneMouseEvent | event | |||
) |
int numDisplayLines | ( | self ) |
- Returns:
- the number of lines allowed to display
Qt::Orientation orientation | ( | self ) |
- Returns:
- the orientation of the icon
paint | ( | self, | ||
QPainter | painter, | |||
QStyleOptionGraphicsItem | option, | |||
QWidget | widget=0 | |||
) |
QSizeF preferredIconSize | ( | self ) |
- 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
removeIconAction | ( | self, | ||
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
bool sceneEventFilter | ( | self, | ||
QGraphicsItem | watched, | |||
QEvent | event | |||
) |
setAction | ( | self, | ||
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.
setDrawBackground | ( | self, | ||
bool | draw | |||
) |
Sets whether or not to draw a background area for the icon
- Parameters:
-
draw true if a background should be drawn or not
setIcon | ( | self, | ||
QIcon | 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.
setIcon | ( | self, | ||
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.
setInfoText | ( | self, | ||
QString | text | |||
) |
Sets the additional information to be displayed by this icon.
- Parameters:
-
text additional meta text associated with this icon.
setMaximumIconSize | ( | self, | ||
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
setMinimumIconSize | ( | self, | ||
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
setNumDisplayLines | ( | self, | ||
int | numLines | |||
) |
- Parameters:
-
numLines the number of lines to show in the display.
setOrientation | ( | self, | ||
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
setPreferredIconSize | ( | self, | ||
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
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.
setText | ( | self, | ||
QString | text | |||
) |
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
setUnpressed | ( | self ) |
Shortcut for setPressed(false)
QPainterPath shape | ( | self ) |
reimplemented from QGraphicsItem
QSizeF sizeFromIconSize | ( | self, | ||
float | iconWidth | |||
) |
- Returns:
- optimal size given a size for the icon
- Parameters:
-
iconWidth desired width of the icon
QSizeF sizeHint | ( | self, | ||
Qt::SizeHint | which, | |||
QSizeF | constraint=QSizeF() | |||
) |
QString svg | ( | self ) |
- Returns:
- the path to the svg file set, if any
QString text | ( | self ) |
Returns the text associated with this icon.
QColor textBackgroundColor | ( | self ) |
- Returns:
- the color to use behind the text of the icon
- Since:
- 4.3