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);
87 void Trash::hoverEnterEvent (QGraphicsSceneHoverEvent * )
89 if (!scene_->selectedItems ().isEmpty ())
96 void Trash::hoverLeaveEvent (QGraphicsSceneHoverEvent * )
104 void Trash::mousePressEvent (QGraphicsSceneMouseEvent * )
106 if (!scene_->selectedItems ().isEmpty ())
107 foreach (QGraphicsItem *e, scene_->selectedItems ())
136 QGraphicsPixmapItem::setPos (_rect.topLeft ());
137 QGraphicsLayoutItem::setGeometry (_rect);
143 QSizeF Trash::sizeHint (Qt::SizeHint _which,
const QSizeF &)
const 147 case Qt::MinimumSize:
148 case Qt::PreferredSize:
149 case Qt::MaximumSize:
150 sh = QSizeF (pixmap ().width (), pixmap ().height ());
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)
void deactivate()
Makes the trash transparent (will be called of an element is moved away from this widget) ...
bool removeElement(SceneElement *_element)
Remove the element from the scene.
Trash(GraphicsScene *_scene, QGraphicsItem *_parent)
Constructor.