Plasma
Plasma::PopupApplet Class Reference
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. More...
#include <popupapplet.h>

Public Slots | |
void | hidePopup () |
void | showPopup (uint displayTime=0) |
void | togglePopup () |
Public Member Functions | |
virtual QGraphicsWidget * | graphicsWidget () |
bool | isPassivePopup () const |
bool | isPopupShowing () const |
PopupApplet (QObject *parent, const QVariantList &args) | |
QIcon | popupIcon () const |
Plasma::PopupPlacement | popupPlacement () const |
void | setGraphicsWidget (QGraphicsWidget *widget) |
void | setPassivePopup (bool passive) |
void | setPopupIcon (const QString &iconName) |
void | setPopupIcon (const QIcon &icon) |
void | setWidget (QWidget *widget) |
virtual QWidget * | widget () |
~PopupApplet () | |
Protected Member Functions | |
void | dragEnterEvent (QGraphicsSceneDragDropEvent *event) |
void | dragLeaveEvent (QGraphicsSceneDragDropEvent *event) |
void | dropEvent (QGraphicsSceneDragDropEvent *event) |
bool | eventFilter (QObject *watched, QEvent *event) |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) |
virtual void | popupEvent (bool show) |
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().
Definition at line 51 of file popupapplet.h.
Constructor & Destructor Documentation
Plasma::PopupApplet::PopupApplet | ( | QObject * | parent, | |
const QVariantList & | args | |||
) |
Definition at line 53 of file popupapplet.cpp.
Plasma::PopupApplet::~PopupApplet | ( | ) |
Definition at line 64 of file popupapplet.cpp.
Member Function Documentation
void Plasma::PopupApplet::dragEnterEvent | ( | QGraphicsSceneDragDropEvent * | event | ) | [protected] |
Definition at line 396 of file popupapplet.cpp.
void Plasma::PopupApplet::dragLeaveEvent | ( | QGraphicsSceneDragDropEvent * | event | ) | [protected] |
Definition at line 408 of file popupapplet.cpp.
void Plasma::PopupApplet::dropEvent | ( | QGraphicsSceneDragDropEvent * | event | ) | [protected] |
Definition at line 427 of file popupapplet.cpp.
bool Plasma::PopupApplet::eventFilter | ( | QObject * | o, | |
QEvent * | e | |||
) | [protected] |
For internal use only.
event filter; used for focus watching
if (layout() && watched == graphicsWidget() && (event->type() == QEvent::GraphicsSceneResize)) { sizes are recalculated in the constraintsevent so let's just call that. d->popupConstraintsEvent(Plasma::FormFactorConstraint);
resize vertically if necesarry. if (formFactor() == Plasma::MediaCenter || formFactor() == Plasma::Planar) { resize(QSizeF(size().width(), minimumHeight())); } }
Reimplemented from Plasma::Applet.
Definition at line 372 of file popupapplet.cpp.
QGraphicsWidget * Plasma::PopupApplet::graphicsWidget | ( | ) | [virtual] |
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.
Definition at line 123 of file popupapplet.cpp.
void Plasma::PopupApplet::hidePopup | ( | ) | [slot] |
Hides the popup.
Definition at line 463 of file popupapplet.cpp.
bool Plasma::PopupApplet::isPassivePopup | ( | ) | const |
- Returns:
- true if the dialog will be treated as a passive poup
Definition at line 493 of file popupapplet.cpp.
bool Plasma::PopupApplet::isPopupShowing | ( | ) | const [virtual] |
- Returns:
- true if the applet is popped up
Reimplemented from Plasma::Applet.
Definition at line 498 of file popupapplet.cpp.
void Plasma::PopupApplet::mousePressEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected] |
Definition at line 350 of file popupapplet.cpp.
void Plasma::PopupApplet::mouseReleaseEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected] |
Definition at line 362 of file popupapplet.cpp.
void Plasma::PopupApplet::popupEvent | ( | bool | show | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive an event before the popup is shown or hidden.
- 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.
Definition at line 484 of file popupapplet.cpp.
QIcon Plasma::PopupApplet::popupIcon | ( | ) | const |
- Returns:
- the icon that is displayed when the applet is in a panel.
Definition at line 108 of file popupapplet.cpp.
Plasma::PopupPlacement Plasma::PopupApplet::popupPlacement | ( | ) | const |
- Returns:
- the placement of the popup relating to the icon
Definition at line 479 of file popupapplet.cpp.
void Plasma::PopupApplet::setGraphicsWidget | ( | QGraphicsWidget * | widget | ) |
Definition at line 132 of file popupapplet.cpp.
void Plasma::PopupApplet::setPassivePopup | ( | 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.
- passive true if the dialog should be treated as a passive popup
Definition at line 488 of file popupapplet.cpp.
void Plasma::PopupApplet::setPopupIcon | ( | const QString & | iconName | ) |
- icon the icon that has to be displayed when the applet is in a panel.
Definition at line 103 of file popupapplet.cpp.
void Plasma::PopupApplet::setPopupIcon | ( | const QIcon & | icon | ) |
- icon the icon that has to be displayed when the applet is in a panel.
Definition at line 70 of file popupapplet.cpp.
void Plasma::PopupApplet::setWidget | ( | QWidget * | widget | ) |
Definition at line 118 of file popupapplet.cpp.
void Plasma::PopupApplet::showPopup | ( | uint | displayTime = 0 |
) | [slot] |
Shows the dialog showing the widget if the applet is in a panel.
- 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).
Definition at line 439 of file popupapplet.cpp.
void Plasma::PopupApplet::togglePopup | ( | ) | [slot] |
Toggles the popup.
Definition at line 474 of file popupapplet.cpp.
QWidget * Plasma::PopupApplet::widget | ( | ) | [virtual] |
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.
Definition at line 113 of file popupapplet.cpp.
The documentation for this class was generated from the following files: