diff --git a/Makefile b/Makefile index 9961f04c7..338f81a7c 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,7 @@ HEADERS = \ qt-ui/plotareascene.h \ qt-ui/starwidget.h \ qt-ui/modeldelegates.h \ + qt-ui/profilegraphics.h \ SOURCES = \ @@ -67,6 +68,7 @@ SOURCES = \ qt-ui/plotareascene.cpp \ qt-ui/starwidget.cpp \ qt-ui/modeldelegates.cpp \ + qt-ui/profilegraphics.cpp \ $(RESFILE) diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 3f545171e..8ac0ad871 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -67,7 +67,6 @@ void MainWindow::on_actionOpen_triggered() g_error_free(error); error = NULL; } - process_dives(FALSE, FALSE); ui->InfoWidget->reload(); @@ -94,6 +93,7 @@ void MainWindow::dive_selection_changed(const QItemSelection& newSelection, cons continue; select_dive(get_divenr(d)); } + ui->ProfileWidget->plot(get_dive(selected_dive)); } void MainWindow::on_actionSave_triggered() diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui index fe97d98b4..7dfbae746 100644 --- a/qt-ui/mainwindow.ui +++ b/qt-ui/mainwindow.ui @@ -25,7 +25,7 @@ Qt::Horizontal - + @@ -88,7 +88,7 @@ 0 0 763 - 19 + 25 @@ -339,6 +339,11 @@ QTreeView
divelistview.h
+ + ProfileGraphicsView + QGraphicsView +
profilegraphics.h
+
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp new file mode 100644 index 000000000..59a47826f --- /dev/null +++ b/qt-ui/profilegraphics.cpp @@ -0,0 +1,26 @@ +#include "profilegraphics.h" + +#include +#include + +#include + +ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent) +{ + setScene(new QGraphicsScene()); + scene()->setSceneRect(0,0,100,100); +} + +void ProfileGraphicsView::plot(struct dive *d) +{ + qDebug() << "Start the plotting of the dive here."; +} + +void ProfileGraphicsView::resizeEvent(QResizeEvent *event) +{ + // Fits the scene's rectangle on the view. + // I can pass some parameters to this - + // like Qt::IgnoreAspectRatio or Qt::KeepAspectRatio + QRectF r = scene()->sceneRect(); + fitInView ( r.x() - 2, r.y() -2, r.width() + 4, r.height() + 4); // do a little bit of spacing; +} diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h new file mode 100644 index 000000000..e3380abcd --- /dev/null +++ b/qt-ui/profilegraphics.h @@ -0,0 +1,17 @@ +#ifndef PROFILEGRAPHICS_H +#define PROFILEGRAPHICS_H + +#include + +class ProfileGraphicsView : public QGraphicsView { +Q_OBJECT +public: + ProfileGraphicsView(QWidget* parent = 0); + void plot(struct dive *d); + +protected: + void resizeEvent(QResizeEvent *event); + +}; + +#endif