52 #include <QGraphicsItem> 53 #include <QGraphicsSceneMouseEvent> 58 #include "graphicsScene.hh" 59 #include "sceneElement.hh" 73 QGraphicsPixmapItem (_parent),
76 setPixmap (OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"user-trash.png");
80 setAcceptHoverEvents (
true);
93 void Trash::hoverEnterEvent (QGraphicsSceneHoverEvent * )
95 if (!scene_->selectedItems ().isEmpty ())
102 void Trash::hoverLeaveEvent (QGraphicsSceneHoverEvent * )
110 void Trash::mousePressEvent (QGraphicsSceneMouseEvent * )
112 if (!scene_->selectedItems ().isEmpty ())
113 foreach (QGraphicsItem *e, scene_->selectedItems ())
142 QGraphicsPixmapItem::setPos (_rect.topLeft ());
143 QGraphicsLayoutItem::setGeometry (_rect);
149 QSizeF Trash::sizeHint (Qt::SizeHint _which,
const QSizeF &)
const 153 case Qt::MinimumSize:
154 case Qt::PreferredSize:
155 case Qt::MaximumSize:
156 sh = QSizeF (pixmap ().width (), pixmap ().height ());
void activate()
Makes the trash opaque (will be called of an element is moved above this widget)
virtual void setGeometry(const QRectF &_rect)
Sets the geometry.
Trash(GraphicsScene *_scene, QGraphicsItem *_parent)
Constructor.
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.