44 #include "../qdeclarativeviewinspector_p.h" 46 #include <QtGui/QMouseEvent> 47 #include <QtGui/QWheelEvent> 48 #include <QtGui/QKeyEvent> 49 #include <QtGui/QMenu> 50 #include <QtGui/QAction> 52 #include <QtCore/QRectF> 53 #include <QtCore/QDebug> 59 m_rubberbandManipulator(),
60 m_smoothZoomMultiplier(0.05f),
141 QRectF sceneArea(scenePosTopLeft, scenePosBottomRight);
199 if (event->
modifiers() & smoothZoomModifier) {
200 int numDegrees =
event->delta() / 8;
206 if (event->
delta() > 0) {
208 }
else if (event->
delta() < 0) {
217 switch (event->
key()) {
259 QPointF adjustedCenterPos = centerPos;
265 adjustedCenterPos.
rx() = rectSize.
width() / 2;
266 adjustedCenterPos.
ry() = rectSize.
height() / 2;
270 adjustedCenterPos.
rx() = rectSize.
width() / 2;
271 adjustedCenterPos.
ry() = rectSize.
height() / 2;
277 sceneRect.
setRect(adjustedCenterPos.
x() - rectSize.
width() / 2,
278 adjustedCenterPos.
y() - rectSize.
height() / 2,
315 if (direction ==
ZoomIn) {
316 for (
int i = 0; i < zoomScales.
length(); ++i) {
318 return zoomScales[i];
321 for (
int i = zoomScales.
length() - 1; i >= 0; --i) {
323 return zoomScales[i];
The QKeyEvent class describes a key event.
void setShortcut(const QKeySequence &shortcut)
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
QPointF mapToScene(const QPoint &point) const
Returns the viewport coordinate point mapped to scene coordinates.
The QWheelEvent class contains parameters that describe a wheel event.
The QPointF class defines a point in the plane using floating point precision.
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
int height() const
Returns the height of the rectangle.
Q_DECL_CONSTEXPR T qAbs(const T &t)
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
qreal x() const
Returns the x-coordinate of this point.
int key() const
Returns the code of the key that was pressed or released.
static const int DragStartDistance
int width() const
Returns the width.
qreal & rx()
Returns a reference to the x coordinate of this point.
The QRectF class defines a rectangle in the plane using floating point precision. ...
void setTransform(const QTransform &matrix, bool combine=false)
Sets the view's current transformation matrix to matrix.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
qreal height() const
Returns the height of the rectangle.
int delta() const
Returns the distance that the wheel is rotated, in eighths of a degree.
qreal width() const
Returns the width of the rectangle.
void setRect(qreal x, qreal y, qreal w, qreal h)
Sets the coordinates of the rectangle's top-left corner to (x, y), and its size to the given width an...
Qt::Orientation orientation() const
Returns the wheel's orientation.
static const double ZoomSnapDelta
The QMouseEvent class contains parameters that describe a mouse event.
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
void update(const QPointF &updatePoint)
qreal manhattanLength() const
Returns the sum of the absolute values of x() and y(), traditionally known as the "Manhattan length" ...
The QKeySequence class encapsulates a key sequence as used by shortcuts.
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
void setSceneRect(const QRectF &rect)
int length() const
This function is identical to count().
The QPoint class defines a point in the plane using integer precision.
int height() const
Returns the height.
qreal & ry()
Returns a reference to the y coordinate of this point.
qreal y() const
Returns the y-coordinate of this point.
LiveLayerItem * manipulatorLayer
The QSize class defines the size of a two-dimensional object using integer point precision.
The QGraphicsObject class provides a base class for all graphics items that require signals...
void begin(const QPointF &beginPoint)
const QPoint & globalPos() const
Returns the global position of the mouse cursor at the time of the event.
The QAction class provides an abstract user interface action that can be inserted into widgets...
QPointF beginPoint() const
static QDeclarativeViewInspectorPrivate * get(QDeclarativeViewInspector *v)
The QList class is a template class that provides lists.
Qt::LayoutDirection direction