summaryrefslogtreecommitdiffstats
path: root/qt-ui/statistics
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-08-25 16:10:47 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-25 13:58:38 -0700
commit1c56c9f6261521ecb2ad65a760359e6b1ae9fd48 (patch)
treed1e0b8992a97b585136668d29707eda6dd867f32 /qt-ui/statistics
parent750fc529b70c84b23b84f69bcec28b573646c426 (diff)
downloadsubsurface-1c56c9f6261521ecb2ad65a760359e6b1ae9fd48.tar.gz
Create stub methods and connects the model with the new statistics
Connects the YearlyStatistics model with the YearlyStatisticsWidget nothing is shown right now, mostly because I need to do everything but now it's easyer to add the things that are missing. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/statistics')
-rw-r--r--qt-ui/statistics/statisticswidget.cpp31
-rw-r--r--qt-ui/statistics/statisticswidget.h10
2 files changed, 41 insertions, 0 deletions
diff --git a/qt-ui/statistics/statisticswidget.cpp b/qt-ui/statistics/statisticswidget.cpp
index 71ac7843e..8ac8d1cdb 100644
--- a/qt-ui/statistics/statisticswidget.cpp
+++ b/qt-ui/statistics/statisticswidget.cpp
@@ -1,5 +1,36 @@
#include "statisticswidget.h"
+#include "models.h"
+#include <QModelIndex>
YearlyStatisticsWidget::YearlyStatisticsWidget(QWidget *parent): QGraphicsView(parent)
{
}
+
+void YearlyStatisticsWidget::setModel(YearlyStatisticsModel *m)
+{
+ m_model = m;
+ connect(m, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
+ this, SLOT(modelDataChanged(QModelIndex,QModelIndex)));
+ connect(m, SIGNAL(rowsRemoved(QModelIndex,int,int)),
+ this, SLOT(modelRowsRemoved(QModelIndex,int,int)));
+ connect(m, SIGNAL(rowsInserted(QModelIndex,int,int)),
+ this, SLOT(modelRowsInserted(QModelIndex,int,int)));
+
+ modelRowsRemoved(QModelIndex(),0,m_model->rowCount()-1);
+ modelRowsInserted(QModelIndex(),0,m_model->rowCount()-1);
+}
+
+void YearlyStatisticsWidget::modelRowsInserted(const QModelIndex &index, int first, int last)
+{
+ // stub
+}
+
+void YearlyStatisticsWidget::modelRowsRemoved(const QModelIndex &index, int first, int last)
+{
+ // stub
+}
+
+void YearlyStatisticsWidget::modelDataChanged(const QModelIndex &topLeft, const QModelIndex& bottomRight)
+{
+ // stub
+}
diff --git a/qt-ui/statistics/statisticswidget.h b/qt-ui/statistics/statisticswidget.h
index b01f2ee17..0042ce67c 100644
--- a/qt-ui/statistics/statisticswidget.h
+++ b/qt-ui/statistics/statisticswidget.h
@@ -3,10 +3,20 @@
#include <QGraphicsView>
+class YearlyStatisticsModel;
+class QModelIndex;
+
class YearlyStatisticsWidget : public QGraphicsView {
Q_OBJECT
public:
YearlyStatisticsWidget(QWidget *parent = 0);
+ void setModel(YearlyStatisticsModel *m);
+public slots:
+ void modelRowsInserted(const QModelIndex& index, int first, int last);
+ void modelRowsRemoved(const QModelIndex& index, int first, int last);
+ void modelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
+private:
+ YearlyStatisticsModel *m_model;
};
#endif \ No newline at end of file