* make a QGrahpicsWidget

* provide access to the containment pointer

svn path=/trunk/KDE/kdelibs/; revision=1032379
This commit is contained in:
Aaron J. Seigo 2009-10-07 17:08:44 +00:00
parent d8e084c77e
commit 4fc13d171a
2 changed files with 9 additions and 4 deletions

View File

@ -70,7 +70,7 @@ public:
}; };
ToolBox::ToolBox(Containment *parent) ToolBox::ToolBox(Containment *parent)
: QGraphicsItem(parent), : QGraphicsWidget(parent),
d(new ToolBoxPrivate(parent)) d(new ToolBoxPrivate(parent))
{ {
d->userMoved = false; d->userMoved = false;
@ -82,6 +82,11 @@ ToolBox::~ToolBox()
delete d; delete d;
} }
Containment *ToolBox::containment()
{
return d->containment;
}
QPoint ToolBox::toolPosition(int toolHeight) QPoint ToolBox::toolPosition(int toolHeight)
{ {
switch (d->corner) { switch (d->corner) {

View File

@ -21,8 +21,7 @@
#ifndef PLASMA_TOOLBOX_P_H #ifndef PLASMA_TOOLBOX_P_H
#define PLASMA_TOOLBOX_P_H #define PLASMA_TOOLBOX_P_H
#include <QGraphicsItem> #include <QGraphicsWidget>
#include <QObject>
#include "containment.h" #include "containment.h"
@ -37,7 +36,7 @@ namespace Plasma
//class EmptyGraphicsItem; //class EmptyGraphicsItem;
class ToolBoxPrivate; class ToolBoxPrivate;
class ToolBox : public QObject, public QGraphicsItem class ToolBox : public QGraphicsWidget
{ {
Q_OBJECT Q_OBJECT
#if QT_VERSION >= 0x040600 #if QT_VERSION >= 0x040600
@ -108,6 +107,7 @@ Q_SIGNALS:
void toggled(); void toggled();
protected: protected:
Containment *containment();
QPoint toolPosition(int toolHeight); QPoint toolPosition(int toolHeight);
void mousePressEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event);