PopupApplet Class Reference
from PyKDE4.plasma import *
Inherits: Plasma.Applet → QGraphicsWidget → QObject
Namespace: Plasma
Detailed Description
Allows applets to automatically 'collapse' into an icon when put in an panel, and is a convenient
base class for any applet that wishes to use extenders.
Applets that subclass this class should implement either widget() or graphicsWidget() to return a
widget that will be displayed in the applet if the applet is in a Planar or MediaCenter form
factor. If the applet is put in a panel, an icon will be displayed instead, which shows the
widget in a popup when clicked.
If you use this class as a base class for your extender using applet, the extender will
automatically be used for the popup; reimplementing graphicsWidget() is unnecessary in this case.
If you need a popup that does not steal window focus when openend or used, set window flag
Qt.X11BypassWindowManagerHint the widget returned by widget() or graphicsWidget().
Methods |
| | __init__ (self, QObject parent, [QVariant] args) |
| | __init__ (self, QString packagePath, long appletId, [QVariant] args) |
| | dragEnterEvent (self, QGraphicsSceneDragDropEvent event) |
| | dragLeaveEvent (self, QGraphicsSceneDragDropEvent event) |
| | dropEvent (self, QGraphicsSceneDragDropEvent event) |
| bool | eventFilter (self, QObject watched, QEvent event) |
| QGraphicsWidget | graphicsWidget (self) |
| | hidePopup (self) |
| bool | isIconified (self) |
| bool | isPassivePopup (self) |
| bool | isPopupShowing (self) |
| | mousePressEvent (self, QGraphicsSceneMouseEvent event) |
| | mouseReleaseEvent (self, QGraphicsSceneMouseEvent event) |
| Qt::AlignmentFlag | popupAlignment (self) |
| | popupEvent (self, bool show) |
| QIcon | popupIcon (self) |
| Plasma.PopupPlacement | popupPlacement (self) |
| | setGraphicsWidget (self, QGraphicsWidget widget) |
| | setPassivePopup (self, bool passive) |
| | setPopupAlignment (self, Qt::AlignmentFlag alignment) |
| | setPopupIcon (self, QIcon icon) |
| | setPopupIcon (self, QString iconName) |
| | setWidget (self, QWidget widget) |
| | showPopup (self, long displayTime=0) |
| QSizeF | sizeHint (self, Qt::SizeHint which, QSizeF constraint=QSizeF()) |
| | timerEvent (self, QTimerEvent event) |
| | togglePopup (self) |
| QWidget | widget (self) |
Method Documentation
| __init__ |
( |
self, |
|
|
|
QObject |
parent, |
|
|
[QVariant] |
args |
|
) |
|
|
|
| __init__ |
( |
self, |
|
|
|
QString |
packagePath, |
|
|
long |
appletId, |
|
|
[QVariant] |
args |
|
) |
|
|
|
- Internal:
- This constructor is to be used with the Package loading system.
- Parameters:
-
| parent | a QObject parent; you probably want to pass in 0
|
| args | a list of strings containing two entries: the service id
and the applet id
|
- Since:
- 4.3
| dragEnterEvent |
( |
self, |
|
|
|
QGraphicsSceneDragDropEvent |
event |
|
) |
|
|
|
Reimplemented from QGraphicsLayoutItem
| dragLeaveEvent |
( |
self, |
|
|
|
QGraphicsSceneDragDropEvent |
event |
|
) |
|
|
|
Reimplemented from QGraphicsLayoutItem
| dropEvent |
( |
self, |
|
|
|
QGraphicsSceneDragDropEvent |
event |
|
) |
|
|
|
Reimplemented from QGraphicsLayoutItem
| bool eventFilter |
( |
self, |
|
|
|
QObject |
watched, |
|
|
QEvent |
event |
|
) |
|
|
|
Reimplemented from QGraphicsLayoutItem
| QGraphicsWidget graphicsWidget |
( |
|
self ) |
|
Implement either this function or widget().
- Returns:
- the widget that will get shown in either a layout, in the applet or in a Dialog,
depending on the form factor of the applet.
If you set a popup icon you must also set a minimum size of the applet. When the applet
is smaller than this minimum size, it will be displayed as that icon.
| bool isIconified |
( |
|
self ) |
|
- Returns:
- true if the applet is collapsed to an icon
- Since:
- 4.6
| bool isPassivePopup |
( |
|
self ) |
|
- Returns:
- true if the dialog will be treated as a passive poup
| bool isPopupShowing |
( |
|
self ) |
|
- Returns:
- true if the applet is popped up
| mousePressEvent |
( |
self, |
|
|
|
QGraphicsSceneMouseEvent |
event |
|
) |
|
|
|
Reimplemented from QGraphicsLayoutItem
| mouseReleaseEvent |
( |
self, |
|
|
|
QGraphicsSceneMouseEvent |
event |
|
) |
|
|
|
Reimplemented from QGraphicsLayoutItem
- Returns:
- the default alignment of the popup relative to the applet
- Since:
- 4.6
| popupEvent |
( |
self, |
|
|
|
bool |
show |
|
) |
|
|
|
This event handler can be reimplemented in a subclass to receive an
event before the popup is shown or hidden.
@arg show true if the popup is going to be shown, false if the popup
is going to be hidden.
Note that showing and hiding the popup on click is already done in PopupApplet.
- Returns:
- the icon that is displayed when the applet is in a panel.
- Returns:
- the placement of the popup relating to the applet
| setGraphicsWidget |
( |
self, |
|
|
|
QGraphicsWidget |
widget |
|
) |
|
|
|
| setPassivePopup |
( |
self, |
|
|
|
bool |
passive |
|
) |
|
|
|
Sets whether or not the dialog popup that gets created should be a "passive" popup
that does not steal focus from other windows or not.
@arg passive true if the dialog should be treated as a passive popup
Sets the default alignment of the popup relative to the applet
@arg alignment the alignment to use; Qt.AlignLeft or Qt.AlignRight
- Since:
- 4.6
| setPopupIcon |
( |
self, |
|
|
|
QIcon |
icon |
|
) |
|
|
|
@arg icon the icon that has to be displayed when the applet is in a panel.
Passing in an empty QString() means that the popup applet itself
will provide an interface for when the PopupApplet is not showing
the widget() or graphicsWidget() directly.
If you set a popup icon you must also set a minimum size of the applet. When the applet
is smaller than this minimum size, it will be displayed as that icon.
| setPopupIcon |
( |
self, |
|
|
|
QString |
iconName |
|
) |
|
|
|
@arg icon the icon that has to be displayed when the applet is in a panel.
Passing in an empty QString() means that the popup applet itself
will provide an interface for when the PopupApplet is not showing
the widget() or graphicsWidget() directly.
If you set a popup icon you must also set a minimum size of the applet. When the applet
is smaller than this minimum size, it will be displayed as that icon.
| setWidget |
( |
self, |
|
|
|
QWidget |
widget |
|
) |
|
|
|
| showPopup |
( |
self, |
|
|
|
long |
displayTime=0 |
|
) |
|
|
|
Shows the dialog showing the widget if the applet is in a panel.
@arg displayTime the time in ms that the popup should be displayed, defaults to 0 which means
always (until the user closes it again, that is).
| QSizeF sizeHint |
( |
self, |
|
|
|
Qt::SizeHint |
which, |
|
|
QSizeF |
constraint=QSizeF() |
|
) |
|
|
|
Reimplemented from QGraphicsLayoutItem
| timerEvent |
( |
self, |
|
|
|
QTimerEvent |
event |
|
) |
|
|
|
Reimplemented from QGraphicsLayoutItem
Implement either this function or graphicsWidget().
- Returns:
- the widget that will get shown in either a layout, in the applet or in a Dialog,
depending on the form factor of the applet.