summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMarek Rosa <marek.rosa@digia.com>2012-11-30 12:29:02 +0200
committerMarek Rosa <marek.rosa@digia.com>2012-11-30 12:29:02 +0200
commitfb1a20e828dd15d546e0cf48ff5f740406de6e14 (patch)
treede8a76c9284e7da7de44739d18b701e8115c4f0f /examples
parent96f0cba4f31e6df42f1100e77efd6cfefab3cc2e (diff)
Scrollchart example removed
Diffstat (limited to 'examples')
-rw-r--r--examples/examples.pro1
-rw-r--r--examples/scrollchart/chart.cpp63
-rw-r--r--examples/scrollchart/chart.h45
-rw-r--r--examples/scrollchart/chartview.cpp112
-rw-r--r--examples/scrollchart/chartview.h45
-rw-r--r--examples/scrollchart/main.cpp89
-rw-r--r--examples/scrollchart/scrollchart.pro7
7 files changed, 0 insertions, 362 deletions
diff --git a/examples/examples.pro b/examples/examples.pro
index 60b5702d..969f351a 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -28,7 +28,6 @@ SUBDIRS += \
horizontalstackedbarchart \
horizontalpercentbarchart \
donutbreakdown \
- scrollchart \
temperaturerecords \
donutchart \
multiaxis \
diff --git a/examples/scrollchart/chart.cpp b/examples/scrollchart/chart.cpp
deleted file mode 100644
index cef33d76..00000000
--- a/examples/scrollchart/chart.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Commercial Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chart.h"
-#include <QGesture>
-#include <QGraphicsScene>
-#include <QGraphicsView>
-
-Chart::Chart(QGraphicsItem *parent, Qt::WindowFlags wFlags)
- : QChart(parent, wFlags)
-{
- // Seems that QGraphicsView (QChartView) does not grab gestures.
- // They can only be grabbed here in the QGraphicsWidget (QChart).
- grabGesture(Qt::PanGesture);
- grabGesture(Qt::PinchGesture);
-}
-
-Chart::~Chart()
-{
-
-}
-
-//![1]
-bool Chart::sceneEvent(QEvent *event)
-{
- if (event->type() == QEvent::Gesture)
- return gestureEvent(static_cast<QGestureEvent *>(event));
- return QChart::event(event);
-}
-
-bool Chart::gestureEvent(QGestureEvent *event)
-{
- if (QGesture *gesture = event->gesture(Qt::PanGesture)) {
- QPanGesture *pan = static_cast<QPanGesture *>(gesture);
- QChart::scroll(pan->delta().x(), pan->delta().y());
- }
-
- if (QGesture *gesture = event->gesture(Qt::PinchGesture)) {
- QPinchGesture *pinch = static_cast<QPinchGesture *>(gesture);
- if (pinch->changeFlags() & QPinchGesture::ScaleFactorChanged)
- QChart::zoom(pinch->scaleFactor());
- }
-
- return true;
-}
-//![1]
diff --git a/examples/scrollchart/chart.h b/examples/scrollchart/chart.h
deleted file mode 100644
index 0a6e7025..00000000
--- a/examples/scrollchart/chart.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Commercial Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CHART_H
-#define CHART_H
-
-#include <QChart>
-
-class QGestureEvent;
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-//![1]
-class Chart : public QChart
-//![1]
-{
-public:
- explicit Chart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
- ~Chart();
-
-protected:
- bool sceneEvent(QEvent *event);
-
-private:
- bool gestureEvent(QGestureEvent *event);
-};
-
-#endif // CHART_H
diff --git a/examples/scrollchart/chartview.cpp b/examples/scrollchart/chartview.cpp
deleted file mode 100644
index 30cc5d66..00000000
--- a/examples/scrollchart/chartview.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2012 Digia Plc
- ** All rights reserved.
- ** For any questions to Digia, please use contact form at http://qt.digia.com
- **
- ** This file is part of the Qt Commercial Charts Add-on.
- **
- ** $QT_BEGIN_LICENSE$
- ** Licensees holding valid Qt Commercial licenses may use this file in
- ** accordance with the Qt Commercial License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.
- **
- ** If you have questions regarding the use of this file, please use
- ** contact form at http://qt.digia.com
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "chartview.h"
-#include <QMouseEvent>
-#include <QDebug>
-
-ChartView::ChartView(QChart *chart, QWidget *parent) :
- QChartView(chart, parent),
- m_isScrolling(false),
- m_rubberBand(QRubberBand::Rectangle, this)
-{
- // setRubberBand(QChartView::RectangleRubberBand);
- this->chart()->setAnimationOptions(QChart::NoAnimation);
-}
-
-void ChartView::mousePressEvent(QMouseEvent *event)
-{
- if (event->button() == Qt::RightButton) {
-
- QRectF rect = chart()->plotArea();
-
- m_origin = event->pos();
-
- if (!rect.contains(m_origin))
- return;
-
- m_rubberBand.setGeometry(QRect(m_origin, QSize()));
- m_rubberBand.show();
- }
-
- if (event->button() == Qt::LeftButton) {
- m_origin = event->pos();
- m_isScrolling = true;
- }
-
- event->accept();
-}
-
-void ChartView::mouseMoveEvent(QMouseEvent *event)
-{
- if (m_rubberBand.isVisible())
- m_rubberBand.setGeometry(QRect(m_origin, event->pos()).normalized());
-
- if (m_isScrolling) {
- QPointF delta = m_origin - event->pos();
- chart()->scroll(delta.x(), -delta.y());
- m_origin = event->pos();
- }
-
-}
-
-void ChartView::mouseReleaseEvent(QMouseEvent *event)
-{
- if (event->button() == Qt::RightButton && m_rubberBand.isVisible()) {
- m_rubberBand.hide();
-
- QRect rect = m_rubberBand.geometry();
- chart()->zoomIn(rect);
- event->accept();
- }
-
- if (event->button() == Qt::LeftButton) {
- m_isScrolling = false;
- }
-}
-
-//![1]
-void ChartView::keyPressEvent(QKeyEvent *event)
-{
- switch (event->key()) {
- case Qt::Key_Plus:
- chart()->zoomIn();
- break;
- case Qt::Key_Minus:
- chart()->zoomOut();
- break;
-//![1]
- case Qt::Key_Left:
- chart()->scroll(-10, 0);
- break;
- case Qt::Key_Right:
- chart()->scroll(10, 0);
- break;
- case Qt::Key_Up:
- chart()->scroll(0, 10);
- break;
- case Qt::Key_Down:
- chart()->scroll(0, -10);
- break;
- default:
- QGraphicsView::keyPressEvent(event);
- break;
- }
-}
diff --git a/examples/scrollchart/chartview.h b/examples/scrollchart/chartview.h
deleted file mode 100644
index 41202e32..00000000
--- a/examples/scrollchart/chartview.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Commercial Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CHARTVIEW_H
-#define CHARTVIEW_H
-
-#include <QChartView>
-#include <QRubberBand>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class ChartView : public QChartView
-{
-public:
- ChartView(QChart *chart, QWidget *parent = 0);
-protected:
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void keyPressEvent(QKeyEvent *event);
-
-private:
- bool m_isScrolling;
- QRubberBand m_rubberBand;
- QPoint m_origin;
-};
-
-#endif
diff --git a/examples/scrollchart/main.cpp b/examples/scrollchart/main.cpp
deleted file mode 100644
index 693c28aa..00000000
--- a/examples/scrollchart/main.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2012 Digia Plc
- ** All rights reserved.
- ** For any questions to Digia, please use contact form at http://qt.digia.com
- **
- ** This file is part of the Qt Commercial Charts Add-on.
- **
- ** $QT_BEGIN_LICENSE$
- ** Licensees holding valid Qt Commercial licenses may use this file in
- ** accordance with the Qt Commercial License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.
- **
- ** If you have questions regarding the use of this file, please use
- ** contact form at http://qt.digia.com
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "chart.h"
-#include "chartview.h"
-#include <QApplication>
-#include <QMainWindow>
-#include <qmath.h>
-#include <QBarSeries>
-#include <QBarSet>
-#include <QBarCategoryAxis>
-#include <QLineSeries>
-#include <QHorizontalBarSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
- QLineSeries *series = new QLineSeries();
- for (int i = 0; i < 500; i++) {
- QPointF p((qreal) i, qSin(M_PI / 50 * i) * 100);
- p.ry() += qrand() % 20;
- *series << p;
- }
-
- QBarSet *set0 = new QBarSet("Jane");
- QBarSet *set1 = new QBarSet("John");
- QBarSet *set2 = new QBarSet("Axel");
- QBarSet *set3 = new QBarSet("Mary");
- QBarSet *set4 = new QBarSet("Samantha");
-
- *set0 << 1 << 2 << 3 << 4 << 5 << 6;
- *set1 << 5 << 0 << 0 << 4 << 0 << 7;
- *set2 << 3 << 5 << 8 << 13 << 8 << 5;
- *set3 << 5 << 6 << 7 << 3 << 4 << 5;
- *set4 << 9 << 7 << 5 << 3 << 1 << 2;
-
- //QHorizontalBarSeries* series2 = new QHorizontalBarSeries();
- QBarSeries *series2 = new QBarSeries();
- series2->append(set0);
- series2->append(set1);
- series2->append(set2);
- series2->append(set3);
- series2->append(set4);
-
- Chart *chart = new Chart();
- // chart->addSeries(series);
- chart->addSeries(series2);
- chart->setTitle("Scroll in/out example");
- chart->legend()->hide();
- chart->createDefaultAxes();
-
- QStringList categories;
- categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
- QBarCategoryAxis *axis = new QBarCategoryAxis();
- axis->append(categories);
- chart->setAxisX(axis, series2);
-
- ChartView *chartView = new ChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(400, 300);
- window.grabGesture(Qt::PanGesture);
- window.grabGesture(Qt::PinchGesture);
- window.show();
-
- return a.exec();
-}
diff --git a/examples/scrollchart/scrollchart.pro b/examples/scrollchart/scrollchart.pro
deleted file mode 100644
index 0e143064..00000000
--- a/examples/scrollchart/scrollchart.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-TARGET = scrollchart
-HEADERS += chart.h chartview.h
-
-SOURCES += main.cpp chart.cpp chartview.cpp