make Applet (and lineedit) usable with qgraphics_item cast. we probably want to do this with all of our QGI subclasses.
i introduced a new enum in the Plasma namespace, ItemType, so we can keep track of these id's centrally. however, the right click mechanism is rather broken in its implementation; we need a way to offer a centralized menu on appets no metter where they are clicked. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=678562
This commit is contained in:
parent
c37fabf01c
commit
5f8c6be988
@ -30,6 +30,7 @@
|
||||
|
||||
#include "corona.h"
|
||||
#include "dataenginemanager.h"
|
||||
#include "plasma.h"
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
6
applet.h
6
applet.h
@ -181,6 +181,12 @@ class PLASMA_EXPORT Applet : public QObject, public QGraphicsItem
|
||||
**/
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||
|
||||
/**
|
||||
* Reimplented from QGraphicsItem
|
||||
**/
|
||||
enum { Type = Plasma::AppletType };
|
||||
int type() const { return Type; }
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* Emit this signal when your applet needs to take (or lose) keyboard
|
||||
|
6
plasma.h
6
plasma.h
@ -19,6 +19,8 @@
|
||||
#ifndef PLASMA_DEFS_H
|
||||
#define PLASMA_DEFS_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
|
||||
#include <plasma/plasma_export.h>
|
||||
|
||||
/**
|
||||
@ -75,6 +77,10 @@ enum Location { Floating = 0 /**< Free floating. Neither geometry or z-ordering
|
||||
RightEdge /**< Along the right side of the screen */
|
||||
};
|
||||
|
||||
enum ItemTypes { AppletType = QGraphicsItem::UserType + 1,
|
||||
LineEditType = QGraphicsItem::UserType + 2
|
||||
};
|
||||
|
||||
PLASMA_EXPORT void setMinId(int minId);
|
||||
PLASMA_EXPORT int uniqueId();
|
||||
PLASMA_EXPORT Direction locationToDirection(Location location);
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <plasma/plasma_export.h>
|
||||
|
||||
#include <plasma/dataengine.h>
|
||||
#include <plasma/plasma.h>
|
||||
#include <plasma/widgets/layoutitem.h>
|
||||
|
||||
namespace Plasma
|
||||
@ -62,6 +63,12 @@ class PLASMA_EXPORT LineEdit : public QGraphicsTextItem, public LayoutItem
|
||||
const QString toHtml();
|
||||
const QString toPlainText();
|
||||
|
||||
/**
|
||||
* Reimplented from QGraphicsItem
|
||||
**/
|
||||
enum { Type = Plasma::LineEditType };
|
||||
int type() const { return Type; }
|
||||
|
||||
Q_SIGNALS:
|
||||
void editingFinished();
|
||||
void textChanged(const QString &text);
|
||||
|
Loading…
Reference in New Issue
Block a user