46#include <QGraphicsItem>
47#include <QGraphicsSceneMouseEvent>
51#include "zoomButton.hh"
52#include "graphicsScene.hh"
65 QGraphicsPixmapItem (_parent),
74 setPixmap (OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"zoom-in.png");
77 setPixmap (OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"zoom-out.png");
83 setAcceptHoverEvents (
true);
85 connect (&timer_, SIGNAL (timeout ()),
this, SLOT (timeout ()));
98void ZoomButton::hoverEnterEvent (QGraphicsSceneHoverEvent * )
106void ZoomButton::hoverLeaveEvent (QGraphicsSceneHoverEvent * )
114void ZoomButton::mousePressEvent (QGraphicsSceneMouseEvent *_event)
128 QRectF rect = scene_->sceneRect ();
129 pos_ = QPointF (rect.x () + (rect.width () / 2.0), rect.y () + (rect.height () / 2.0));
138void ZoomButton::mouseReleaseEvent (QGraphicsSceneMouseEvent *_event)
147void ZoomButton::wheelEvent (QGraphicsSceneWheelEvent *_event)
153 if (_event->delta() > 0)
164void ZoomButton::timeout ()
184 if (!timer_.isActive ())
202 QGraphicsPixmapItem::setPos (_rect.topLeft ());
203 QGraphicsLayoutItem::setGeometry (_rect);
209QSizeF ZoomButton::sizeHint (Qt::SizeHint _which,
const QSizeF &)
const
213 case Qt::MinimumSize:
214 case Qt::PreferredSize:
215 case Qt::MaximumSize:
216 sh = QSizeF (pixmap ().width (), pixmap ().height ());
void scaleElements(qreal _delta)
Scale all elements with scaling center in the center of the scene.