46#include <QGraphicsItem>
47#include <QGraphicsSceneMouseEvent>
52#include "graphicsScene.hh"
53#include "sceneElement.hh"
67 QGraphicsPixmapItem (_parent),
70 setPixmap (OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"user-trash.png");
74 setAcceptHoverEvents (
true);
87void Trash::hoverEnterEvent (QGraphicsSceneHoverEvent * )
89 if (!scene_->selectedItems ().isEmpty ())
96void Trash::hoverLeaveEvent (QGraphicsSceneHoverEvent * )
104void Trash::mousePressEvent (QGraphicsSceneMouseEvent * )
106 if (!scene_->selectedItems ().isEmpty ()) {
107 foreach (QGraphicsItem *e, scene_->selectedItems ())
109 SceneElement *se =
dynamic_cast<SceneElement *
> (e);
137 QGraphicsPixmapItem::setPos (_rect.topLeft ());
138 QGraphicsLayoutItem::setGeometry (_rect);
144QSizeF Trash::sizeHint (Qt::SizeHint _which,
const QSizeF &)
const
148 case Qt::MinimumSize:
149 case Qt::PreferredSize:
150 case Qt::MaximumSize:
151 sh = QSizeF (pixmap ().width (), pixmap ().height ());
bool removeElement(SceneElement *_element)
Remove the element from the scene.
Trash(GraphicsScene *_scene, QGraphicsItem *_parent)
Constructor.
void deactivate()
Makes the trash transparent (will be called of an element is moved away from this widget)
virtual void setGeometry(const QRectF &_rect)
Sets the geometry.
void activate()
Makes the trash opaque (will be called of an element is moved above this widget)