Added Mouse based Zoom / Movement.

This patch uses the same code that lubomir used on the
old profile. It strangely didn't worked - most probably
because the scene has a fixed width() and height() of
100. the zoom works, and the movement works, but only
on the 100 first pixels of the profile.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-02-04 21:47:50 -02:00 committed by Dirk Hohndel
parent dc077e7bff
commit a649bcc7bc
2 changed files with 76 additions and 2 deletions

View file

@ -43,6 +43,7 @@ struct PartialGasPressureAxis;
class ProfileWidget2 : public QGraphicsView {
Q_OBJECT
void fixBackgroundPos();
void scrollViewTo(const QPoint& pos);
public:
enum State{ EMPTY, PROFILE, EDIT, ADD, PLAN, INVALID };
enum Items{BACKGROUND, PROFILE_Y_AXIS, GAS_Y_AXIS, TIME_AXIS, DEPTH_CONTROLLER, TIME_CONTROLLER, COLUMNS};
@ -55,6 +56,8 @@ public slots: // Necessary to call from QAction's signals.
protected:
virtual void contextMenuEvent(QContextMenuEvent* event);
virtual void resizeEvent(QResizeEvent* event);
virtual void wheelEvent(QWheelEvent* event);
virtual void mouseMoveEvent(QMouseEvent* event);
signals:
void startProfileState();
@ -70,7 +73,7 @@ private:
DivePlotDataModel *dataModel;
State currentState;
QStateMachine *stateMachine;
int zoomLevel;
DivePixmapItem *background ;
// All those here should probably be merged into one structure,
// So it's esyer to replicate for more dives later.